aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorFlorexiz <florexiz.nm@gmail.com>2021-10-14 16:05:15 +0300
committerFlorexiz <florexiz.nm@gmail.com>2021-10-14 16:05:15 +0300
commite4d5b98240f4c7e87a84f6c8f1fa1cd50302072e (patch)
treea8d3f31a2da7081a9aa33dfdc536acfd978ea291 /src/main
parentb205a5f77d60261b8dfe8a1284dac23b1c3cce2a (diff)
downloadGT5-Unofficial-e4d5b98240f4c7e87a84f6c8f1fa1cd50302072e.tar.gz
GT5-Unofficial-e4d5b98240f4c7e87a84f6c8f1fa1cd50302072e.tar.bz2
GT5-Unofficial-e4d5b98240f4c7e87a84f6c8f1fa1cd50302072e.zip
EBF support for separate busses
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java106
1 files changed, 61 insertions, 45 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index b55ae939b6..08fc81a0d0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -12,6 +12,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.render.TextureFactory;
@@ -141,57 +142,72 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
@Override
public boolean checkRecipe(ItemStack aStack) {
- ItemStack[] tInputs = getCompactedInputs();
- FluidStack[] tFluids = getCompactedFluids();
-
- if (tInputs.length <= 0)
- return false;
-
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(
- getBaseMetaTileEntity(),
- false,
- V[tTier],
- tFluids,
- tInputs
- );
-
- if (tRecipe == null)
- return false;
- if (this.mHeatingCapacity < tRecipe.mSpecialValue)
- return false;
- if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
- return false;
-
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
- int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900;
- byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, 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);
- }
- if (tHeatCapacityDivTiers > 0) {
- this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
- this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount);//extra free overclocking if possible
- if (this.mMaxProgresstime < 1)
- this.mMaxProgresstime = 1;//no eu efficiency correction
+
+ FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]);
+
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tInputs = new ArrayList<>();
+ tBus.mRecipeMap = getRecipeMap();
+
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) {
+ tInputs.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+
+ if (tInputs.size() <= 0)
+ continue;
+
+ ItemStack[] tItems = tInputs.toArray(new ItemStack[0]);
+
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(
+ getBaseMetaTileEntity(),
+ false,
+ V[tTier],
+ tFluids,
+ tItems
+ );
+
+ if (tRecipe == null)
+ continue;
+ if (this.mHeatingCapacity < tRecipe.mSpecialValue)
+ continue;
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tItems))
+ continue;
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ continue;
+
+ int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900;
+ byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ if (tHeatCapacityDivTiers > 0) {
+ this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount);//extra free overclocking if possible
+ if (this.mMaxProgresstime < 1)
+ this.mMaxProgresstime = 1;//no eu efficiency correction
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ this.mOutputItems = new ItemStack[]{
+ tRecipe.getOutput(0),
+ tRecipe.getOutput(1)
+ };
+ this.mOutputFluids = new FluidStack[]{
+ tRecipe.getFluidOutput(0)
+ };
+ updateSlots();
+ return true;
}
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{
- tRecipe.getOutput(0),
- tRecipe.getOutput(1)
- };
- this.mOutputFluids = new FluidStack[]{
- tRecipe.getFluidOutput(0)
- };
- updateSlots();
- return true;
+ return false;
}
-
/**
* Calcualtes overclocked ness using long integers
*