From a2b1412ab1a6c82265ea083999b7deebbff74189 Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 13 Mar 2013 20:09:07 +0100 Subject: [PATCH] Switch 1.4.x snow level handling to an extra flag. --- .../utilities/BlockProperties.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java index 045e9342..b4687202 100644 --- a/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java +++ b/NCPCompat/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java @@ -296,6 +296,20 @@ public class BlockProperties { */ public static final long F_HEIGHT_8SIM_DEC = 0x2000; + /** + * The height is assumed to increase with data value up to 0x7, repeating up to 0x15.
+ * However the hit-box for collision checks will be set to 0.5 height or 1.0 height only,
+ * as with the 1.4.x snow levels. + */ + public static final long F_HEIGHT_8SIM_INC = 0x4000; + + + /** + * The height increases with data value (8 heights).
+ * This is for MC 1.5 snow levels. + */ + public static final long F_HEIGHT_8_INC = 0x8000; + /** * Map flag to names. */ @@ -440,6 +454,9 @@ public class BlockProperties { blockFlags[mat.getId()] |= F_LIQUID | F_HEIGHT_8SIM_DEC | F_LAVA; } + // Snow (1.4.x) + blockFlags[Material.SNOW.getId()] |= F_HEIGHT_8SIM_INC; + // 1.5 block high. for (final Material mat : new Material[]{ Material.FENCE, Material.FENCE_GATE, @@ -1406,7 +1423,7 @@ public class BlockProperties { */ public static double getGroundMinHeight(final BlockCache access, final int x, final int y, final int z, final int id, final double[] bounds, final long flags) { // TODO: Check which ones are really needed ! - if (id == Material.SNOW.getId()){ + if ((flags & F_HEIGHT_8SIM_INC) != 0){ final int data = (access.getData(x, y, z) & 0xF) % 8; if (data < 3) return 0; else return 0.5; @@ -1757,7 +1774,7 @@ public class BlockProperties { bmaxZ = bounds[5]; //block.A(); // maxZ } // y-bounds - if (id == Material.SNOW.getId()){ + if ((flags & F_HEIGHT_8SIM_INC) != 0){ // TODO: remove / solve differently ? bminY = 0; final int data = (access.getData(x, y, z) & 0xF) % 8;