mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
sugarcane will drop if it will detect no water nearby
This commit is contained in:
parent
ab83f135f1
commit
c8cfbcd38a
3 changed files with 14 additions and 2 deletions
|
|
@ -542,7 +542,6 @@ class BlockAPI{
|
|||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL, $delay = false){
|
||||
if($delay !== false){
|
||||
$this->scheduleBlockUpdate($pos->getSide(0), $delay, $type);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,19 @@ class SugarcaneBlock extends FlowableBlock{
|
|||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === SAND){
|
||||
$block0 = $down->getSide(2);
|
||||
$block1 = $down->getSide(3);
|
||||
$block2 = $down->getSide(4);
|
||||
$block3 = $down->getSide(5);
|
||||
if(!($block0 instanceof WaterBlock) and !($block1 instanceof WaterBlock) and !($block2 instanceof WaterBlock) and !($block3 instanceof WaterBlock)){
|
||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(SUGARCANE));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === true and $down->getID() !== SUGARCANE_BLOCK){ //Replace with common break method
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Position extends Vector3{
|
|||
|
||||
return parent::distance($x, $y, $z);
|
||||
}
|
||||
|
||||
|
||||
public function __toString(){
|
||||
return "Position(level=" . $this->level->getName() . ",x=" . $this->x . ",y=" . $this->y . ",z=" . $this->z . ")";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue