Updated TileEntity API [fixes #306]

This commit is contained in:
Shoghi Cervantes
2013-05-29 23:13:01 +02:00
parent 25de7a68d5
commit 450b5d9560
5 changed files with 10 additions and 53 deletions

View File

@@ -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(),

View File

@@ -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(),