From 2b0b0a81556ac90ce3b721b66fa54170c7ee5ddf Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 29 Dec 2013 22:58:37 +0100 Subject: [PATCH] [BLIND] Quick fix attempt for Acacia leaves (adding a new block-flag). --- .../nocheatplus/utilities/BlockProperties.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java index d9cbc2ae..611ba6b3 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/utilities/BlockProperties.java @@ -343,6 +343,9 @@ public class BlockProperties { /** ICE */ public static final long F_ICE = 0x20000; + /** LEAVES */ + public static final long F_LEAVES = 0x40000; + /** * Map flag to names. */ @@ -610,6 +613,7 @@ public class BlockProperties { Material.LEAVES, Material.BED_BLOCK}){ blocks[mat.getId()] = leafType; } + blockFlags[Material.LEAVES.getId()] |= F_LEAVES; // Huge mushroom type (...) for (Material mat : new Material[]{ Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2, @@ -969,7 +973,7 @@ public class BlockProperties { public static long getBreakingDuration(final int blockId, final BlockProps blockProps, final ToolProps toolProps, final boolean onGround, final boolean inWater, boolean aquaAffinity, int efficiency) { if (efficiency > 0){ // Workaround until something better is found.. - if (blockId == Material.LEAVES.getId() || blockProps == glassType){ + if (isLeaves(blockId) || blockProps == glassType){ /* * TODO: Some might be dealt with by insta break, by now, * still getting exact durations would be nice to have, for expected breaking times and @@ -1018,7 +1022,7 @@ public class BlockProperties { duration = 240; isValidTool = true; } - else if (blockId == Material.LEAVES.getId()){ + else if (isLeaves(blockId)){ duration = 20; isValidTool = true; } @@ -1269,6 +1273,10 @@ public class BlockProperties { return (blockFlags[id] & F_ICE) != 0; } + public static final boolean isLeaves(final int id) { + return (blockFlags[id] & F_LEAVES) != 0; + } + /** * Might hold true for liquids too. * @param id