diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-09-08 20:35:09 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-09-08 20:35:09 +1000 |
commit | 4fd354bed6a53a9319392b5a300cb8aa77cacb34 (patch) | |
tree | fda4a7c35a801ab52f67ed078250683cac876eae /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | d37252418e361dc154fa33156755ec35dfc0c331 (diff) | |
download | GT5-Unofficial-4fd354bed6a53a9319392b5a300cb8aa77cacb34.tar.gz GT5-Unofficial-4fd354bed6a53a9319392b5a300cb8aa77cacb34.tar.bz2 GT5-Unofficial-4fd354bed6a53a9319392b5a300cb8aa77cacb34.zip |
$ Improved multiblock recipe handling.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
4 files changed, 39 insertions, 39 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index 8c71ccc6fc..28195a321f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -14,15 +14,17 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; -import gtPlusPlus.xmod.gregtech.recipes.MultiblockRecipeMapHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -84,11 +86,6 @@ extends GregtechMeta_MultiBlockBase { } @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return MultiblockRecipeMapHandler.mMultiCentrifuge; - } - - @Override public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @@ -103,7 +100,7 @@ extends GregtechMeta_MultiBlockBase { }*/ Utils.LOG_WARNING("Centrifuge Debug - 1"); - final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); + final GT_Recipe_Map map = GT_Recipe_Map.sCentrifugeRecipes; if (map == null) { Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map"); return false; @@ -118,6 +115,7 @@ extends GregtechMeta_MultiBlockBase { final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); if ((tInputList.size() > 0) || (tFluids.length > 0)) { final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); if (tRecipe != null) { Utils.LOG_WARNING("Recipe was not invalid"); this.mLastRecipe = tRecipe; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 523886578e..5234fa0a01 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -13,14 +13,16 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.recipes.MultiblockRecipeMapHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -72,11 +74,6 @@ extends GregtechMeta_MultiBlockBase { } @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return MultiblockRecipeMapHandler.mMultiElectrolyzer; - } - - @Override public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @@ -123,7 +120,15 @@ extends GregtechMeta_MultiBlockBase { if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { final long tVoltage = this.getMaxInputVoltage(); final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + + + + final GT_Recipe_Map map = GT_Recipe_Map.sElectrolyzerRecipes; + final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + + tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); + + if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java index 134bec0d4e..a3cc09cb24 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java @@ -12,15 +12,17 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.recipes.MultiblockRecipeMapHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -71,16 +73,6 @@ extends GregtechMeta_MultiBlockBase { } @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return MultiblockRecipeMapHandler.mMultiMacerator; - } - - /*@Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - }*/ - - @Override public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @@ -134,16 +126,20 @@ extends GregtechMeta_MultiBlockBase { } //Make a recipe instance for the rest of the method. - final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + final GT_Recipe_Map map = GT_Recipe_Map.sMaceratorRecipes; + final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + + tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); + final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs); - Utils.LOG_WARNING("Maceration Stack - Valid Output Hatches: "+tValidOutputSlots); + Utils.LOG_INFO("Maceration Stack - Valid Output Hatches: "+tValidOutputSlots); //More than or one input if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { - Utils.LOG_WARNING("Valid Recipe found - size "+tRecipe.mOutputs.length); + Utils.LOG_INFO("Valid Recipe found - size "+tRecipe.mOutputs.length); this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; @@ -153,15 +149,15 @@ extends GregtechMeta_MultiBlockBase { final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length]; for (int i = 0; i < tRecipe.mOutputs.length; i++){ if (i==0) { - Utils.LOG_WARNING("Adding the default output"); + Utils.LOG_INFO("Adding the default output"); outputs[0] = tRecipe.getOutput(i); } else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ - Utils.LOG_WARNING("Adding a bonus output"); + Utils.LOG_INFO("Adding a bonus output"); outputs[i] = tRecipe.getOutput(i); } else { - Utils.LOG_WARNING("Adding null output"); + Utils.LOG_INFO("Adding null output"); outputs[i] = null; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java index 833178a1ae..6ea80f1afe 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java @@ -10,14 +10,16 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.recipes.MultiblockRecipeMapHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -65,11 +67,6 @@ extends GregtechMeta_MultiBlockBase { } @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return MultiblockRecipeMapHandler.mMultiWireMill; - } - - @Override public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @@ -81,7 +78,11 @@ extends GregtechMeta_MultiBlockBase { final long tVoltage = this.getMaxInputVoltage(); final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + + final GT_Recipe_Map map = GT_Recipe_Map.sWiremillRecipes; + final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + + tRecipe.mDuration = MathUtils.findPercentageOfInt(tRecipe.mDuration, 80); if (tRecipe != null) { final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, new ItemStack[]{tInput}); @@ -231,7 +232,7 @@ extends GregtechMeta_MultiBlockBase { public byte getCasingTextureIndex() { - return 1; + return (byte) TAE.GTPP_INDEX(6); } private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { |