Fixed bed placement with head over a transparent block

This commit is contained in:
Dylan K. Taylor 2017-05-23 10:15:53 +01:00
parent 8a3b31077e
commit 253db40a11

View File

@ -27,6 +27,7 @@ use pocketmine\event\TranslationContainer;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
@ -106,7 +107,7 @@ class Bed extends Transparent{
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->isTransparent() === false){
$faces = [
0 => 3,
@ -116,7 +117,7 @@ class Bed extends Transparent{
];
$d = $player instanceof Player ? $player->getDirection() : 0;
$next = $this->getSide($faces[($d + 3) % 4]);
$downNext = $this->getSide(0);
$downNext = $next->getSide(Vector3::SIDE_DOWN);
if($next->canBeReplaced() === true and $downNext->isTransparent() === false){
$meta = (($d + 3) % 4) & 0x03;
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);