diff options
author | GlodBlock <1356392126@qq.com> | 2021-09-27 18:56:42 +0800 |
---|---|---|
committer | GlodBlock <1356392126@qq.com> | 2021-09-27 18:56:42 +0800 |
commit | 55cc4021bbb655e9ab86d799d9ee9cc803d3d5c4 (patch) | |
tree | 5a50cd3429fe367f81cc43f3c72b4c4413c08a22 /src | |
parent | 92433a5b85bb2fcca541ac25ca4033fac24f841e (diff) | |
download | GT5-Unofficial-55cc4021bbb655e9ab86d799d9ee9cc803d3d5c4.tar.gz GT5-Unofficial-55cc4021bbb655e9ab86d799d9ee9cc803d3d5c4.tar.bz2 GT5-Unofficial-55cc4021bbb655e9ab86d799d9ee9cc803d3d5c4.zip |
allow VF to accept fluid input
Diffstat (limited to 'src')
4 files changed, 55 insertions, 29 deletions
diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index f500e8027e..2490b37eb1 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -504,6 +504,8 @@ public interface IGT_RecipeAdder { boolean addVacuumFreezerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); + boolean addVacuumFreezerRecipe(FluidStack aInput1, FluidStack aOutput1, int aDuration, int aEUt); + /** * Adds a Fuel for My Generators * diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index f941a86f5c..9b0bfb970a 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -302,6 +302,13 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } } + public GT_Recipe(FluidStack aInput1, FluidStack aOutput1, int aDuration, int aEUt) { + this(false, null, null, null, null, new FluidStack[]{aInput1}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, 0); + if (mFluidInputs.length > 0 && mFluidOutputs[0] != null) { + GT_Recipe_Map.sVacuumRecipes.addRecipe(this); + } + } + //Dummy GT_Recipe maker... public GT_Recipe(ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ this(true, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); @@ -609,7 +616,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map sBlastRecipes = new GT_Recipe_Map(new HashSet<>(800), "gt.recipe.blastfurnace", "Blast Furnace", null, RES_PATH_GUI + "basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); public static final GT_Recipe_Map sPrimitiveBlastRecipes = new GT_Recipe_Map(new HashSet<>(200), "gt.recipe.primitiveblastfurnace", "Primitive Blast Furnace", null, RES_PATH_GUI + "basicmachines/Default", 3, 3, 1, 0, 1, E, 1, E, false, true); public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map(new HashSet<>(900), "gt.recipe.implosioncompressor", "Implosion Compressor", null, RES_PATH_GUI + "basicmachines/Default", 2, 2, 2, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map(new HashSet<>(305), "gt.recipe.vacuumfreezer", "Vacuum Freezer", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, false, true); + public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map(new HashSet<>(305), "gt.recipe.vacuumfreezer", "Vacuum Freezer", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, E, 1, E, false, true); public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map(new HashSet<>(1170), "gt.recipe.chemicalreactor", "Chemical Reactor", null, RES_PATH_GUI + "basicmachines/ChemicalReactor", 2, 2, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor(); public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map_DistillationTower(); diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index cdf3bf38b7..7e996be264 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -10,11 +10,8 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.objects.GT_FluidStack; import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; +import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; -import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_IntegratedCircuit_Item; import mods.railcraft.common.blocks.aesthetics.cube.EnumCube; import mods.railcraft.common.items.RailcraftToolItems; @@ -660,6 +657,11 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { return false; } new GT_Recipe(aInput1, aOutput1, aDuration, aEUt, 0);//Since all other methods are taken + FluidStack tInputFluid = GT_Utility.getFluidForFilledItem(aInput1, true); + FluidStack tOutputFluid = GT_Utility.getFluidForFilledItem(aOutput1, true); + if (tInputFluid != null && tOutputFluid != null) { + addVacuumFreezerRecipe(tInputFluid, tOutputFluid, aDuration, aEUt); + } return true; } @@ -672,6 +674,20 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { return false; } new GT_Recipe(aInput1, aOutput1, aDuration); + FluidStack tInputFluid = GT_Utility.getFluidForFilledItem(aInput1, true); + FluidStack tOutputFluid = GT_Utility.getFluidForFilledItem(aOutput1, true); + if (tInputFluid != null && tOutputFluid != null) { + addVacuumFreezerRecipe(tInputFluid, tOutputFluid, aDuration, 120); + } + return true; + } + + @Override + public boolean addVacuumFreezerRecipe(FluidStack aInput1, FluidStack aOutput1, int aDuration, int aEUt) { + if ((aInput1 == null) || (aOutput1 == null)) { + return false; + } + new GT_Recipe(aInput1, aOutput1, aDuration, aEUt); return true; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index b7f24f7e7a..843f2ff337 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -14,8 +14,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; - -import java.util.ArrayList; +import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; @@ -49,6 +48,8 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult .addCasingInfo("Frost Proof Machine Casing", 16) .addEnergyHatch("Any casing", 1) .addMaintenanceHatch("Any casing", 1) + .addInputHatch("Any casing", 1) + .addOutputHatch("Any casing", 1) .addInputBus("Any casing", 1) .addOutputBus("Any casing", 1) .toolTipFinisher("Gregtech"); @@ -93,29 +94,29 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult @Override public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, tInput); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, tInput)) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; + ItemStack[] tInputList = getCompactedInputs(); + FluidStack[] tFluidList = getCompactedFluids(); + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidList, tInputList); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, tFluidList, tInputList)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + updateSlots(); + return true; } } return false; |