aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java169
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java59
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java17
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java40
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java43
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java13
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/HandlerTinkers.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java19
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java91
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java356
11 files changed, 137 insertions, 684 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java b/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
index b1e97782af..272b2dacf5 100644
--- a/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
+++ b/src/main/java/gtPlusPlus/xmod/bop/BiomesOPlentyHandler.java
@@ -1,178 +1,27 @@
package gtPlusPlus.xmod.bop;
-import static gregtech.api.enums.Mods.BiomesOPlenty;
-
-import java.lang.reflect.Field;
-
-import net.minecraft.block.Block;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import biomesoplenty.api.content.BOPCItems;
+import gregtech.api.enums.Mods;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.bop.blocks.BOPBlockRegistrator;
public class BiomesOPlentyHandler {
- public static Item mPineCone;
-
- public static Block logs1;
- public static Block logs2;
- public static Block logs3;
- public static Block logs4;
-
- public static Block leaves1;
- public static Block leaves2;
- public static Block leaves3;
- public static Block leaves4;
-
- public static Block colorizedLeaves1;
- public static Block colorizedLeaves2;
-
- public static Block saplings;
- public static Block colorizedSaplings;
-
public static void preInit() {
BOPBlockRegistrator.run();
- if (BiomesOPlenty.isModLoaded()) {
- setFields();
- registerPineconeToOreDict();
+ if (Mods.BiomesOPlenty.isModLoaded()) {
+ if (BOPCItems.misc != null) {
+ ItemStack aPinecone = ItemUtils.simpleMetaStack(BOPCItems.misc, 13, 1);
+ if (aPinecone != null) {
+ ItemUtils.addItemToOreDictionary(aPinecone, "pinecone");
+ }
+ }
}
}
public static void postInit() {
BOPBlockRegistrator.recipes();
}
-
- private static void registerPineconeToOreDict() {
- if (mPineCone != null) {
- ItemStack aPinecone = ItemUtils.simpleMetaStack(mPineCone, 13, 1);
- if (aPinecone != null) {
- ItemUtils.addItemToOreDictionary(aPinecone, "pinecone");
- }
- }
- }
-
- public static ItemStack getStack(Block aBlock, int aMeta, int aSize) {
- return ItemUtils.simpleMetaStack(aBlock, aMeta, aSize);
- }
-
- // BOPCBlocks.logs4 - 0
- // BOPCBlocks.colorizedLeaves2 - 1
-
- private static void setFields() {
- Field aBopMiscItem = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCItems"), "misc");
-
- Field aBopBlock1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs1");
- Field aBopBlock2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs2");
- Field aBopBlock3 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs3");
- Field aBopBlock4 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs4");
-
- Field aBopLeaves1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves1");
- Field aBopLeaves2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves2");
- Field aBopLeaves3 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves3");
- Field aBopLeaves4 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves4");
-
- Field aBopColouredLeaves1 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves1");
- Field aBopColouredLeaves2 = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves2");
-
- Field aBopSapling = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "saplings");
- Field aBopColouredSapling = ReflectionUtils
- .getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings");
-
- if (aBopMiscItem != null) {
- Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem);
- if (aMiscItem != null) {
- mPineCone = aMiscItem;
- }
- }
-
- if (aBopBlock1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1);
- if (aBlock != null) {
- logs1 = aBlock;
- }
- }
- if (aBopBlock2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2);
- if (aBlock != null) {
- logs2 = aBlock;
- }
- }
- if (aBopBlock3 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3);
- if (aBlock != null) {
- logs3 = aBlock;
- }
- }
- if (aBopBlock4 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4);
- if (aBlock != null) {
- logs4 = aBlock;
- }
- }
-
- if (aBopLeaves1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1);
- if (aBlock != null) {
- leaves1 = aBlock;
- }
- }
- if (aBopLeaves2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2);
- if (aBlock != null) {
- leaves2 = aBlock;
- }
- }
- if (aBopLeaves3 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3);
- if (aBlock != null) {
- leaves3 = aBlock;
- }
- }
- if (aBopLeaves4 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4);
- if (aBlock != null) {
- leaves4 = aBlock;
- }
- }
-
- if (aBopColouredLeaves1 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1);
- if (aBlock != null) {
- colorizedLeaves1 = aBlock;
- }
- }
- if (aBopColouredLeaves2 != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2);
- if (aBlock != null) {
- colorizedLeaves2 = aBlock;
- }
- }
-
- if (aBopSapling != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopSapling);
- if (aBlock != null) {
- saplings = aBlock;
- }
- }
- if (aBopColouredSapling != null) {
- Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling);
- if (aBlock != null) {
- colorizedSaplings = aBlock;
- }
- }
- }
}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java
index 11397e3ef3..95813e45bd 100644
--- a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java
@@ -8,7 +8,6 @@ import static forestry.api.apiculture.EnumBeeChromosome.TEMPERATURE_TOLERANCE;
import static forestry.api.core.EnumHumidity.ARID;
import static gregtech.api.enums.Mods.Forestry;
-import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Locale;
import java.util.function.Consumer;
@@ -47,7 +46,6 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialsElements.STANDALONE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.forestry.bees.handler.GTPPCombType;
public enum GTPP_BeeDefinition implements IBeeDefinition {
@@ -65,7 +63,11 @@ public enum GTPP_BeeDefinition implements IBeeDefinition {
AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_3);
AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_3);
}, dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation("DRAGONESSENCE", "NEUTRONIUM", 2);
+ IBeeMutationCustom tMutation = dis.registerMutation(
+ GTBeeDefinition.DRAGONESSENCE.getSpecies(),
+ GTBeeDefinition.NEUTRONIUM.getSpecies(),
+ 2,
+ 1f);
tMutation.restrictHumidity(ARID);
tMutation.requireResource(STANDALONE.DRAGON_METAL.getBlock(), 1);
tMutation.addMutationCondition(new GTBees.DimensionMutationCondition(1, "End")); // End Dim
@@ -84,7 +86,8 @@ public enum GTPP_BeeDefinition implements IBeeDefinition {
AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_1);
AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_1);
}, dis -> {
- IBeeMutationCustom tMutation = dis.registerMutation("STEEL", "GOLD", 10);
+ IBeeMutationCustom tMutation = dis
+ .registerMutation(GTBeeDefinition.STEEL.getSpecies(), GTBeeDefinition.GOLD.getSpecies(), 10, 1f);
tMutation.restrictHumidity(ARID);
tMutation.restrictBiomeType(BiomeDictionary.Type.HOT);
}),;
@@ -185,15 +188,15 @@ public enum GTPP_BeeDefinition implements IBeeDefinition {
return ret;
}
- private final void setSpeciesProperties(GTPPAlleleBeeSpecies species2) {
+ private void setSpeciesProperties(GTPPAlleleBeeSpecies species2) {
this.mSpeciesProperties.accept(species2);
}
- private final void setAlleles(IAllele[] template) {
+ private void setAlleles(IAllele[] template) {
this.mAlleles.accept(template);
}
- private final void registerMutations() {
+ private void registerMutations() {
this.mMutations.accept(this);
}
@@ -209,59 +212,47 @@ public enum GTPP_BeeDefinition implements IBeeDefinition {
BeeManager.beeRoot.registerTemplate(template);
}
- private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2,
- int chance) {
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2,
- int chance) {
+ private IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2,
- int chance) {
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2,
- int chance) {
+ private IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance) {
return registerMutation(parent1, parent2, chance, 1f);
}
- private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) {
- return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, 1f);
- }
-
/**
* Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die Mutationsrate als Bruch mit chance /
* chancedivider This new function allows Mutation percentages under 1%. Set them as a fraction with chance /
* chancedivider
*/
- private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance,
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance,
float chancedivider) {
return new GTPPBeeMutation(parent1, parent2, this.getTemplate(), chance, chancedivider);
}
- private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance,
+ private IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance,
float chancedivider) {
return registerMutation(parent1.species, parent2, chance, chancedivider);
}
- private final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance,
+ private IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance,
float chancedivider) {
return registerMutation(parent1, parent2.species, chance, chancedivider);
}
- private final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2,
- int chance, float chancedivider) {
+ private IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance,
+ float chancedivider) {
return registerMutation(parent1.species, parent2, chance, chancedivider);
}
- private final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, float chancedivider) {
- return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, chancedivider);
- }
-
@Override
public final IAllele[] getTemplate() {
return Arrays.copyOf(template, template.length);
@@ -285,16 +276,4 @@ public enum GTPP_BeeDefinition implements IBeeDefinition {
public final IBeeDefinition getRainResist() {
return new BeeVariation.RainResist(this);
}
-
- public static IAlleleBeeSpecies getGregtechBeeType(String name) {
- try {
- // This is still cursed, but the species field is private and I don't want to go modify that right now
- GTBeeDefinition aBeeObject = GTBeeDefinition.valueOf(name);
- Field gtBeesField = ReflectionUtils.getField(GTBeeDefinition.class, "species");
- return ReflectionUtils.getFieldValue(gtBeesField, aBeeObject);
- } catch (Throwable t) {
- t.printStackTrace();
- return null;
- }
- }
}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
index bfdddcca8b..7ba5bc326a 100644
--- a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
@@ -7,7 +7,6 @@ import java.util.HashMap;
import gregtech.GTMod;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.forestry.bees.handler.GTPPCombType;
import gtPlusPlus.xmod.forestry.bees.handler.GTPPDropType;
import gtPlusPlus.xmod.forestry.bees.handler.GTPPPollenType;
@@ -45,7 +44,12 @@ public class GTPP_Bees {
combs = new GTPPComb();
Logger.BEES("Loading types.");
- initTypes();
+ // call values() to force initialization of enum entries
+ GTPP_BeeDefinition.values();
+ GTPPCombType.values();
+ GTPPDropType.values();
+ GTPPPollenType.values();
+ GTPPPropolisType.values();
Logger.BEES("Adding recipes.");
GTPPDrop.initDropsRecipes();
@@ -58,13 +62,4 @@ public class GTPP_Bees {
Logger.BEES("Done!");
}
}
-
- private static void initTypes() {
- // This is stupid
- ReflectionUtils.loadClass(GTPP_BeeDefinition.class.getName());
- ReflectionUtils.loadClass(GTPPCombType.class.getName());
- ReflectionUtils.loadClass(GTPPDropType.class.getName());
- ReflectionUtils.loadClass(GTPPPollenType.class.getName());
- ReflectionUtils.loadClass(GTPPPropolisType.class.getName());
- }
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java
index 43e43a1d4e..90db739be7 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchNaquadah.java
@@ -120,30 +120,26 @@ public class MTEHatchNaquadah extends MTEHatchInput {
private static String[] aDescCache = new String[3];
- private String formatFluidString(FluidStack f) {
- FluidStack mLockedStack = f;
- Integer mLockedTemp = 0;;
- String mTempMod = "" + EnumChatFormatting.RESET;
- mLockedTemp = mLockedStack.getFluid()
+ private String formatFluidString(FluidStack fluidStack) {
+ String mTempMod = EnumChatFormatting.RESET.toString();
+ int mLockedTemp = fluidStack.getFluid()
.getTemperature();
- if (mLockedTemp != null) {
- if (mLockedTemp <= -3000) {
- mTempMod = "" + EnumChatFormatting.DARK_PURPLE;
- } else if (mLockedTemp >= -2999 && mLockedTemp <= -500) {
- mTempMod = "" + EnumChatFormatting.DARK_BLUE;
- } else if (mLockedTemp >= -499 && mLockedTemp <= -50) {
- mTempMod = "" + EnumChatFormatting.BLUE;
- } else if (mLockedTemp >= 30 && mLockedTemp <= 300) {
- mTempMod = "" + EnumChatFormatting.AQUA;
- } else if (mLockedTemp >= 301 && mLockedTemp <= 800) {
- mTempMod = "" + EnumChatFormatting.YELLOW;
- } else if (mLockedTemp >= 801 && mLockedTemp <= 1500) {
- mTempMod = "" + EnumChatFormatting.GOLD;
- } else if (mLockedTemp >= 1501) {
- mTempMod = "" + EnumChatFormatting.RED;
- }
+ if (mLockedTemp <= -3000) {
+ mTempMod = "" + EnumChatFormatting.DARK_PURPLE;
+ } else if (mLockedTemp <= -500) {
+ mTempMod = "" + EnumChatFormatting.DARK_BLUE;
+ } else if (mLockedTemp <= -50) {
+ mTempMod = "" + EnumChatFormatting.BLUE;
+ } else if (mLockedTemp >= 30 && mLockedTemp <= 300) {
+ mTempMod = "" + EnumChatFormatting.AQUA;
+ } else if (mLockedTemp >= 301 && mLockedTemp <= 800) {
+ mTempMod = "" + EnumChatFormatting.YELLOW;
+ } else if (mLockedTemp >= 801 && mLockedTemp <= 1500) {
+ mTempMod = "" + EnumChatFormatting.GOLD;
+ } else if (mLockedTemp >= 1501) {
+ mTempMod = "" + EnumChatFormatting.RED;
}
- return mTempMod + mLockedStack.getLocalizedName();
+ return mTempMod + fluidStack.getLocalizedName();
}
@Override
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
index 738afb0d90..b1af2451aa 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
@@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
import static gregtech.api.util.GTUtility.filterValidMTEs;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -208,7 +207,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
+ ": "
+ EnumChatFormatting.YELLOW
+ GTValues.VN[GTUtility.getTier(getMaxInputVoltage())]
- + EnumChatFormatting.RESET));;
+ + EnumChatFormatting.RESET));
}
if (!this.mAllDynamoHatches.isEmpty()) {
long storedEnergy = getStoredEnergyInAllDynamoHatches();
@@ -843,43 +842,11 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
* Enable Texture Casing Support if found in GT 5.09
*/
public boolean updateTexture(final IMetaTileEntity aTileEntity, int aCasingID) {
- try { // gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int)
-
- final IMetaTileEntity aMetaTileEntity = aTileEntity;
- if (aMetaTileEntity == null) {
- return false;
- }
- Method mProper = ReflectionUtils.getMethod(MTEHatch.class, "updateTexture", int.class);
- if (mProper != null) {
- if (MTEHatch.class.isInstance(aMetaTileEntity)) {
- mProper.setAccessible(true);
- mProper.invoke(aMetaTileEntity, aCasingID);
- // log("Good Method Call for updateTexture.");
- return true;
- }
- } else {
- log("Bad Method Call for updateTexture.");
- if (MTEHatch.class.isInstance(aMetaTileEntity)) {
- if (aCasingID <= Byte.MAX_VALUE) {
- ((MTEHatch) aTileEntity).updateTexture(aCasingID);
- log(
- "Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128.");
- return true;
- } else {
- log("updateTexture returning false. 1.2");
- }
- } else {
- log("updateTexture returning false. 1.3");
- }
- }
- log("updateTexture returning false. 1");
- return false;
- } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- log("updateTexture returning false.");
- log("updateTexture returning false. 2");
- e.printStackTrace();
- return false;
+ if (aTileEntity instanceof MTEHatch mteHatch) {
+ mteHatch.updateTexture(aCasingID);
+ return true;
}
+ return false;
}
/**
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java
index c9f627c0d5..a334fd7de4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenFluidCanning.java
@@ -13,7 +13,6 @@ import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.GTPPCore;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
public class RecipeGenFluidCanning implements Runnable {
@@ -206,13 +205,7 @@ public class RecipeGenFluidCanning implements Runnable {
}
private void dumpStack() {
- int parents = 2;
- for (int i = 0; i < 6; i++) {
- Logger.INFO(
- (disableOptional ? "EXTRACTING" : "CANNING") + " DEBUG | "
- + (i == 0 ? "Called from: " : "Parent: ")
- + ReflectionUtils.getMethodName(i + parents));
- }
+ Logger.modLogger.info((disableOptional ? "EXTRACTING" : "CANNING") + " DEBUG ", new Exception());
}
private int getMapSize(RecipeMap<?> aMap) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java
index 8fe051dd71..305422ccea 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenRecycling.java
@@ -28,7 +28,6 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
public class RecipeGenRecycling implements Runnable {
@@ -252,11 +251,7 @@ public class RecipeGenRecycling implements Runnable {
public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount,
final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) {
if (aNoInvalidAmounts && (aAmount < 1L)) {
- Logger.WARNING("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(1));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(2));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(3));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(4));
+ Logger.modLogger.warn("Returning Null. Method: ", new Exception());
return null;
}
if (!mNameMap.containsKey(aName.toString()) && aMentionPossibleTypos) {
@@ -269,11 +264,7 @@ public class RecipeGenRecycling implements Runnable {
public static ItemStack getFirstOre(final Object aName, final long aAmount) {
if (GTUtility.isStringInvalid(aName)) {
- Logger.WARNING("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(1));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(2));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(3));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(4));
+ Logger.modLogger.warn("Returning Null. Method: ", new Exception());
return null;
}
final ItemStack tStack = mNameMap.get(aName.toString());
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/HandlerTinkers.java b/src/main/java/gtPlusPlus/xmod/tinkers/HandlerTinkers.java
index 5dbde33493..faa94542b9 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/HandlerTinkers.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/HandlerTinkers.java
@@ -1,10 +1,9 @@
package gtPlusPlus.xmod.tinkers;
-import static gregtech.api.enums.Mods.TinkerConstruct;
-
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
+import gregtech.api.enums.Mods;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial;
import gtPlusPlus.xmod.tinkers.util.TinkersDryingRecipe;
@@ -15,7 +14,7 @@ public class HandlerTinkers {
public static AutoMap<BaseTinkersMaterial> mTinkerMaterials = new AutoMap<>();
public static void postInit() {
- if (TinkerConstruct.isModLoaded()) {
+ if (Mods.TinkerConstruct.isModLoaded()) {
Fluid pyrotheumFluid = FluidRegistry.getFluid("pyrotheum");
if (pyrotheumFluid != null) {
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java b/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
index 5a4984a898..68685b7b8b 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
@@ -165,20 +165,12 @@ public class BaseTinkersMaterial {
private boolean generateRecipes(Material aMaterial, int aID) {
- Block aMatBlock;
- Integer aMelt;
- Fluid aFluid;
-
- try {
- aMatBlock = aMaterial.getBlock();
- aMelt = aMaterial.getMeltingPointC();
- aFluid = aMaterial.getFluidStack(0)
- .getFluid();
- } catch (Throwable t) {
- return false;
- }
+ Block aMatBlock = aMaterial.getBlock();
+ int aMelt = aMaterial.getMeltingPointC();
+ Fluid aFluid = aMaterial.getFluidStack(0)
+ .getFluid();
- if (aMatBlock == null || aMelt == null || aFluid == null) {
+ if (aMatBlock == null || aFluid == null) {
return false;
}
@@ -192,7 +184,6 @@ public class BaseTinkersMaterial {
TinkersUtils
.addCastingTableRecipe(aMaterial.getIngot(1), aMaterial.getFluidStack(144), ingotcast, false, 50);
}
-
TinkersUtils.generateCastingRecipes(aMaterial, aID);
return true;
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
index 4adac363e8..4136b54309 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
@@ -1,9 +1,7 @@
package gtPlusPlus.xmod.tinkers.util;
-import static gregtech.api.enums.Mods.TinkerConstruct;
import static gtPlusPlus.api.recipe.GTPPRecipeMaps.chemicalDehydratorRecipes;
-import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -14,7 +12,7 @@ import gregtech.api.enums.TierEU;
import gregtech.api.util.GTUtility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import tconstruct.library.crafting.DryingRackRecipes;
public class TinkersDryingRecipe {
@@ -24,20 +22,25 @@ public class TinkersDryingRecipe {
public final ItemStack input;
public final ItemStack result;
+ public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) {
+ this.time = time;
+ this.input = input;
+ this.result = result;
+ Logger.INFO(
+ "Generating Drying Recipe. Input: " + input.getDisplayName() + ", Output: " + result.getDisplayName());
+ }
+
public static void generateAllDryingRecipes() {
- List<?> aRecipes = TinkersUtils.getDryingRecipes();
- if (aRecipes != null && aRecipes.size() > 0) {
- for (Object o : aRecipes) {
+ List<DryingRackRecipes.DryingRecipe> aRecipes = TinkersDryingRecipe.getDryingRecipes();
+ if (!aRecipes.isEmpty()) {
+ for (DryingRackRecipes.DryingRecipe recipe : aRecipes) {
Logger.INFO(
- "Trying to generate recipe using object of type " + o.getClass()
+ "Trying to generate recipe using object of type " + recipe.getClass()
.getSimpleName());
- generateFromTinkersRecipeObject(o);
+ generateFromTinkersRecipe(recipe);
}
} else {
- Logger.INFO(
- "Error generating Drying recipes, map was either null or empty. Null? " + (aRecipes != null)
- + ", Size: "
- + aRecipes.size());
+ Logger.INFO("Error generating Drying recipes, map was empty. Size: " + aRecipes.size());
}
if (!recipes.isEmpty()) {
Logger.INFO("Adding " + recipes.size() + " drying rack recipes to the dehydrator.");
@@ -52,61 +55,19 @@ public class TinkersDryingRecipe {
}
}
- public static TinkersDryingRecipe generateFromTinkersRecipeObject(Object o) {
- Field aTime;
- Field aInput;
- Field aOutput;
- Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"); // o.getClass();
- if (aTinkerClass == null || TinkerConstruct.isModLoaded()) {
- Logger.INFO(
- "Error generating Drying Recipe, could not find class. Exists? "
- + ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"));
- Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes");
- Class[] y = clazz.getDeclaredClasses();
- if (y == null || y.length <= 0) {
- Logger.INFO("No hidden inner classes.");
- return null;
- } else {
- boolean found = false;
- for (Class h : y) {
- Logger.INFO("Found hidden inner class: " + h.getCanonicalName());
- if (h.getSimpleName()
- .toLowerCase()
- .equals("dryingrecipe")) {
- Logger.INFO("Found correct recipe. Caching at correct location.");
- ReflectionUtils.mCachedClasses
- .put("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h);
- aTinkerClass = h;
- found = true;
- break;
- }
- }
- if (!found) {
- return null;
- }
- }
- }
- aTime = ReflectionUtils.getField(aTinkerClass, "time");
- aInput = ReflectionUtils.getField(aTinkerClass, "input");
- aOutput = ReflectionUtils.getField(aTinkerClass, "result");
- try {
- int time_internal = aTime.getInt(o);
- ItemStack input_internal = (ItemStack) aInput.get(o);
- ItemStack result_internal = (ItemStack) aOutput.get(o);
- return new TinkersDryingRecipe(input_internal, time_internal, result_internal);
- } catch (Throwable b) {
- b.printStackTrace();
- }
- return null;
+ private static void generateFromTinkersRecipe(DryingRackRecipes.DryingRecipe recipe) {
+ recipes.add(new TinkersDryingRecipe(recipe.input, recipe.time, recipe.result));
}
- public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) {
- this.time = time;
- this.input = input;
- this.result = result;
- Logger.INFO(
- "Generating Drying Recipe. Input: " + input.getDisplayName() + ", Output: " + result.getDisplayName());
- recipes.add(this);
+ private static List<DryingRackRecipes.DryingRecipe> getDryingRecipes() {
+ AutoMap<DryingRackRecipes.DryingRecipe> aData = new AutoMap<>();
+ int aCount = 0;
+ for (DryingRackRecipes.DryingRecipe re