diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-11 18:14:07 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-11 18:14:07 +0100 |
commit | 4a2fa070a2ae91173cf15785c63b4090016323d4 (patch) | |
tree | 7a07b317b7b66778869f321da82f95dfee70107f /src/Java/gtPlusPlus/xmod | |
parent | 8ca23d37495647bda859bc1821c2551cf8b21bf3 (diff) | |
download | GT5-Unofficial-4a2fa070a2ae91173cf15785c63b4090016323d4.tar.gz GT5-Unofficial-4a2fa070a2ae91173cf15785c63b4090016323d4.tar.bz2 GT5-Unofficial-4a2fa070a2ae91173cf15785c63b4090016323d4.zip |
$ Fixed many tiny bugs, found by static code analysis.
$ Fixed Canning handling further.
$ Adjusted the Charcoal Pit fix.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
27 files changed, 204 insertions, 157 deletions
diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java index fd83cc707d..7d45899911 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java @@ -111,7 +111,6 @@ public class GTPP_Bees { input, null, output, - 0, 30, 8); } diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java index 64f1cfbe23..3b59b58cab 100644 --- a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java +++ b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java @@ -21,6 +21,10 @@ public class HandlerTooltip_GC { private static Class<?> oMainClass; private static Class<?> oFuelLoaderClass; private static HashMap <Integer, String> mFuelNames; + + static { + mFuelNames = new LinkedHashMap<Integer, String>(); + } @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { @@ -38,7 +42,7 @@ public class HandlerTooltip_GC { oFuelLoaderClass = GCFuelLoader; } - Field aField = ReflectionUtils.getField(GCBlocks, "fuelLoader"); + Field aField = ReflectionUtils.getField(oMainClass, "fuelLoader"); if (aField != null) { Block aBlock = (Block) aField.get(null); if (aBlock != null) { @@ -49,10 +53,12 @@ public class HandlerTooltip_GC { } } catch (Throwable t) { } - } + } + if (mFuelNames == null) { + mFuelNames = new LinkedHashMap<Integer, String>(); + } - if (mFuelNames == null || mFuelNames.isEmpty()) { - mFuelNames = new LinkedHashMap<Integer, String>(); + if (mFuelNames.isEmpty()) { for (int aMapKey : RocketFuels.mValidRocketFuels.keySet()) { Fluid aFuel = RocketFuels.mValidRocketFuels.get(aMapKey); if (aFuel != null) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 0143c9096f..f85d432b0c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -59,6 +59,7 @@ public class HANDLER_GT { public static final List<WorldGen_GT> sWorldgenListEverglades = new ArrayList<WorldGen_GT>(); public static final List<WorldGen_GT_Australia> sWorldgenListAustralia = new ArrayList<WorldGen_GT_Australia>(); public static final List<GTPP_Worldgen> sCustomWorldgenList = new ArrayList<GTPP_Worldgen>(); + public static GT_MetaGenerated_Tool sMetaGeneratedToolInstance; public static void preInit(){ @@ -88,7 +89,7 @@ public class HANDLER_GT { //Only loads if the config option is true (default: true) if (CORE.ConfigSwitches.enableSkookumChoochers){ - new MetaGeneratedGregtechTools(); + sMetaGeneratedToolInstance= MetaGeneratedGregtechTools.getInstance(); } if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 94adb5a92c..2726b140ca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -216,10 +216,14 @@ public interface IGregtech_RecipeAdder { public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); - public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu, int aSpecial); + public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu); + + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut); + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu); + /** * Adds a Fusion reactor Recipe * diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 1ce7fc49d3..e1b329c07f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -247,9 +247,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getFuelValue(FluidStack aLiquid) { if (aLiquid != null && this.getRecipes() != null) { Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; - Logger.WARNING("Fuels: "+tRecipeList.size()); if (tRecipeList != null) { - Iterator var4 = tRecipeList.iterator(); + Logger.WARNING("Fuels: "+tRecipeList.size()); + Iterator<GT_Recipe> var4 = tRecipeList.iterator(); while (var4.hasNext()) { GT_Recipe tFuel = (GT_Recipe) var4.next(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index e0844bb071..4c60d9a932 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -9,7 +9,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -17,7 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { - public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java index 839fb3a14a..c9b98a6a64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java @@ -102,7 +102,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H String[] s2 = new String[]{ "Fluid Input for Multiblocks", "Capacity: " + getCapacity()+"L", - "Accepted Fluid: " + mTempMod + mLockedStack.getLocalizedName() + "Accepted Fluid: " + mTempMod + mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty" }; return s2; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 3b8597c5eb..68b81182fc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -86,6 +86,18 @@ GT_MetaTileEntity_MultiBlockBase { Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null)); Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null)); + if (CORE.DEBUG) { + aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + } + else { + aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + } + + try { + calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); + } catch (NoSuchMethodException | SecurityException e) {} + + //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) } @@ -523,20 +535,27 @@ GT_MetaTileEntity_MultiBlockBase { public void log(String s) { - boolean isDebugLogging = CORE.DEBUG; - boolean reset = true; + boolean isDebugLogging = CORE.DEBUG; + boolean reset = false; - if (aLogger == null || reset) { + if (reset) { if (isDebugLogging) { - aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + aLogger = ReflectionUtils.getMethod( + Logger.class, "INFO", String.class + ); } else { - aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + aLogger = ReflectionUtils.getMethod( + Logger.class, "MACHINE_INFO", String.class + ); } } try { aLogger.invoke(null, s); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + } } @@ -1435,13 +1454,15 @@ GT_MetaTileEntity_MultiBlockBase { boolean aExists = false; for (E m : aList) { IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); - BlockPos aPos = new BlockPos(b); - if (b != null && aPos != null) { - if (aCurPos.equals(aPos)) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + if (b != null) { + BlockPos aPos = new BlockPos(b); + if (aPos != null) { + if (aCurPos.equals(aPos)) { + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + } + return false; } - return false; } } } @@ -1867,20 +1888,16 @@ GT_MetaTileEntity_MultiBlockBase { } } - private static Method calculatePollutionReduction; + private static Method calculatePollutionReduction = null; public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) { - if (calculatePollutionReduction == null) { + if (calculatePollutionReduction != null) { try { - calculatePollutionReduction = i.getClass().getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) { - calculatePollutionReduction = null; + return (int) calculatePollutionReduction.invoke(i, g); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } - } - try { - return (int) calculatePollutionReduction.invoke(i, g); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return 0; } + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java index c8a7b5119d..ca78a72e04 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.util.MathHelper; @@ -21,7 +22,7 @@ public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); Block tBlock = aWorld.getBlock(tX, tY - 7, tZ); if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { - float math_pi = 3.141593F; + float math_pi = CORE.PI; float var6 = aRandom.nextFloat() * math_pi; float var1b = mSize / 8.0F; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java index 9d7eb5a020..e66106ad4a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; @@ -20,7 +21,7 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { for (int i = 0; i < mAmount; i++) { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { - float math_pi = 3.141593F;float var1b = mSize / 8.0F; + float math_pi = CORE.PI;float var1b = mSize / 8.0F; float var6 = aRandom.nextFloat() * math_pi; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; float var8b = -2*var3b;float var9b = -2*var4b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 629c584f70..2d7151bf45 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -32,7 +32,6 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -51,19 +50,16 @@ import net.minecraftforge.fluids.FluidStack; public class Meta_GT_Proxy { static { - instance = new Meta_GT_Proxy(); Logger.INFO("GT_PROXY - initialized."); } - public static final Meta_GT_Proxy instance; - public static List<Runnable> GT_BlockIconload = new ArrayList<>(); public static List<Runnable> GT_ItemIconload = new ArrayList<>(); public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>(); - private static Class sBaseMetaTileEntityClass; - private static Class sBaseMetaTileEntityClass2; + private static Class<BaseCustomTileEntity> sBaseMetaTileEntityClass; + private static Class<BaseCustomPower_MTE> sBaseMetaTileEntityClass2; public static AchievementHandler mAssemblyAchievements; @@ -79,7 +75,7 @@ public class Meta_GT_Proxy { public static Block sBlockMachines; - public void preInit() { + public static void preInit() { //New GT++ Block, yay! (Progress) //sBlockMachines = new GTPP_Block_Machines(); @@ -110,12 +106,12 @@ public class Meta_GT_Proxy { CoverManager.generateCustomCovers(); } - public void init() { + public static void init() { scheduleCoverMapCleaner(); setValidHeatingCoilMetas(); } - public void postInit() { + public static void postInit() { mAssemblyAchievements = new AchievementHandler(); } @@ -317,7 +313,7 @@ public class Meta_GT_Proxy { - public void setValidHeatingCoilMetas() { + public static void setValidHeatingCoilMetas() { for (int i = 0; i <= 6; i++ ) { GT_ValidHeatingCoilMetas.put(i); } @@ -342,7 +338,7 @@ public class Meta_GT_Proxy { } - public void scheduleCoverMapCleaner(){ + public static void scheduleCoverMapCleaner(){ TimerTask repeatedTask = new TimerTask() { public void run() { cleanupOverFlowCoverCache(); @@ -360,6 +356,7 @@ public class Meta_GT_Proxy { long aCurrentTime = System.currentTimeMillis()/1000; for (Object o : cache.values()) { if (o != null && o instanceof HashMap) { + @SuppressWarnings("unchecked") HashMap<String, Object> m = (HashMap<String, Object>) o; if (m != null) { String s = (String) m.get("aCoverKey"); @@ -390,7 +387,7 @@ public class Meta_GT_Proxy { return StaticFields59.getFieldFromGregtechProxy(fieldName); } - public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { + public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { mCustomGregtechMetaTooltips.put(aNbtTagName, aData); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index 4038d5bdf4..8b3fb9a42f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -297,7 +297,7 @@ public class TreeFarmHelper { return true; } else if (aStack.getUnlocalizedName().toLowerCase().contains("mu-metaitem")) { - String[] aData = aStack.getUnlocalizedName().toLowerCase().split("."); + String[] aData = aStack.getUnlocalizedName().toLowerCase().split("//."); if (aData != null && aData.length > 0) { for (String s : aData) { if (s.contains("32120")) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 236ae65edb..bc11cb6a11 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -8,7 +8,6 @@ import gregtech.api.enums.ToolDictNames; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; -import gregtech.common.tools.GT_Tool_WireCutter; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; @@ -25,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(), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index 4795b0d0b9..10a1f96be7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -710,8 +710,17 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi catch (Throwable t) { aTooltipSuper.put("Maximum pollution removed per second: "+mPollutionReduction); } - aTooltipSuper.put("Air Sides: "+mAirSides); - return aTooltipSuper.toArray(); + aTooltipSuper.put("Air Sides: "+mAirSides); + + String[] mBuiltOutput = new String[aTooltipSuper.size()]; + int aIndex = 0; + for (String i : aTooltipSuper) { + mBuiltOutput[aIndex++] = i; + } + + + + return mBuiltOutput; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 2e0eeea844..8b07117596 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -609,8 +609,13 @@ extends GregtechMeta_MultiBlockBase { } // -- Try not to fail after this point - inputs have already been consumed! -- - ItemStack[] mBuiltOutput = this.mReplicatorOutputMap.toArray(); - + ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()]; + int aIndex = 0; + for (ItemStack i : this.mReplicatorOutputMap) { + mBuiltOutput[aIndex++] = i; + } + + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java index 8925caf480..cb8b7590ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -207,7 +207,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { FluidStack[] arg5 = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); GT_Recipe arg6 = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, this.getMaxInputVoltage(), arg5, new ItemStack[0]); - if (arg6 == null && !this.mRunningOnLoad || this.maxEUStore() < (long) arg6.mSpecialValue) { + if (arg6 == null && !this.mRunningOnLoad || (arg6 != null && this.maxEUStore() < (long) arg6.mSpecialValue)) { //Logger.INFO("Bad Step "+aStep++); //this.turnCasingActive(false); this.mLastRecipe = null; @@ -215,7 +215,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { } //Logger.INFO("Step "+aStep++); - if (this.mRunningOnLoad || arg6.isRecipeInputEqual(true, arg5, new ItemStack[0])) { + if (this.mRunningOnLoad || (arg6 != null && arg6.isRecipeInputEqual(true, arg5, new ItemStack[0]))) { //Logger.INFO("Step "+aStep++); this.mLastRecipe = arg6; this.mEUt = this.mLastRecipe.mEUt * 1; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 33555c8f51..f3fefdf789 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -34,6 +34,10 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase public static int CASING_TEXTURE_ID; public static String mCasingName = "Advanced Cryogenic Casing"; public static TreeGenerator mTreeData; + + static { + mTreeData = new TreeGenerator(); + } public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -76,10 +80,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } }*/ - if (mTreeData == null) { - mTreeData = new TreeGenerator(); - } - diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index 07c8a4a7ac..24db72fbe0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -22,8 +22,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase { - - public GT_Recipe mLastRecipe; public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index d8a5617b2e..d4a25e03dd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -266,7 +266,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { //Get us four ItemStacks to input into the mixer ItemStack input1, input2, input3, input4; - input1 = (inputStacks.length >= 1) ? (input1 = (inputStacks[0] == null) ? null : inputStacks[0]) : null; + input1 = inputStacks[0]; input2 = (inputStacks.length >= 2) ? (input2 = (inputStacks[1] == null) ? null : inputStacks[1]) : null; input3 = (inputStacks.length >= 3) ? (input3 = (inputStacks[2] == null) ? null : inputStacks[2]) : null; input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java index 0a20d9357c..ce4a6c629a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.loaders; import java.util.HashSet; import java.util.Set; +import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; @@ -26,8 +27,23 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { private final GT_Recipe recipe; private final boolean isValid; - // Alternative Constructor + public boolean valid() { + return isValid; + } + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid) { + this(aExtracting, aEmpty, aFull, aFluid, null, null, null); + } + + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut) { + this(aExtracting, aEmpty, aFull, aFluidIn, aFluidOut, null, null); + } + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid, Integer aDuration, Integer aEUt) { + this(aExtracting, aEmpty, aFull, aFluid, null, aDuration, aEUt); + } + + // Alternative Constructor + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut, Integer aDuration, Integer aEUt) { ItemStack aInput; ItemStack aOutput; FluidStack aFluidInput; @@ -35,7 +51,7 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { // Safety check on the duration if (aDuration == null || aDuration <= 0) { - aDuration = (aFluid != null) ? (aFluid.amount / 62) : (1000 / 62); + aDuration = (aFluidIn != null) ? (aFluidIn.amount / 62) : ((aFluidOut != null) ? (aFluidOut.amount / 62) : 10); } // Safety check on the EU @@ -53,13 +69,13 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { aInput = aFull; aOutput = aEmpty; aFluidInput = null; - aFluidOutput = aFluid; + aFluidOutput = aFluidIn; } else { aInput = aEmpty; - aOutput = aFull; - aFluidInput = aFluid; - aFluidOutput = null; + aOutput = aFull; + aFluidInput = aFluidIn; + aFluidOutput = aFluidOut != null ? aFluidOut : GT_Values.NF; } //Check validity @@ -69,16 +85,16 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { new ItemStack[] { aInput }, new ItemStack[] { aOutput }, null, - new int[] {}, + new int[] {10000}, new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, aDuration, - 1, + aEUt, 0); // Not Valid - if ((aExtracting && (aInput == null || aOutput == null ||aFluidOutput == null)) || (!aExtracting && (aInput == null || aOutput == null || aFluidInput == null))) { + if ((aExtracting && (aInput == null || aOutput == null ||(aFluidInput == null && aFluidOutput == null))) || (!aExtracting && (aInput == null || aOutput == null || (aFluidInput == null && aFluidOutput == null)))) { isValid = false; disableOptional = aExtracting; recipe = null; @@ -102,77 +118,54 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { } private void generateRecipes() { - if (isValid && recipe != null) { - //Used to store Fluid extraction state + if (isValid && recipe != null) { if (this.disableOptional) { - addFluidExtractionRecipe( - recipe.mInputs.length >= 1 ? recipe.mInputs[0] : null, //Input - recipe.mInputs.length == 2 ? recipe.mInputs[1] : null, //Input 2 - recipe.mFluidOutputs.length == 1 ? recipe.mFluidOutputs[0] : null, //Fluid Output - recipe.mDuration, //Duration - recipe.mEUt //Eu Tick - ); + addFluidExtractionRecipe(recipe); } else { - addFluidCannerRecipe( - recipe.mInputs.length == 1 ? recipe.mInputs[0] : null, //Input - recipe.mOutputs.length == 1 ? recipe.mOutputs[0] : null, //Input 2 - recipe.mFluidInputs.length == 1 ? recipe.mFluidInputs[0] : null //Fluid Input - ); - + addFluidCannerRecipe(recipe); } - } } - private final boolean addFluidExtractionRecipe(final ItemStack aInput, final ItemStack aRemains, FluidStack aOutput, int aDuration, final int aEUt) { - if (aInput == null || aOutput == null) { - return false; - } - if (aOutput.isFluidEqual(Materials.PhasedGold.getMolten(1L))) { - aOutput = Materials.VibrantAlloy.getMolten(aOutput.amount); - } - if (aOutput.isFluidEqual(Materials.PhasedIron.getMolten(1L))) { - aOutput = Materials.PulsatingIron.getMolten(aOutput.amount); + private final boolean addFluidExtractionRecipe(GT_Recipe aRecipe) { + if (aRecipe != null) { + if ((aRecipe.mDuration = GregTech_API.sRecipeFile.get("fluidextractor", aRecipe.mInputs[0], aRecipe.mDuration)) <= 0) { + return false; + } else { + GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); + return true; + } } - //Logger.INFO(buildLogString()); - boolean result = GT_Values.RA.addFluidExtractionRecipe(aInput, aRemains, aOutput, 10000, aDuration, aEUt); - //Logger.INFO(buildLogString()); - //dumpStack(); - return result; + return false; } - public final boolean addFluidCannerRecipe(final ItemStack aInput, final ItemStack aOutput, FluidStack aFluidInput) { - if (aInput == null || aOutput == null || aFluidInput == null) { - return false; - } - if (aFluidInput.isFluidEqual(Materials.PhasedGold.getMolten(1L))) { - aFluidInput = Materials.VibrantAlloy.getMolten(aFluidInput.amount); - } - if (aFluidInput.isFluidEqual(Materials.PhasedIron.getMolten(1L))) { - aFluidInput = Materials.PulsatingIron.getMolten(aFluidInput.amount); + private final boolean addFluidCannerRecipe(GT_Recipe recipe2) { + if (recipe2 != null) { + if ((recipe2.mDuration = GregTech_API.sRecipeFile.get("fluidcanner", recipe2.mOutputs[0], recipe2.mDuration)) <= 0) { + return false; + } else { + GT_Recipe_Map.sFluidCannerRecipes.addRecipe(recipe2); + return true; + } } - //Logger.INFO(buildLogString()); - boolean result = GT_Values.RA.addFluidCannerRecipe(aInput, aOutput, aFluidInput, GT_Values.NF); - //Logger.INFO(buildLogString()); - //dumpStack(); - return result; - } - + return false; + } + 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)); } - + } - + private String buildLogString() { int solidSize = getMapSize(GT_Recipe_Map.sCannerRecipes); int fluidSize = getMapSize(GT_Recipe_Map.sFluidCannerRecipes); return (disableOptional ? "EXTRACTING" : "CANNING")+" DEBUG | Solids: "+solidSize+" | Liquids: "+fluidSize+" | "; } - + private final int getMapSize(GT_Recipe_Map aMap) { return aMap.mRecipeList.size(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index b3b71c7587..799c6cd63b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -51,7 +51,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getIngot(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -67,7 +66,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getPlate(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -83,7 +81,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input null, // Input 2 material.getFluid(288), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -99,7 +96,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getNugget(1), // Input null, // Input 2 material.getFluid(16), // Fluid Output - 0, // Chance 16, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -115,7 +111,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getBlock(1), // Input null, // Input 2 material.getFluid(144 * 9), // Fluid Output - 0, // Chance 288, // Duration material.vVoltageMultiplier // Eu Tick )) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 52f7ab24f3..9b7e1d708d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -219,9 +219,10 @@ public class RecipeGen_Ore extends RecipeGen_Base { Logger.MATERIALS("material.getCrushed(1): "+(material.getCrushed(1) != null)); Logger.MATERIALS("material.getCrushedPurified(1): "+(material.getCrushedPurified(1) != null)); - Logger.MATERIALS("bonusA.getTinyDust(1): "+(tinyDustA != null)+" | Material: "+(bonusA != null) + " | Material name: "+(bonusA != null ? bonusA.getLocalizedName() : "invalid material")); - Logger.MATERIALS("bonusB.getTinyDust(1): "+(tinyDustB != null)+" | Material: "+(bonusB != null) + " | Material name: "+(bonusB != null ? bonusB.getLocalizedName() : "invalid material")); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusA.getCrushed(1)))); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusB.getCrushed(1)))); + try { //.08 compat if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), tinyDustB, dustStone)){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index 3328b0894f..58db8a473f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -7,16 +7,11 @@ import java.util.Map; import org.apache.commons.lang3.reflect.FieldUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; @@ -26,6 +21,8 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; public class RecipeGen_Recycling implements Runnable { @@ -60,6 +57,7 @@ public class RecipeGen_Recycling implements Runnable { public static void generateRecipes(final Material material) { + if (material != null) Logger.WARNING("Generating Recycling recipes for " + material.getLocalizedName()); final OrePrefixes[] mValidPrefixesAsString = { OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.nugget, @@ -139,7 +137,7 @@ public class RecipeGen_Recycling implements Runnable { //Fluid Extractor if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, material.vVoltageMultiplier)) { + if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 30, material.vVoltageMultiplier)) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluid(1).getLocalizedName()+"."); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 3c996ef64f..fa6f2ad790 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -19,7 +19,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; @@ -991,15 +990,24 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu, int aSpecial) { - Method aExtractionMethod = ReflectionUtils.getMethod(MaterialGenerator.class, "addFluidExtractionRecipe", new Class[] {ItemStack.class, ItemStack.class, FluidStack.class, int.class, int.class}); - return ReflectionUtils.invoke(null, aExtractionMethod, new Object[] {input, input2, output, aSpecial, aTime, aEu}); + public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu) { + return MaterialGenerator.addFluidExtractionRecipe(input, input2, output, aTime, aEu); + } + + @Override + public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn) { + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, null); } @Override public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, FluidStack rFluidOut) { - Method aExtractionMethod = ReflectionUtils.getMethod(MaterialGenerator.class, "addFluidCannerRecipe", new Class[] {ItemStack.class, ItemStack.class, FluidStack.class}); - return ReflectionUtils.invoke(null, aExtractionMethod, new Object[] {aFullContainer, container, rFluidIn, rFluidOut}); + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut); + } + + + @Override + public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu) { + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut, aTime, aEu); } /** diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java index e394a8b8c0..6933987593 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java @@ -221,10 +221,10 @@ public class FishTrapHandler { private static void addGregtechFluidRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ if (CORE.GTNH) { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 10000, 16, 4); + CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 16, 4); } else { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 0, 16, 4); //4eu/t total eu used = 64 so time = 64/4 + CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 16, 4); //4eu/t total eu used = 64 so time = 64/4 } } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index 8beaa8df5e..f23a5db6fe 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -38,8 +38,18 @@ import net.minecraft.world.World; public class ThaumcraftUtils { - private static Class mClass_Aspect; + private static Class<?> mClass_Aspect; private static Field mField_Aspects; + + static { + mClass_Aspect = ReflectionUtils.getClass("thaumcraft.api.aspects.Aspect"); + if (mClass_Aspect != null) { + Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); + if (aTagF != null) { + mField_Aspects = aTagF; + } + } + } public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper aspect, int amount) { return addAspectToItem(item, new TC_Aspect_Wrapper[] {aspect}, new Integer[] {amount}); @@ -212,10 +222,10 @@ public class ThaumcraftUtils { } - private static final Class mClass_ThaumcraftApi; - private static final Class mClass_ThaumcraftApiHelper; - private static final Class mClass_AspectList; - private static final Class mClass_ResearchManager; + private static final Class<?> mClass_ThaumcraftApi; + private static final Class<?> mClass_ThaumcraftApiHelper; + private static final Class<?> mClass_AspectList; + private static final Class<?> mClass_ResearchManager; private static final Method mMethod_registerObjectTag1; private static final Method mMethod_registerObjectTag2; private static final Method mMethod_registerComplexObjectTag; @@ -336,12 +346,11 @@ public class ThaumcraftUtils { public static String getTagFromAspectObject(Object aAspect) { - try { - Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); - if (aTagF == null) { + try { + if (mClass_Aspect == null || mField_Aspects == null) { return null; - } - String aTafB = (String) aTagF.get(aAspect); + } + String aTafB = (String) mField_Aspects.get(aAspect); if (aTafB == null) { return null; } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index 1b2541ff3a..56e577fb7d 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -34,7 +34,7 @@ public class TF_Gregtech_Recipes { //Gelid Cryotheum Logger.INFO("Adding Recipes for Gelid Cryotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 10000, 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 200, 240); GT_Values.RA.addChemicalBathRecipe((GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), getFluidStack("cryotheum", 144), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), GT_Values.NI, GT_Values.NI, null, 400, 30); //Blizz Powder @@ -48,10 +48,10 @@ public class TF_Gregtech_Recipes { //Blazing Pyrotheum Logger.INFO("Adding Recipes for Blazing Pyrotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 10000, 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 200, 240); //Ender Fluid - CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 10000, 100, 30); + CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 100, 30); ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); |