use of net.minecraft.block.AirBlock in project Hypnotic-Client by Hypnotic-Development.
the class PlayerUtils method getDistanceToGround.
public static float getDistanceToGround() {
if (mc.player.verticalCollision && mc.player.isOnGround()) {
return 0.0F;
}
ClientPlayerEntity e = mc.player;
for (float a = (float) e.getY(); a > 0.0F; a -= 1.0F) {
int[] stairs = { 53, 67, 108, 109, 114, 128, 134, 135, 136, 156, 163, 164, 180 };
int[] exemptIds = { 6, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 63, 65, 66, 68, 69, 70, 72, 75, 76, 77, 83, 92, 93, 94, 104, 105, 106, 115, 119, 131, 132, 143, 147, 148, 149, 150, 157, 171, 175, 176, 177 };
BlockState block = mc.world.getBlockState(new BlockPos(e.getX(), a - 1.0F, e.getZ()));
if (!(block.getBlock() instanceof AirBlock)) {
if ((Block.getRawIdFromState(block) == 44) || (Block.getRawIdFromState(block) == 126)) {
return (float) (e.getY() - a - 0.5D) < 0.0F ? 0.0F : (float) (e.getY() - a - 0.5D);
}
int[] arrayOfInt1;
int j = (arrayOfInt1 = stairs).length;
for (int i = 0; i < j; i++) {
int id = arrayOfInt1[i];
if (Block.getRawIdFromState(block) == id) {
return (float) (e.getY() - a - 1.0D) < 0.0F ? 0.0F : (float) (e.getY() - a - 1.0D);
}
}
j = (arrayOfInt1 = exemptIds).length;
for (int i = 0; i < j; i++) {
int id = arrayOfInt1[i];
if (Block.getRawIdFromState(block) == id) {
return (float) (e.getY() - a) < 0.0F ? 0.0F : (float) (e.getY() - a);
}
}
return (float) (e.getY() - a + block.getBlock().getMaxHorizontalModelOffset() - 1.0D);
}
}
return 0.0F;
}
Aggregations