mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Stair Block placement
This commit is contained in:
parent
b45676d2b5
commit
8df59078ad
@ -193,4 +193,5 @@ require_once("block/GenericBlock.php");
|
||||
require_once("block/SolidBlock.php");
|
||||
require_once("block/TransparentBlock.php");
|
||||
require_once("block/FallableBlock.php");
|
||||
require_once("block/LiquidBlock.php");
|
||||
require_once("block/LiquidBlock.php");
|
||||
require_once("block/StairBlock.php");
|
||||
|
56
src/classes/material/block/StairBlock.php
Normal file
56
src/classes/material/block/StairBlock.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
-
|
||||
/ \
|
||||
/ \
|
||||
/ PocketMine \
|
||||
/ MP \
|
||||
|\ @shoghicp /|
|
||||
|. \ / .|
|
||||
| .. \ / .. |
|
||||
| .. | .. |
|
||||
| .. | .. |
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class StairBlock extends TransparentBlock{
|
||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||
parent::__construct($id, $meta, $name);
|
||||
}
|
||||
|
||||
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($block->inWorld === true){
|
||||
$faces = array(
|
||||
0 => 0,
|
||||
1 => 2,
|
||||
2 => 1,
|
||||
3 => 3,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
if($fy > 0.5){
|
||||
$this->meta |= 0x04; //Upside-down stairs
|
||||
}
|
||||
$level->setBlock($block, $this->id, $this->meta);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class BrickStairsBlock extends TransparentBlock{
|
||||
class BrickStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BRICK_STAIRS, $meta, "Brick Stairs");
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class CobblestoneStairsBlock extends TransparentBlock{
|
||||
class CobblestoneStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs");
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class NetherBrickStairsBlock extends TransparentBlock{
|
||||
class NetherBrickStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(NETHER_BRICK_STAIRS, $meta, "Nether Brick Stairs");
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class SandstoneStairsBlock extends TransparentBlock{
|
||||
class SandstoneStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(SANDSTONE_STAIRS, $meta, "Sandstone Stairs");
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class StoneBrickStairsBlock extends TransparentBlock{
|
||||
class StoneBrickStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs");
|
||||
}
|
@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class WoodStairsBlock extends TransparentBlock{
|
||||
class WoodStairsBlock extends StairBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WOOD_STAIRS, $meta, "Wood Stairs");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user