mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Fixed #187 Opening Chests with solid blocks on top
This commit is contained in:
parent
463e82a1e7
commit
93cfa035d4
@ -68,6 +68,9 @@ class BurningFurnaceBlock extends SolidBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(BlockAPI $level, Item $item, Player $player){
|
public function onActivate(BlockAPI $level, Item $item, Player $player){
|
||||||
|
if($this->inWorld !== true){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$server = ServerAPI::request();
|
$server = ServerAPI::request();
|
||||||
$t = $server->api->tileentity->get($this);
|
$t = $server->api->tileentity->get($this);
|
||||||
$furnace = false;
|
$furnace = false;
|
||||||
@ -88,7 +91,7 @@ class BurningFurnaceBlock extends SolidBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($furnace->class !== TILE_FURNACE){
|
if($furnace->class !== TILE_FURNACE){
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
$id = $player->windowCnt = $player->windowCnt++ % 255;
|
$id = $player->windowCnt = $player->windowCnt++ % 255;
|
||||||
$player->windows[$id] = $furnace;
|
$player->windows[$id] = $furnace;
|
||||||
|
@ -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){
|
public function __construct($meta = 0){
|
||||||
parent::__construct(CHEST, $meta, "Chest");
|
parent::__construct(CHEST, $meta, "Chest");
|
||||||
$this->isActivable = true;
|
$this->isActivable = true;
|
||||||
@ -80,6 +80,14 @@ class ChestBlock extends SolidBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(BlockAPI $level, Item $item, Player $player){
|
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();
|
$server = ServerAPI::request();
|
||||||
$t = $server->api->tileentity->get($this);
|
$t = $server->api->tileentity->get($this);
|
||||||
$chest = false;
|
$chest = false;
|
||||||
@ -100,8 +108,9 @@ class ChestBlock extends SolidBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($chest->class !== TILE_CHEST){
|
if($chest->class !== TILE_CHEST){
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = $player->windowCnt = $player->windowCnt++ % 255;
|
$id = $player->windowCnt = $player->windowCnt++ % 255;
|
||||||
$player->windows[$id] = $chest;
|
$player->windows[$id] = $chest;
|
||||||
$player->dataPacket(MC_CONTAINER_OPEN, array(
|
$player->dataPacket(MC_CONTAINER_OPEN, array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user