diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java index ebf5e952..6e2c0397 100644 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java +++ b/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java @@ -66,8 +66,8 @@ public class BlockIds14 implements BlockIds { return getBlock.invoke(null, material); } - private static final Reflection.Method getCombinedId = Reflection.getTypedMethod(TechHider.block, null, int.class, TechHider.iBlockData); - private int getCombinedId(Object blockData) { + @Override + public int getCombinedId(Object blockData) { return (int) getCombinedId.invoke(null, blockData); } } diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java index 538e8dbd..64ac6c41 100644 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java +++ b/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java @@ -25,6 +25,12 @@ import java.util.Collections; import java.util.Set; public class BlockIds8 implements BlockIds { + @Override + public int getCombinedId(Object iBlockData) { + int id = (int) getCombinedId.invoke(null, iBlockData); // blockState << 12 | blockId + return (id & 4095) | (id >> 12); + } + @Override @SuppressWarnings("deprecation") public int materialToId(Material material) { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java index 8e129a1d..fa2f7f6e 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java @@ -19,6 +19,7 @@ package de.steamwar.techhider; +import de.steamwar.Reflection; import de.steamwar.core.Core; import de.steamwar.core.VersionDependent; import org.bukkit.Material; @@ -28,6 +29,9 @@ import java.util.Set; public interface BlockIds { BlockIds impl = VersionDependent.getVersionImpl(Core.getInstance()); + Reflection.Method getCombinedId = Reflection.getTypedMethod(TechHider.block, null, int.class, TechHider.iBlockData); + + int getCombinedId(Object iBlockData); int materialToId(Material material); Set materialToAllIds(Material material); } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java index 3c9e3677..021d2fe4 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java @@ -49,9 +49,8 @@ public class TechHider { public static final Class craftMagicNumbers = Reflection.getClass("org.bukkit.craftbukkit.util.CraftMagicNumbers"); private static final Reflection.Method getBlockByMaterial = Reflection.getTypedMethod(craftMagicNumbers, "getBlock", block, Material.class); - private static final Reflection.Method getCombinedIdByIBlockData = Reflection.getTypedMethod(block, null, int.class, iBlockData); public boolean iBlockDataHidden(Object iBlockData) { - return obfuscateIds.contains(getCombinedIdByIBlockData.invoke(null, iBlockData)); + return obfuscateIds.contains(BlockIds.impl.getCombinedId(iBlockData)); } public static final Object AIR = getBlockDataByBlock.invoke(getBlockByMaterial.invoke(null, Material.AIR));