mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
separated neighbor updates and scheduled updates
This commit is contained in:
parent
ee989ef556
commit
2ebc482e3d
36 changed files with 197 additions and 262 deletions
|
|
@ -457,7 +457,8 @@ class BlockAPI{
|
|||
return $this->cancelAction($block, $player);
|
||||
}
|
||||
}
|
||||
$this->blockUpdate($target, BLOCK_UPDATE_TOUCH);
|
||||
|
||||
StaticBlock::getBlock($target->getID())::interact($target->level, $target->x, $target->y, $target->z, $player);
|
||||
|
||||
if($target->isActivable === true){
|
||||
if($this->server->api->dhandle("player.block.activate", ["player" => $player, "block" => $block, "target" => $target, "item" => $item]) !== false and $target->onActivate($item, $player) === true){
|
||||
|
|
@ -532,13 +533,21 @@ class BlockAPI{
|
|||
return false;
|
||||
}
|
||||
$level = $block::onUpdate($pos->level, $pos->x, $pos->y, $pos->z, $type);
|
||||
if($level === BLOCK_UPDATE_NORMAL){
|
||||
$this->blockUpdateAround($block, $level);
|
||||
}
|
||||
|
||||
return $level;
|
||||
}
|
||||
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL, $delay = false){
|
||||
|
||||
if($type == BLOCK_UPDATE_NORMAL){
|
||||
try{
|
||||
throw new Exception("Deprecated: tried updating $pos using BLOCK_UPDATE_NORMAL.");
|
||||
}catch(Exception $e){
|
||||
ConsoleAPI::error($e->getMessage());
|
||||
ConsoleAPI::error($e->getTraceAsString());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if($delay !== false){
|
||||
$this->scheduleBlockUpdate($pos->getSide(0), $delay, $type);
|
||||
$this->scheduleBlockUpdate($pos->getSide(1), $delay, $type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue