aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/items
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/items')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java
index 8add5d5a6e..bc11cb6a11 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java
@@ -1,10 +1,14 @@
package gtPlusPlus.xmod.gregtech.common.items;
+import java.lang.reflect.Field;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.TC_Aspects;
import gregtech.api.enums.ToolDictNames;
import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.common.tools.GT_Tool_WireCutter;
+import gregtech.api.objects.GT_HashSet;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames;
import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder;
import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher;
@@ -20,10 +24,18 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool {
public static final short ANGLE_GRINDER = 7834;
public static final short ELECTRIC_SNIPS = 7934;
public static GT_MetaGenerated_Tool INSTANCE;
+
+ static {
+ INSTANCE = new MetaGeneratedGregtechTools();
+ }
+
+ public static GT_MetaGenerated_Tool getInstance() {
+ return INSTANCE;
+ }
+
- public MetaGeneratedGregtechTools() {
+ private MetaGeneratedGregtechTools() {
super("plusplus.metatool.01");
- INSTANCE = this;
// Skookum Choocher
GregTech_API.registerTool(this.addTool(SKOOKUM_CHOOCHER, "Skookum Choocher",
"Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(),
@@ -41,6 +53,23 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool {
new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L),
new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) });
+ GT_HashSet<GT_ItemStack> aWireCutterList = new GT_HashSet<GT_ItemStack>();
+ //Does not exist prior to 5.09.32, use an empty field if we can't find the existing one.
+ if (ReflectionUtils.doesFieldExist(GregTech_API.class, "sWireCutterList")) {
+ Field sWireCutterList = ReflectionUtils.getField(GregTech_API.class, "sWireCutterList");
+ try {
+ if (sWireCutterList != null) {
+ Object val = sWireCutterList.get(null);
+ if (val != null && val instanceof GT_HashSet) {
+ aWireCutterList = (GT_HashSet<GT_ItemStack>) val;
+ }
+ }
+
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {
+ // Not found, so it's GT 5.09.31 or earlier.
+ }
+ }
// Electric Wire Cutter
GregTech_API.registerTool(
@@ -49,7 +78,7 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool {
new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter,
new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 4L),
new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 4L),
- new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 4L) }), GregTech_API.sWireCutterList);
+ new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 4L) }), aWireCutterList);
// Electric Lighter