mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Updated TileEntity API [fixes #306]
This commit is contained in:
@@ -46,19 +46,7 @@ class BurningFurnaceBlock extends SolidBlock{
|
||||
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$server = ServerAPI::request();
|
||||
$t = $server->api->tileentity->get($this);
|
||||
if($t !== false){
|
||||
if(is_array($t)){
|
||||
foreach($t as $ts){
|
||||
if($ts->class === TILE_FURNACE){
|
||||
$server->api->tileentity->remove($ts->id);
|
||||
}
|
||||
}
|
||||
}elseif($t->class === TILE_FURNACE){
|
||||
$server->api->tileentity->remove($t->id);
|
||||
}
|
||||
}
|
||||
$this->level->setBlock($this, new AirBlock());
|
||||
$this->level->setBlock($this, new AirBlock(), true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -68,11 +56,7 @@ class BurningFurnaceBlock extends SolidBlock{
|
||||
$t = $server->api->tileentity->get($this);
|
||||
$furnace = false;
|
||||
if($t !== false){
|
||||
if(is_array($t)){
|
||||
$furnace = array_shift($t);
|
||||
}else{
|
||||
$furnace = $t;
|
||||
}
|
||||
$furnace = $t;
|
||||
}else{
|
||||
$furnace = $server->api->tileentity->add($this->level, TILE_FURNACE, $this->x, $this->y, $this->z, array(
|
||||
"Items" => array(),
|
||||
|
@@ -59,19 +59,7 @@ class ChestBlock extends TransparentBlock{
|
||||
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$server = ServerAPI::request();
|
||||
$t = $server->api->tileentity->get($this);
|
||||
if($t !== false){
|
||||
if(is_array($t)){
|
||||
foreach($t as $ts){
|
||||
if($ts->class === TILE_CHEST){
|
||||
$server->api->tileentity->remove($ts->id);
|
||||
}
|
||||
}
|
||||
}elseif($t->class === TILE_CHEST){
|
||||
$server->api->tileentity->remove($t->id);
|
||||
}
|
||||
}
|
||||
$this->level->setBlock($this, new AirBlock());
|
||||
$this->level->setBlock($this, new AirBlock(), true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -85,11 +73,7 @@ class ChestBlock extends TransparentBlock{
|
||||
$t = $server->api->tileentity->get($this);
|
||||
$chest = false;
|
||||
if($t !== false){
|
||||
if(is_array($t)){
|
||||
$chest = array_shift($t);
|
||||
}else{
|
||||
$chest = $t;
|
||||
}
|
||||
$chest = $t;
|
||||
}else{
|
||||
$chest = $server->api->tileentity->add($this->level, TILE_CHEST, $this->x, $this->y, $this->z, array(
|
||||
"Items" => array(),
|
||||
|
Reference in New Issue
Block a user