From c9da91378d4e308029cff6dfe49812020d8c0b70 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 6 Apr 2024 18:03:34 +0300 Subject: [PATCH] fixed entity collisions with chests --- src/material/StaticBlock.php | 1 + src/material/block/nonfull/ChestBlock.php | 4 ++++ src/network/protocol/packet/AnimatePacket.php | 6 ++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/material/StaticBlock.php b/src/material/StaticBlock.php index 669050ec..76842175 100644 --- a/src/material/StaticBlock.php +++ b/src/material/StaticBlock.php @@ -48,6 +48,7 @@ class StaticBlock self::setBlockBounds(BED_BLOCK, 0, 0, 0, 1, 0.5625, 1); //Cake: has bounds based on world state //Chest: has bounds based on world state + self::setBlockBounds(CHEST, 0.025, 0, 0.025, 0.975, 0.95, 0.975); self::setBlockBounds(WHEAT_BLOCK, 0, 0, 0, 1, 0.25, 1); self::setBlockBounds(CARROT_BLOCK, 0, 0, 0, 1, 0.25, 1); self::setBlockBounds(POTATO_BLOCK,0, 0, 0, 1, 0.25, 1); diff --git a/src/material/block/nonfull/ChestBlock.php b/src/material/block/nonfull/ChestBlock.php index 9da2f542..66c993f0 100644 --- a/src/material/block/nonfull/ChestBlock.php +++ b/src/material/block/nonfull/ChestBlock.php @@ -7,6 +7,10 @@ class ChestBlock extends TransparentBlock{ $this->isFullBlock = false; $this->hardness = 15; } + public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ + return [new AxisAlignedBB($x + 0.025, $y, $z + 0.025, $x + 0.975, $y + 0.95, $z + 0.975)]; + } + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $server = ServerAPI::request(); $faces = array( diff --git a/src/network/protocol/packet/AnimatePacket.php b/src/network/protocol/packet/AnimatePacket.php index 6a33b5e5..a8ea6820 100644 --- a/src/network/protocol/packet/AnimatePacket.php +++ b/src/network/protocol/packet/AnimatePacket.php @@ -1,10 +1,8 @@