From cab102757a4d476537119dd253499c8cfb125b8d Mon Sep 17 00:00:00 2001 From: TheLordWolf-T-34-85 <94191402+TheLordWolf@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:06:19 +0100 Subject: [PATCH 1/2] fix:Fix small gap between painting and block (issue #661) --- Minecraft.World/HangingEntity.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 26261710f5..2ba17b5e55 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -61,6 +61,11 @@ void HangingEntity::setDir(int dir) float fOffs = 0.5f + 1.0f / 16.0f; + if (this->GetType() == eTYPE_PAINTING) + { + fOffs = 0.5f + 1.0f / 32.0f; //dividing by 16.0f introduce a small gap between the block and the painting. See https://github.com/smartcmd/MinecraftConsoles/issues/661 + } + if (dir == Direction::NORTH) z -= fOffs; if (dir == Direction::WEST) x -= fOffs; if (dir == Direction::SOUTH) z += fOffs; From abba19c2e7270ce9a96d9449a6d7bb1f158e9f4e Mon Sep 17 00:00:00 2001 From: TheLordWolf-T-34-85 <94191402+TheLordWolf@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:21:22 +0100 Subject: [PATCH 2/2] fix:Fix bounding box on painting --- Minecraft.World/HangingEntity.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 5832797e59..28b2b83056 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -59,6 +59,9 @@ void HangingEntity::setDir(int dir) float y = yTile + 0.5f; float z = zTile + 0.5f; + float originalX = x; + float originalZ = z; + float fOffs = 0.5f + 1.0f / 16.0f; if (this->GetType() == eTYPE_PAINTING) @@ -81,6 +84,26 @@ void HangingEntity::setDir(int dir) float ss = -(0.5f / 16.0f); + //dividing the fOffs by 32 breaks the BB and allow paintings to be placed on a block when they shouldn't + //so we need to modify the x and z to set their value as if the fOffs was divided by 16 and not 32 + if (this->GetType() == eTYPE_PAINTING) + { + fOffs = 0.5f + 1.0f / 16.0f; + if (dir == Direction::NORTH) originalZ -= fOffs; + if (dir == Direction::WEST) originalX -= fOffs; + if (dir == Direction::SOUTH) originalZ += fOffs; + if (dir == Direction::EAST) originalX += fOffs; + + if (dir == Direction::NORTH) originalX -= offs(getWidth()); + if (dir == Direction::WEST) originalZ += offs(getWidth()); + if (dir == Direction::SOUTH) originalX += offs(getWidth()); + if (dir == Direction::EAST) originalZ -= offs(getWidth()); + + x = originalX; + z = originalZ; + } + + // 4J Stu - Due to rotations the bb couold be set with a lower bound x/z being higher than the higher bound float x0 = x - w - ss; float x1 = x + w + ss;