diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 48c1870e6..ce09d9148 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -653,25 +653,6 @@ class BlockAPI{ } } - break; - case 74: - if($type === BLOCK_UPDATE_SCHEDULED or $type === BLOCK_UPDATE_RANDOM){ - $changed = true; - $this->server->api->level->setBlock($x, $y, $z, 73, $block[1], false); - $type = BLOCK_UPDATE_WEAK; - } - break; - case 73: - if($type === BLOCK_UPDATE_NORMAL){ - $changed = true; - $this->server->api->level->setBlock($x, $y, $z, 74, $block[1], false); - $this->server->schedule(mt_rand(40, 100), array($this, "blockScheduler"), array( - "x" => $x, - "y" => $y, - "z" => $z, - )); - $type = BLOCK_UPDATE_WEAK; - } break; } if($type === BLOCK_TYPE_SCHEDULED){ @@ -698,7 +679,11 @@ class BlockAPI{ }else{ $block = $pos; } - return $block->onUpdate($this, $type); + $level = $block->onUpdate($this, $type); + if($level === BLOCK_UPDATE_NORMAL){ + $this->blockUpdateAround($block, $level); + } + return $level; } public function scheduleBlockUpdate(Vector3 $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){ @@ -715,9 +700,10 @@ class BlockAPI{ $type, $delay, ); - $this->server->query("INSERT INTO blockUpdates (x, y, z, type, delay) VALUES (".$pos->x.", ".$pos->y.", ".$pos->z.", ".$type.", ".$delay.");"); + $this->server->query("INSERT INTO blockUpdates (x, y, z, delay) VALUES (".$pos->x.", ".$pos->y.", ".$pos->z.", ".$delay.");"); return true; } + return false; } public function blockUpdateRemote($data, $event){ diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 9205368df..9b628defa 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -121,7 +121,7 @@ class PocketMinecraftServer{ $this->query("CREATE TABLE tileentities (ID INTEGER PRIMARY KEY, class TEXT, x NUMERIC, y NUMERIC, z NUMERIC, spawnable NUMERIC);"); $this->query("CREATE TABLE actions (ID INTEGER PRIMARY KEY, interval NUMERIC, last NUMERIC, code TEXT, repeat NUMERIC);"); $this->query("CREATE TABLE handlers (ID INTEGER PRIMARY KEY, name TEXT, priority NUMERIC);"); - $this->query("CREATE TABLE blockUpdates (x INTEGER, y INTEGER, z INTEGER, type INTEGER, delay NUMERIC);"); + $this->query("CREATE TABLE blockUpdates (x INTEGER, y INTEGER, z INTEGER, delay NUMERIC);"); //$this->query("PRAGMA synchronous = OFF;"); $this->preparedSQL->selectHandlers = $this->database->prepare("SELECT DISTINCT ID FROM handlers WHERE name = :name ORDER BY priority DESC;"); $this->preparedSQL->selectActions = $this->database->prepare("SELECT ID,code,repeat FROM actions WHERE last <= (:time - interval);");