diff --git a/src/block/Bed.php b/src/block/Bed.php index 19c60667c..3979b8a09 100644 --- a/src/block/Bed.php +++ b/src/block/Bed.php @@ -29,7 +29,6 @@ use pocketmine\block\utils\ColoredTrait; use pocketmine\block\utils\DyeColor; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\data\bedrock\DyeColorIdMap; -use pocketmine\item\Bed as ItemBed; use pocketmine\item\Item; use pocketmine\item\ItemFactory; use pocketmine\lang\KnownTranslationKeys; @@ -174,9 +173,6 @@ class Bed extends Transparent{ } public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ - if($item instanceof ItemBed){ //TODO: the item should do this - $this->color = $item->getColor(); - } $down = $this->getSide(Facing::DOWN); if(!$down->isTransparent()){ $this->facing = $player !== null ? $player->getHorizontalFacing() : Facing::NORTH; diff --git a/src/block/Skull.php b/src/block/Skull.php index 9c0564947..ae6abe8d5 100644 --- a/src/block/Skull.php +++ b/src/block/Skull.php @@ -29,7 +29,6 @@ use pocketmine\block\utils\SkullType; use pocketmine\item\Item; use pocketmine\item\ItemFactory; use pocketmine\item\ItemIds; -use pocketmine\item\Skull as ItemSkull; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -137,9 +136,6 @@ class Skull extends Flowable{ } $this->facing = $face; - if($item instanceof ItemSkull){ - $this->skullType = $item->getSkullType(); //TODO: the item should handle this, but this hack is currently needed because of tile mess - } if($player !== null and $face === Facing::UP){ $this->rotation = ((int) floor(($player->getLocation()->getYaw() * 16 / 360) + 0.5)) & 0xf; } diff --git a/src/item/Bed.php b/src/item/Bed.php index 887ff6130..c1251ac63 100644 --- a/src/item/Bed.php +++ b/src/item/Bed.php @@ -42,7 +42,7 @@ class Bed extends Item{ } public function getBlock(?int $clickedFace = null) : Block{ - return VanillaBlocks::BED(); + return VanillaBlocks::BED()->setColor($this->color); } public function getMaxStackSize() : int{ diff --git a/src/item/Skull.php b/src/item/Skull.php index 77f4b5f9a..6e4a98203 100644 --- a/src/item/Skull.php +++ b/src/item/Skull.php @@ -38,7 +38,9 @@ class Skull extends Item{ } public function getBlock(?int $clickedFace = null) : Block{ - return VanillaBlocks::MOB_HEAD(); + //TODO: we ought to be able to represent this as a regular ItemBlock + //but that's not currently possible because the skulltype isn't part of the internal block runtimeID + return VanillaBlocks::MOB_HEAD()->setSkullType($this->skullType); } public function getSkullType() : SkullType{