aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2021-10-15 11:50:53 +0200
committerGitHub <noreply@github.com>2021-10-15 11:50:53 +0200
commit71343cf18854adec60776068d5245110578024ee (patch)
tree905f51553e0e10d8c11db3f1b706afde27794bd4 /src/main/java/gregtech
parent9c30230c5cc1be3d7a213c52b2be85e59ce40cf7 (diff)
parentb5b1b3c617def2521c2014a1bb68dcda77cd0ad2 (diff)
downloadGT5-Unofficial-71343cf18854adec60776068d5245110578024ee.tar.gz
GT5-Unofficial-71343cf18854adec60776068d5245110578024ee.tar.bz2
GT5-Unofficial-71343cf18854adec60776068d5245110578024ee.zip
Merge pull request #685 from Florexiz/experimental
EBF separate busses
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java63
1 files changed, 54 insertions, 9 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..43498a59fe 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;
@@ -19,8 +20,10 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_StructureUtility;
import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
@@ -42,6 +45,7 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_ElectricBlastFurnace> implements IConstructable {
private int mHeatingCapacity = 0;
+ private boolean isBussesSeparate = false;
protected final ArrayList<GT_MetaTileEntity_Hatch_Output> mPollutionOutputHatches = new ArrayList<>();
protected final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000),
Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)};
@@ -141,36 +145,60 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
@Override
public boolean checkRecipe(ItemStack aStack) {
- ItemStack[] tInputs = getCompactedInputs();
- FluidStack[] tFluids = getCompactedFluids();
+ if(isBussesSeparate) {
+ 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));
+ }
+ }
+ }
+ ItemStack[] tItems = tInputs.toArray(new ItemStack[0]);
+ if (processRecipe(tItems, tFluids)) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ return processRecipe(getCompactedInputs(), getCompactedFluids());
+ }
- if (tInputs.length <= 0)
+ }
+ protected boolean processRecipe(ItemStack[] tItems, FluidStack[] tFluids) {
+ if (tItems.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
+ tItems
);
if (tRecipe == null)
return false;
if (this.mHeatingCapacity < tRecipe.mSpecialValue)
return false;
- if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))
+ if (!tRecipe.isRecipeInputEqual(true, tFluids, tItems))
+ return false;
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
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);
}
@@ -191,7 +219,6 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
updateSlots();
return true;
}
-
/**
* Calcualtes overclocked ness using long integers
*
@@ -385,4 +412,22 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab
public void construct(ItemStack stackSize, boolean hintsOnly) {
buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1,3,0);
}
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ isBussesSeparate = !isBussesSeparate;
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + isBussesSeparate);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("isBussesSeparate", isBussesSeparate);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ isBussesSeparate = aNBT.getBoolean("isBussesSeparate");
+ }
}