mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
Door drop fixed
This commit is contained in:
parent
230357a82c
commit
d3a627c977
3 changed files with 4 additions and 23 deletions
|
|
@ -35,10 +35,12 @@ class DoorBlock extends TransparentBlock{
|
||||||
*
|
*
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||||
$this->level->setBlock($this, new AirBlock(), false);
|
$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){
|
if($this->getSide(1) instanceof DoorBlock){
|
||||||
$this->level->setBlock($this->getSide(1), new AirBlock(), false);
|
$this->level->setBlock($this->getSide(1), new AirBlock(), false);
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +50,7 @@ class DoorBlock extends TransparentBlock{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Item $item
|
* @param Item $item
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
|
|
|
||||||
|
|
@ -46,17 +46,6 @@ class IronDoorBlock extends DoorBlock{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
|
||||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
|
||||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, $this->meta, 1));
|
|
||||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
|
||||||
return BLOCK_UPDATE_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDrops(Item $item, Player $player){
|
public function getDrops(Item $item, Player $player){
|
||||||
if($item->isPickaxe() >= 1){
|
if($item->isPickaxe() >= 1){
|
||||||
return array(
|
return array(
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,6 @@ class WoodDoorBlock extends DoorBlock{
|
||||||
$this->hardness = 15;
|
$this->hardness = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
|
||||||
if($type === BLOCK_UPDATE_NORMAL and $meta == 0x8){
|
|
||||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
|
||||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, $this->meta, 1));
|
|
||||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
|
||||||
return BLOCK_UPDATE_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDrops(Item $item, Player $player){
|
public function getDrops(Item $item, Player $player){
|
||||||
return array(
|
return array(
|
||||||
array(WOODEN_DOOR, 0, 1),
|
array(WOODEN_DOOR, 0, 1),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue