More changes

This commit is contained in:
GabsPuNs
2026-04-11 09:50:37 -04:00
parent 1bc99a027d
commit 720efd2f2e
3 changed files with 57 additions and 19 deletions

View File

@@ -415,22 +415,19 @@ bool PistonBaseTile::isExtended(int data)
int PistonBaseTile::getNewFacing(Level *level, int x, int y, int z, shared_ptr<LivingEntity> player)
{
if (Mth::abs(static_cast<float>(player->x) - x) < 2 && Mth::abs(static_cast<float>(player->z) - z) < 2)
if (Mth::abs(static_cast<float>(player->x) - (x + 0.5f)) < 2.5f && Mth::abs(static_cast<float>(player->z) - (z + 0.5f)) < 2.5f)
{
// If the player is above the block, the slot is on the top
double py = player->y + 1.82 - player->heightOffset;
if (py - y > 2)
{
if (py - (double)y > 2.0)
return Facing::UP;
}
// If the player is below the block, the slot is on the bottom
if (y - py > 0)
{
if (y - (double)py > 0.0)
return Facing::DOWN;
}
}
// The slot is on the side
int i = Mth::floor(player->yRot * 4.0f / 360.0f + 0.5) & 0x3;
int i = Mth::floor(player->yRot * 4.0f / 360.0f + 0.5f) & 0x3;
if (i == 0) return Facing::NORTH;
if (i == 1) return Facing::EAST;
if (i == 2) return Facing::SOUTH;