From a6c46d02708540788e569d73274290e58013d41c Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 4 Apr 2025 11:21:54 +0200 Subject: [PATCH] Use combinedIds to hide in TechHider.iBlockDataHidden --- .../src/de/steamwar/techhider/TechHider.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java index 03063eb8..3c9e3677 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java @@ -49,10 +49,9 @@ 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 getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block); - private static final Reflection.Method getMaterialByBlock = Reflection.getTypedMethod(craftMagicNumbers, "getMaterial", Material.class, block); + private static final Reflection.Method getCombinedIdByIBlockData = Reflection.getTypedMethod(block, null, int.class, iBlockData); public boolean iBlockDataHidden(Object iBlockData) { - return obfuscate.contains((Material) getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(iBlockData))); + return obfuscateIds.contains(getCombinedIdByIBlockData.invoke(null, iBlockData)); } public static final Object AIR = getBlockDataByBlock.invoke(getBlockByMaterial.invoke(null, Material.AIR)); @@ -66,15 +65,12 @@ public class TechHider { @Getter private final int obfuscationTargetId; @Getter - private final Set obfuscate; - @Getter private final Set obfuscateIds; @Getter private final Set hiddenBlockEntities; public TechHider(LocationEvaluator locationEvaluator, Material obfuscationTarget, Set obfuscate, Set hiddenBlockEntities) { this.locationEvaluator = locationEvaluator; - this.obfuscate = obfuscate; this.obfuscateIds = obfuscate.stream().flatMap(m -> BlockIds.impl.materialToAllIds(m).stream()).collect(Collectors.toSet()); this.hiddenBlockEntities = hiddenBlockEntities; this.obfuscationTarget = getBlockDataByBlock.invoke(getBlockByMaterial.invoke(null, obfuscationTarget));