ported by needs fixing

This commit is contained in:
GameHerobrine 2024-05-23 04:59:48 +03:00
parent fbf4131bbd
commit b94d0f2ba1
9 changed files with 201 additions and 13 deletions

View file

@ -536,6 +536,9 @@ class BlockAPI{
return $level;
}
public function blockUpdateAround(Position $pos, $type = BLOCK_UPDATE_NORMAL, $delay = false){
if($type == BLOCK_UPDATE_NORMAL){
@ -564,6 +567,24 @@ class BlockAPI{
$this->blockUpdate($pos->getSide(5), $type);
}
}
public function scheduleBlockUpdateXYZ(Level $level, $x, $y, $z, $type = BLOCK_UPDATE_SCHEDULED, $delay = false){
$type = (int) $type;
ConsoleAPI::debug($delay);
if($delay < 0){
return false;
}
$index = $x . "." . $y . "." . $z . "." . $level->getName() . "." . $type;
$delay = microtime(true) + $delay * 0.05;
ConsoleAPI::debug($index);
if(!isset($this->scheduledUpdates[$index])){
$this->scheduledUpdates[$index] = new Position($x, $y, $z, $level); //TODO dont create a position
$this->server->query("INSERT INTO blockUpdates (x, y, z, level, type, delay) VALUES ($x, $y, $z, '{$level->getName()}', $type, $delay);");
ConsoleAPI::debug("added block update $x $y $z $type");
return true;
}
return false;
}
public function scheduleBlockUpdate(Position $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){
$type = (int) $type;