Fix fly false-positive while crouching on stairs. Addresses issue #58

This commit is contained in:
h31ix committed 2012-10-08 17:46:26 -04:00
1 parent 8f47edd61e
commit 0ca74f2c18
2 files changed
+11 -1

No files matched your search

@@ -604,13 +604,17 @@ public class Backend
}
else if(y1 == y2 || y1 < y2)
{
//Check if the player is crouching on slabs
//Check if the player is crouching on slabs or stairs
if(player.isSneaking())
{
if(block.getRelative(BlockFace.NORTH).getTypeId() == 43 || block.getRelative(BlockFace.NORTH).getTypeId() == 44 || block.getRelative(BlockFace.SOUTH).getTypeId() == 43 || block.getRelative(BlockFace.SOUTH).getTypeId() == 44 || block.getRelative(BlockFace.EAST).getTypeId() == 43 || block.getRelative(BlockFace.EAST).getTypeId() == 44 || block.getRelative(BlockFace.WEST).getTypeId() == 43 || block.getRelative(BlockFace.WEST).getTypeId() == 44)
{
return false;
}
if(Utilities.isStair(block.getRelative(BlockFace.NORTH)) || Utilities.isStair(block.getRelative(BlockFace.SOUTH)) || Utilities.isStair(block.getRelative(BlockFace.EAST)) || Utilities.isStair(block.getRelative(BlockFace.WEST)))
{
return false;
}
}
int violation = flightViolation.containsKey(name) ? flightViolation.get(name)+1 : 1;
increment(player, flightViolation, violation);
@@ -91,6 +91,12 @@ public final class Utilities
return FOOD.contains(m);
}
public static boolean isStair(Block block)
{
int id = block.getTypeId();
return id == 53 || id == 67 || id == 108 || id == 109 || id == 114 || id == 128 || id == 134 || id == 135 || id == 136;
}
public static boolean isInteractable(Material m)
{
return INTERACTABLE.contains(m);