mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 07:25:31 +00:00
Block: Fix fence gate rotation when opened or closed. TODO: fix gate opening direction
This commit is contained in:
parent
4f26e5598c
commit
bf4b96e144
@ -59,7 +59,7 @@ class FenceGate extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$i = ($this->getDamage() & 0x03);
|
$i = ($this->getDamage() & 0x03);
|
||||||
if($i === 2 and $i === 0){
|
if($i === 2 or $i === 0){
|
||||||
return new AxisAlignedBB(
|
return new AxisAlignedBB(
|
||||||
$this->x,
|
$this->x,
|
||||||
$this->y,
|
$this->y,
|
||||||
@ -100,13 +100,9 @@ class FenceGate extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null){
|
||||||
$faces = [
|
$this->meta ^= 0x04; //Flip open/close state
|
||||||
0 => 3,
|
//TODO: Face player when opened
|
||||||
1 => 0,
|
|
||||||
2 => 1,
|
|
||||||
3 => 2,
|
|
||||||
];
|
|
||||||
$this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04);
|
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this, true);
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user