diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 09aff9e3e..48c1870e6 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -30,6 +30,7 @@ define("BLOCK_UPDATE_NORMAL", 0); define("BLOCK_UPDATE_RANDOM", 1); define("BLOCK_UPDATE_SCHEDULED", 2); define("BLOCK_UPDATE_WEAK", 3); +define("BLOCK_UPDATE_TOUCH", 4); @@ -244,6 +245,7 @@ class BlockAPI{ if($this->server->api->dhandle("player.block.touch", array("type" => "place", "player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){ return $this->cancelAction($block, $player); } + $this->blockUpdate($target, BLOCK_UPDATE_TOUCH); if($target->isActivable === true){ if($this->server->api->dhandle("player.block.activate", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== false and $target->onActivate($this, $item, $player) === true){ @@ -690,12 +692,16 @@ class BlockAPI{ } public function blockUpdate(Vector3 $pos, $type = BLOCK_UPDATE_NORMAL){ - $pos = $pos->floor(); - $block = $this->getBlock($pos); + if(!($pos instanceof Block)){ + $pos = $pos->floor(); + $block = $this->getBlock($pos); + }else{ + $block = $pos; + } return $block->onUpdate($this, $type); } - public function scheduleBlockUpdate(Vector3 $pos, $delay, $type = BLOCK_UPDATE_NORMAL){ + public function scheduleBlockUpdate(Vector3 $pos, $delay, $type = BLOCK_UPDATE_SCHEDULED){ $type = (int) $type; if($delay < 0){ return false; diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index f8f0c6687..daa9062e1 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -255,7 +255,7 @@ class ServerAPI{ foreach($this->plugin->getList() as $p){ $plist .= str_replace(array(";", ":"), "", $p["name"]).":".str_replace(array(";", ":"), "", $p["version"]).";"; } - Utils::curl_post("http://stats.pocketmine.net/usage.php",array( + Utils::curl_post("http://stats.pocketmine.net/usage.php", array( "serverid" => $this->server->serverID, "os" => Utils::getOS(), "version" => MAJOR_VERSION, diff --git a/src/material/block/ore/GlowingRedstoneOre.php b/src/material/block/ore/GlowingRedstoneOre.php index 5882baa62..ff925e3c5 100644 --- a/src/material/block/ore/GlowingRedstoneOre.php +++ b/src/material/block/ore/GlowingRedstoneOre.php @@ -29,5 +29,25 @@ class GlowingRedstoneOreBlock extends SolidBlock{ public function __construct(){ parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore"); } + + public function onUpdate(BlockAPI $level, $type){ + if($type === BLOCK_UPDATE_SCHEDULED or $type === BLOCK_UPDATE_RANDOM){ + $level->setBlock($this, REDSTONE_ORE, $this->getMetadata(), false); + return BLOCK_UPDATE_WEAK; + }else{ + $level->scheduleBlockUpdate($this, mt_rand(45, 100)); + } + return false; + } + + public function getDrops(Item $item, Player $player){ + if($item->isPickaxe() >= 2){ + return array( + //array(331, 4, mt_rand(4, 5)), + ); + }else{ + return array(); + } + } } \ No newline at end of file diff --git a/src/material/block/ore/RedstoneOre.php b/src/material/block/ore/RedstoneOre.php index 796198aad..8effc8805 100644 --- a/src/material/block/ore/RedstoneOre.php +++ b/src/material/block/ore/RedstoneOre.php @@ -29,6 +29,16 @@ class RedstoneOreBlock extends SolidBlock{ public function __construct(){ parent::__construct(REDSTONE_ORE, 0, "Redstone Ore"); } + + public function onUpdate(BlockAPI $level, $type){ + if($type === BLOCK_UPDATE_NORMAL or $type === BLOCK_UPDATE_TOUCH){ + $level->setBlock($this, GLOWING_REDSTONE_ORE, $this->getMetadata(), false); + $level->scheduleBlockUpdate($this, mt_rand(45, 100)); + return BLOCK_UPDATE_WEAK; + } + return false; + } + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 2){ return array(