Door drop fixed

This commit is contained in:
ArkQuark 2022-05-04 21:49:18 +03:00
parent 230357a82c
commit d3a627c977
3 changed files with 4 additions and 23 deletions

View file

@ -35,10 +35,12 @@ class DoorBlock extends TransparentBlock{
*
* @return bool|int
*/
public function onUpdate($type){
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
$this->level->setBlock($this, new AirBlock(), false);
if($this->getID() == 64) ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y, $this->z+0.5, $this->level), BlockAPI::getItem(324, 0, 1));
elseif($this->getID() == 71) ServerAPI::request()->api->entity->drop(new Position($this->x+0.5, $this->y, $this->z+0.5, $this->level), BlockAPI::getItem(330, 0, 1));
if($this->getSide(1) instanceof DoorBlock){
$this->level->setBlock($this->getSide(1), new AirBlock(), false);
}
@ -48,6 +50,7 @@ class DoorBlock extends TransparentBlock{
return false;
}
/**
* @param Item $item
* @param Player $player