mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +00:00
parent
9134a69936
commit
547e152e40
@ -44,6 +44,7 @@ class Torch extends Flowable{
|
|||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
|
$below = $this->getSide(0);
|
||||||
$side = $this->getDamage();
|
$side = $this->getDamage();
|
||||||
$faces = [
|
$faces = [
|
||||||
1 => 4,
|
1 => 4,
|
||||||
@ -55,7 +56,7 @@ class Torch extends Flowable{
|
|||||||
0 => 0,
|
0 => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if($this->getSide($faces[$side])->isTransparent() === true and !($side === 0 and $this->getSide(0)->getId() === self::FENCE)){
|
if($this->getSide($faces[$side])->isTransparent() === true and !($side === 0 and ($below->getId() === self::FENCE or $below->getId() === self::COBBLE_WALL))){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
|
||||||
return Level::BLOCK_UPDATE_NORMAL;
|
return Level::BLOCK_UPDATE_NORMAL;
|
||||||
@ -66,6 +67,8 @@ class Torch extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||||
|
$below = $this->getSide(0);
|
||||||
|
|
||||||
if($target->isTransparent() === false and $face !== 0){
|
if($target->isTransparent() === false and $face !== 0){
|
||||||
$faces = [
|
$faces = [
|
||||||
1 => 5,
|
1 => 5,
|
||||||
@ -78,7 +81,7 @@ class Torch extends Flowable{
|
|||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}elseif($this->getSide(0)->isTransparent() === false or $this->getSide(0)->getId() === self::FENCE){
|
}elseif($below->isTransparent() === false or $below->getId() === self::FENCE or $below->getId() === self::COBBLE_WALL){
|
||||||
$this->meta = 0;
|
$this->meta = 0;
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user