This commit is contained in:
TheLordWolf-T-34-85 2026-04-22 06:00:45 +03:00 committed by GitHub
commit a2b77c6db9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,8 +59,16 @@ 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)
{
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;
@ -76,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;