mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 23:59:53 +00:00
Allow vanilla trapdoor placement
This commit is contained in:
parent
7145e16bce
commit
e2e31d345d
@ -126,24 +126,20 @@ class Trapdoor extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||||
if(($target->isTransparent() === false or $target->getId() === self::SLAB) and $face !== 0 and $face !== 1){
|
$directions = [
|
||||||
$faces = [
|
0 => 1,
|
||||||
self::SIDE_SOUTH => self::MASK_SIDE_SOUTH,
|
1 => 3,
|
||||||
self::SIDE_NORTH => self::MASK_SIDE_NORTH,
|
2 => 0,
|
||||||
self::SIDE_EAST => self::MASK_SIDE_EAST,
|
3 => 2
|
||||||
self::SIDE_WEST => self::MASK_SIDE_WEST,
|
];
|
||||||
];
|
if($player !== null){
|
||||||
echo $face, PHP_EOL, $faces[$face], PHP_EOL;
|
$this->meta = $directions[$player->getDirection() & 0x03];
|
||||||
$this->meta = $faces[$face] & self::MASK_SIDE;
|
|
||||||
if($fy > 0.5){
|
|
||||||
$this->meta |= self::MASK_UPPER;
|
|
||||||
}
|
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if(($fy > 0.5 and $face !== self::SIDE_UP) or $face === self::SIDE_DOWN){
|
||||||
return false;
|
$this->meta |= self::MASK_UPPER; //top half of block
|
||||||
|
}
|
||||||
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user