mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +00:00
Torches drop when no supporting block is present
This commit is contained in:
parent
758070e478
commit
b34e55eec5
@ -296,17 +296,7 @@ class BlockAPI{
|
|||||||
return false;
|
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){
|
public function flowLavaOn($source, $face){
|
||||||
$down = 0;
|
$down = 0;
|
||||||
|
@ -30,9 +30,30 @@ class TorchBlock extends FlowableBlock{
|
|||||||
parent::__construct(TORCH, $meta, "Torch");
|
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){
|
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($block->inWorld === true){
|
||||||
if($target->isTransparent === false){
|
if($target->isTransparent === false and $face !== 0){
|
||||||
$faces = array(
|
$faces = array(
|
||||||
1 => 5,
|
1 => 5,
|
||||||
2 => 4,
|
2 => 4,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user