mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
ported by needs fixing
This commit is contained in:
parent
fbf4131bbd
commit
b94d0f2ba1
9 changed files with 201 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue