From 384336f4169e33121e13f45df31f0fcbdcd2a1c8 Mon Sep 17 00:00:00 2001 From: Ruling-0 <47913168+Ruling-0@users.noreply.github.com> Date: Thu, 30 Jul 2026 21:57:52 -0500 Subject: [PATCH] Fix bartworks block detection against the unified material system --- src/main/java/forestry/core/utils/BlockUtil.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index 48e5be626..f4a7ad063 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -231,7 +231,6 @@ public abstract class BlockUtil { } private static Class BW_MetaGenerated_WerkstoffBlocksClass; - private static Block BWBlocks; private static Class GTBlockMachines_Class; private static Block GTBlockMachines; private static final boolean bw = Loader.isModLoaded("bartworks"); @@ -242,9 +241,7 @@ public abstract class BlockUtil { // noinspection unchecked BW_MetaGenerated_WerkstoffBlocksClass = (Class) Class .forName("bartworks.system.material.BWMetaGeneratedWerkstoffBlocks"); - BWBlocks = (Block) Class.forName("bartworks.system.material.WerkstoffLoader").getField("BWBlocks") - .get(null); - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); } if (gt) try { @@ -268,10 +265,10 @@ public abstract class BlockUtil { } while (stillInside.test(tile)); block = world.getBlock(x, y - depth, z); + // Werkstoff blocks hold their material in the tile entity, so the world metadata is not the item damage. if (bw && BW_MetaGenerated_WerkstoffBlocksClass != null - && BWBlocks != null && BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) { - return new ItemStack(BWBlocks, 1, block.getDamageValue(world, x, y - depth, z)); + return new ItemStack(block, 1, block.getDamageValue(world, x, y - depth, z)); } if (gt && GTBlockMachines_Class != null && GTBlockMachines != null && GTBlockMachines_Class.isInstance(block)) {