mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 13:09:44 +00:00
commit
d603180b7d
1 changed files with 7 additions and 2 deletions
|
|
@ -29,7 +29,11 @@ class CactusBlock extends TransparentBlock{
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(0);
|
$down = $this->getSide(0);
|
||||||
if($down->getID() !== SAND and $down->getID() !== CACTUS){ //Replace with common break method
|
$block0 = $this->getSide(2);
|
||||||
|
$block1 = $this->getSide(3);
|
||||||
|
$block2 = $this->getSide(4);
|
||||||
|
$block3 = $this->getSide(5);
|
||||||
|
if($block0->isFlowable === false or $block1->isFlowable === false or $block2->isFlowable === false or $block3->isFlowable === false or ($down->getID() !== SAND and $down->getID() !== CACTUS)){ //Replace with common break method
|
||||||
$this->level->setBlock($this, new AirBlock(), false);
|
$this->level->setBlock($this, new AirBlock(), false);
|
||||||
ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem($this->id));
|
ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem($this->id));
|
||||||
return BLOCK_UPDATE_NORMAL;
|
return BLOCK_UPDATE_NORMAL;
|
||||||
|
|
@ -63,9 +67,10 @@ class CactusBlock extends TransparentBlock{
|
||||||
$block1 = $this->getSide(3);
|
$block1 = $this->getSide(3);
|
||||||
$block2 = $this->getSide(4);
|
$block2 = $this->getSide(4);
|
||||||
$block3 = $this->getSide(5);
|
$block3 = $this->getSide(5);
|
||||||
if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
|
if($block0->isFlowable === true and $block1->isFlowable === true and $block2->isFlowable === true and $block3->isFlowable === true){
|
||||||
$this->level->setBlock($this, $this, true, false, true);
|
$this->level->setBlock($this, $this, true, false, true);
|
||||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||||
|
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue