mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/GabsPuNs-MinecraftConsoles.git
synced 2026-07-06 14:58:30 +00:00
More changes
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user