From d3d71cbd373a3629a1df36b82fd3138cf4294b80 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:29:16 +0200 Subject: remove reflection from WerkstoffLoader --- .../bartworks/system/material/WerkstoffLoader.java | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'src/main') diff --git a/src/main/java/bartworks/system/material/WerkstoffLoader.java b/src/main/java/bartworks/system/material/WerkstoffLoader.java index a1b1aac2ed..fdfb4f8e9e 100644 --- a/src/main/java/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/bartworks/system/material/WerkstoffLoader.java @@ -2002,38 +2002,25 @@ public class WerkstoffLoader { } /** - * very hacky way to make my ores/blocks/smallores detectable by gt assosication in world, well at least the prefix. + * very hacky way to make my ores/blocks/small ores detectable by gt association in world, well at least the prefix. * used for the miners mostly removing this hacky material from the materials map instantly. we only need the item * data. */ - @SuppressWarnings("unchecked") private static void addFakeItemDataToInWorldBlocksAndCleanUpFakeData() { - - Map MATERIALS_MAP = null; - - try { - Field f = Materials.class.getDeclaredField("MATERIALS_MAP"); - f.setAccessible(true); - MATERIALS_MAP = (Map) f.get(null); - } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) { - e.printStackTrace(); - } - - if (MATERIALS_MAP == null) throw new NullPointerException("MATERIALS_MAP null!"); - Materials oreMat = new Materials(-1, null, 0, 0, 0, false, "bwores", "bwores", null, true, null); Materials smallOreMat = new Materials(-1, null, 0, 0, 0, false, "bwsmallores", "bwsmallores", null, true, null); Materials blockMat = new Materials(-1, null, 0, 0, 0, false, "bwblocks", "bwblocks", null, true, null); - for (int i = 0; i < 16; i++) { GTOreDictUnificator.addAssociation(ore, oreMat, new ItemStack(BWOres, 1, i), true); GTOreDictUnificator.addAssociation(oreSmall, smallOreMat, new ItemStack(BWSmallOres, 1, i), true); GTOreDictUnificator.addAssociation(block, blockMat, new ItemStack(BWBlocks, 1, i), true); } - - MATERIALS_MAP.remove("bwores"); - MATERIALS_MAP.remove("bwsmallores"); - MATERIALS_MAP.remove("bwblocks"); + Materials.getMaterialsMap() + .remove("bwores"); + Materials.getMaterialsMap() + .remove("bwsmallores"); + Materials.getMaterialsMap() + .remove("bwblocks"); } public static void removeIC2Recipes() { -- cgit