mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
trapdoor breaks if it is in the air
This commit is contained in:
parent
2c2210bfff
commit
92f201b77b
1 changed files with 20 additions and 3 deletions
|
|
@ -39,9 +39,6 @@ class TrapdoorBlock extends TransparentBlock{
|
||||||
5 => 3,
|
5 => 3,
|
||||||
);
|
);
|
||||||
$this->meta = $faces[$face] & 0x03;
|
$this->meta = $faces[$face] & 0x03;
|
||||||
if($fy > 0.5){
|
|
||||||
$this->meta |= 0x08;
|
|
||||||
}
|
|
||||||
$this->level->setBlock($block, $this, true, false, true);
|
$this->level->setBlock($block, $this, true, false, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -51,6 +48,26 @@ class TrapdoorBlock extends TransparentBlock{
|
||||||
array($this->id, 0, 1),
|
array($this->id, 0, 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
public function onUpdate($type){
|
||||||
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
|
$faces = array( //meta => side
|
||||||
|
0 => 3,
|
||||||
|
4 => 3, //activated
|
||||||
|
1 => 2,
|
||||||
|
5 => 2, //activated
|
||||||
|
2 => 5,
|
||||||
|
6 => 5, //activated
|
||||||
|
3 => 4,
|
||||||
|
7 => 4, //activated
|
||||||
|
);
|
||||||
|
$side = $faces[$this->meta];
|
||||||
|
if($this->getSide($side) instanceof AirBlock){ //Replace with common break method
|
||||||
|
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
|
||||||
|
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||||
|
return BLOCK_UPDATE_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public function onActivate(Item $item, Player $player){
|
public function onActivate(Item $item, Player $player){
|
||||||
$this->meta ^= 0x04;
|
$this->meta ^= 0x04;
|
||||||
$this->level->setBlock($this, $this, true, false, true);
|
$this->level->setBlock($this, $this, true, false, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue