separated neighbor updates and scheduled updates

This commit is contained in:
GameHerobrine 2024-05-22 06:15:34 +03:00
parent ee989ef556
commit 2ebc482e3d
36 changed files with 197 additions and 262 deletions

View file

@ -43,15 +43,11 @@ class PumpkinStemBlock extends FlowableBlock{
}
}
}
public static function onUpdate(Level $level, $x, $y, $z, $type){
if($type === BLOCK_UPDATE_NORMAL){
if($level->level->getBlockID($x, $y - 1, $z) != FARMLAND){
ServerAPI::request()->api->entity->drop(new Position($x+0.5, $y, $z+0.5, $level), BlockAPI::getItem(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
$level->fastSetBlockUpdate($x, $y, $z, 0, 0);
return BLOCK_UPDATE_NORMAL;
}
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){
if($level->level->getBlockID($x, $y - 1, $z) != FARMLAND){
ServerAPI::request()->api->entity->drop(new Position($x+0.5, $y, $z+0.5, $level), BlockAPI::getItem(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
$level->fastSetBlockUpdate($x, $y, $z, 0, 0);
}
return false;
}
public function onActivate(Item $item, Player $player){