diff --git a/src/pocketmine/block/Anvil.php b/src/pocketmine/block/Anvil.php index 6dabf373c..9367017a1 100644 --- a/src/pocketmine/block/Anvil.php +++ b/src/pocketmine/block/Anvil.php @@ -27,6 +27,7 @@ use pocketmine\inventory\AnvilInventory; use pocketmine\item\Item; use pocketmine\item\ItemFactory; use pocketmine\item\Tool; +use pocketmine\math\AxisAlignedBB; use pocketmine\math\Vector3; use pocketmine\Player; @@ -67,6 +68,30 @@ class Anvil extends Fallable{ return Tool::TYPE_PICKAXE; } + public function recalculateBoundingBox() : ?AxisAlignedBB{ + $inset = 0.125; + + if($this->meta & 0x01){ //east/west + return new AxisAlignedBB( + $this->x, + $this->y, + $this->z + $inset, + $this->x + 1, + $this->y + 1, + $this->z + 1 - $inset + ); + }else{ + return new AxisAlignedBB( + $this->x + $inset, + $this->y, + $this->z, + $this->x + 1 - $inset, + $this->y + 1, + $this->z + 1 + ); + } + } + public function onActivate(Item $item, Player $player = null) : bool{ if($player instanceof Player){ $player->addWindow(new AnvilInventory($this));