mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Disable placing a chest when a chest already exists on the side
This commit is contained in:
parent
a3268d2405
commit
e1c5d965a0
@ -32,22 +32,28 @@ class ChestBlock extends SolidBlock{
|
|||||||
}
|
}
|
||||||
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($block->inWorld === true){
|
if($block->inWorld === true){
|
||||||
$faces = array(
|
$block0 = $level->getBlockFace($block, 2);
|
||||||
0 => 4,
|
$block1 = $level->getBlockFace($block, 3);
|
||||||
1 => 2,
|
$block2 = $level->getBlockFace($block, 4);
|
||||||
2 => 5,
|
$block3 = $level->getBlockFace($block, 5);
|
||||||
3 => 3,
|
if($block0->getID() !== CHEST and $block1->getID() !== CHEST and $block2->getID() !== CHEST and $block3->getID() !== CHEST){
|
||||||
);
|
$faces = array(
|
||||||
$level->setBlock($block, $this->id, $faces[$player->entity->getDirection()]);
|
0 => 4,
|
||||||
$server = ServerAPI::request();
|
1 => 2,
|
||||||
$server->api->tileentity->add(TILE_CHEST, $this->x, $this->y, $this->z, array(
|
2 => 5,
|
||||||
"Items" => array(),
|
3 => 3,
|
||||||
"id" => TILE_CHEST,
|
);
|
||||||
"x" => $this->x,
|
$level->setBlock($block, $this->id, $faces[$player->entity->getDirection()]);
|
||||||
"y" => $this->y,
|
$server = ServerAPI::request();
|
||||||
"z" => $this->z
|
$server->api->tileentity->add(TILE_CHEST, $this->x, $this->y, $this->z, array(
|
||||||
));
|
"Items" => array(),
|
||||||
return true;
|
"id" => TILE_CHEST,
|
||||||
|
"x" => $this->x,
|
||||||
|
"y" => $this->y,
|
||||||
|
"z" => $this->z
|
||||||
|
));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user