From d07149774780ebb840bc1585c2410be4bf1a32dd Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 15 May 2013 23:29:35 +0200 Subject: [PATCH] Fixed redstone scheduled update --- src/material/block/ore/GlowingRedstoneOre.php | 2 +- src/material/block/ore/RedstoneOre.php | 2 +- src/world/Level.php | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/material/block/ore/GlowingRedstoneOre.php b/src/material/block/ore/GlowingRedstoneOre.php index b46ed78d..a9c787dc 100644 --- a/src/material/block/ore/GlowingRedstoneOre.php +++ b/src/material/block/ore/GlowingRedstoneOre.php @@ -35,7 +35,7 @@ class GlowingRedstoneOreBlock extends SolidBlock{ $this->level->setBlock($this, BlockAPI::get(REDSTONE_ORE, $this->meta), false); return BLOCK_UPDATE_WEAK; }else{ - $level->scheduleBlockUpdate($this, mt_rand(45, 100)); + $this->level->scheduleBlockUpdate($this, mt_rand(45, 100)); } return false; } diff --git a/src/material/block/ore/RedstoneOre.php b/src/material/block/ore/RedstoneOre.php index 6231eac7..d7ad0557 100644 --- a/src/material/block/ore/RedstoneOre.php +++ b/src/material/block/ore/RedstoneOre.php @@ -32,7 +32,7 @@ class RedstoneOreBlock extends SolidBlock{ public function onUpdate($type){ if($type === BLOCK_UPDATE_NORMAL or $type === BLOCK_UPDATE_TOUCH){ - $this->level->setBlock($this, GLOWING_REDSTONE_ORE, $this->getMetadata(), false); + $this->level->setBlock($this, BlockAPI::get(GLOWING_REDSTONE_ORE, $this->meta), false); $this->level->scheduleBlockUpdate($this, mt_rand(45, 100)); return BLOCK_UPDATE_WEAK; } diff --git a/src/world/Level.php b/src/world/Level.php index 093771ab..e42e2311 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -180,7 +180,7 @@ class Level{ )) !== false){ $ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata()); if($update === true){ - $this->server->api->block->blockUpdate($pos, BLOCK_UPDATE_NORMAL); //????? water? + $this->server->api->block->blockUpdate($this->getBlock($pos), BLOCK_UPDATE_NORMAL); //????? water? $this->server->api->block->blockUpdateAround($pos, BLOCK_UPDATE_NORMAL); } if($tiles === true){ @@ -256,4 +256,8 @@ class Level{ public function getSeed(){ return (int) $this->level->getData("seed"); } + + public function scheduleBlockUpdate(Position $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){ + return $this->server->api->block->scheduleBlockUpdate($pos, $delay, $type); + } } \ No newline at end of file