From 93cfa035d4f6e653c36b2f25e1a66ed5e8d9d1ff Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Fri, 5 Apr 2013 12:37:08 +0200 Subject: [PATCH] Fixed #187 Opening Chests with solid blocks on top --- src/material/block/solid/BurningFurnace.php | 5 ++++- src/material/block/solid/Chest.php | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/material/block/solid/BurningFurnace.php b/src/material/block/solid/BurningFurnace.php index b1c3c19b..c248b12b 100644 --- a/src/material/block/solid/BurningFurnace.php +++ b/src/material/block/solid/BurningFurnace.php @@ -68,6 +68,9 @@ class BurningFurnaceBlock extends SolidBlock{ } public function onActivate(BlockAPI $level, Item $item, Player $player){ + if($this->inWorld !== true){ + return false; + } $server = ServerAPI::request(); $t = $server->api->tileentity->get($this); $furnace = false; @@ -88,7 +91,7 @@ class BurningFurnaceBlock extends SolidBlock{ } if($furnace->class !== TILE_FURNACE){ - return false; + return true; } $id = $player->windowCnt = $player->windowCnt++ % 255; $player->windows[$id] = $furnace; diff --git a/src/material/block/solid/Chest.php b/src/material/block/solid/Chest.php index d774db2b..3fe1968d 100644 --- a/src/material/block/solid/Chest.php +++ b/src/material/block/solid/Chest.php @@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or */ -class ChestBlock extends SolidBlock{ +class ChestBlock extends TransparentBlock{ public function __construct($meta = 0){ parent::__construct(CHEST, $meta, "Chest"); $this->isActivable = true; @@ -80,6 +80,14 @@ class ChestBlock extends SolidBlock{ } public function onActivate(BlockAPI $level, Item $item, Player $player){ + if($this->inWorld !== true){ + return false; + } + $top = $level->getBlockFace($this, 1); + if($top->isTransparent !== true){ + return true; + } + $server = ServerAPI::request(); $t = $server->api->tileentity->get($this); $chest = false; @@ -100,8 +108,9 @@ class ChestBlock extends SolidBlock{ } if($chest->class !== TILE_CHEST){ - return false; + return true; } + $id = $player->windowCnt = $player->windowCnt++ % 255; $player->windows[$id] = $chest; $player->dataPacket(MC_CONTAINER_OPEN, array(