mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-04-25 08:27:28 +00:00
fix:Fix bounding box on painting
This commit is contained in:
parent
c3c9133251
commit
abba19c2e7
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue