diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-02-07 09:09:36 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-02-07 09:09:36 +0000 |
commit | a7cf24d87bbe776018ffe0c5bb9a8436151ffad6 (patch) | |
tree | a79483a86d93b4f27665635fd9827075760cde56 /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | 0410038d093905b77e5cf943afe02291dd4eef0c (diff) | |
download | GT5-Unofficial-a7cf24d87bbe776018ffe0c5bb9a8436151ffad6.tar.gz GT5-Unofficial-a7cf24d87bbe776018ffe0c5bb9a8436151ffad6.tar.bz2 GT5-Unofficial-a7cf24d87bbe776018ffe0c5bb9a8436151ffad6.zip |
$ Backwards compatibility.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
3 files changed, 43 insertions, 20 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 9068bf2ec1..63581af16c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -5,7 +5,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -34,6 +33,7 @@ public class StaticFields59 { public static final Field mDescriptionArray; public static final Field mCasingTexturePages; public static final Field mAssLineVisualMapNEI; + public static final GT_Recipe_Map sAssemblylineVisualRecipes; public static final Method mCalculatePollutionReduction; public static final Method mAddFurnaceRecipe; @@ -44,29 +44,51 @@ public class StaticFields59 { //OrePrefixes static { + Logger.INFO("[SH] Creating Static Helper for various fields which require reflective access."); mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5"); + Logger.INFO("[SH] Got Field: sBlockCasings5"); mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents"); + Logger.INFO("[SH] Got Field: mPreventableComponents"); mDisabledItems = getField(OrePrefixes.class, "mDisabledItems"); - mMultiblockChemicalRecipes = getField(GT_Recipe_Map.class, "sMultiblockChemicalRecipes"); + Logger.INFO("[SH] Got Field: mDisabledItems"); mDescriptionArray = getField(GT_MetaTileEntity_TieredMachineBlock.class, "mDescriptionArray"); + Logger.INFO("[SH] Got Field: mDescriptionArray"); mCasingTexturePages = getField(BlockIcons.class, "casingTexturePages"); + Logger.INFO("[SH] Got Field: casingTexturePages"); + mAssLineVisualMapNEI = getField(GT_Recipe_Map.class, "sAssemblylineVisualRecipes"); - - mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", int.class); - - Logger.INFO("Initializing a recipe handler for different versions of Gregtech 5."); - //Yep... - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - Logger.INFO("Selecting GT 5.7/5.8 Recipe Set"); - mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); + Logger.INFO("[SH] Got Field: mAssLineVisualMapNEI"); + GT_Recipe_Map aTemp; + if (mAssLineVisualMapNEI != null) { + try { + aTemp = (GT_Recipe_Map) mAssLineVisualMapNEI.get(null); + Logger.INFO("[SH] Got Field: sAssemblylineVisualRecipes"); + } catch (IllegalArgumentException | IllegalAccessException e) { + aTemp = null; + } + } else { + aTemp = null; } - else { - Logger.INFO("Selecting GT 5.9 Recipe Set"); - mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); + + sAssemblylineVisualRecipes = aTemp; + mMultiblockChemicalRecipes = getField(GT_Recipe_Map.class, "sMultiblockChemicalRecipes"); + Logger.INFO("[SH] Got Field: sMultiblockChemicalRecipes"); + + mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", + int.class); + Logger.INFO("[SH] Got Method: calculatePollutionReduction"); + + // Yep... + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, + ItemStack.class); + Logger.INFO("[SH] Got Method: addSmeltingAndAlloySmeltingRecipe"); + } else { + mAddFurnaceRecipe = getMethod(GT_ModHandler.class, "addSmeltingAndAlloySmeltingRecipe", ItemStack.class, + ItemStack.class, boolean.class); + Logger.INFO("[SH] Got Method: addSmeltingAndAlloySmeltingRecipe"); } - - - + } public static synchronized final Block getBlockCasings5() { 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 eb6a9bfcd3..c364fe5e9e 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 @@ -229,7 +229,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //I stole this code reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); Logger.WARNING("reduction[2]:"+reduction); - reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow); Logger.WARNING("reduction[3]:"+reduction); mPollutionReduction = reduction; @@ -683,7 +683,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); - reduction = GT_Utility.safeInt(((long)reduction/100)*this.mOptimalAirFlow); + reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow); aTooltipSuper.put("Maximum pollution removed per second: "+reduction); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java index 8446737017..23ca94e54d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java @@ -22,6 +22,7 @@ import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gregtech.common.GT_Pollution; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -401,7 +402,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc if (this.addOutput(tEmptyContainer1)) { aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true); this.depleteInput(a); - GT_Pollution.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null)); + PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null)); } } } @@ -418,7 +419,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue); if (tFluidAmountToUse > 0L && aBaseMetaTileEntity .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null)); + PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollutionPerTick(null)); mFluid.amount = (int) ((long) mFluid.amount - tFluidAmountToUse * (long) tEmptyContainer); } |