Torches drop when no supporting block is present

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-17 17:09:48 +02:00
parent 758070e478
commit b34e55eec5
2 changed files with 24 additions and 13 deletions

View File

@ -296,17 +296,7 @@ class BlockAPI{
return false;
}
/*public function blockScheduler($data){
$this->updateBlock($data["x"], $data["y"], $data["z"], BLOCK_UPDATE_SCHEDULED);
}
public function updateBlockRemote($data, $event){
if($event !== "block.update"){
return;
}
$this->updateBlock($data["x"], $data["y"], $data["z"], isset($data["type"]) ? $data["type"]:BLOCK_UPDATE_RANDOM);
return true;
}
/*
public function flowLavaOn($source, $face){
$down = 0;

View File

@ -30,9 +30,30 @@ class TorchBlock extends FlowableBlock{
parent::__construct(TORCH, $meta, "Torch");
}
public function onUpdate(BlockAPI $level, $type){
if($type === BLOCK_UPDATE_NORMAL){
$side = $this->getMetadata();
$faces = array(
1 => 3,
2 => 2,
3 => 5,
4 => 4,
5 => 0,
6 => 0,
0 => 0,
);
if($level->getBlockFace($this, $faces[$side])->isTransparent === true){
$level->drop($this, BlockAPI::getItem($this->id));
$level->setBlock($this, AIR, 0, false);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($block->inWorld === true and $face !== 0){
if($target->isTransparent === false){
if($block->inWorld === true){
if($target->isTransparent === false and $face !== 0){
$faces = array(
1 => 5,
2 => 4,