aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2020-03-12 09:39:45 +0100
committerGitHub <noreply@github.com>2020-03-12 09:39:45 +0100
commitc7b3476f1abbcc4212edc5446f0981726b80a2b4 (patch)
tree5d468a16ede1188148de49047792326d63c37ea0 /src/main/java
parent72107b92fa93402b7a74870cae8337b125821b60 (diff)
parent7dfd50f5471295ae81645ddfedbfe83bd44ccf58 (diff)
downloadGT5-Unofficial-c7b3476f1abbcc4212edc5446f0981726b80a2b4.tar.gz
GT5-Unofficial-c7b3476f1abbcc4212edc5446f0981726b80a2b4.tar.bz2
GT5-Unofficial-c7b3476f1abbcc4212edc5446f0981726b80a2b4.zip
Merge pull request #249 from botn365/PA_separate_input_busses
Pa separate input busses
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java55
1 files changed, 49 insertions, 6 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 82dcdc905f..b5af827197 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -19,12 +19,15 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
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_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
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;
@@ -35,6 +38,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
private GT_Recipe mLastRecipe;
private int tTier = 0;
private int mMult = 0;
+ private boolean mSeparate = false;
public GT_MetaTileEntity_ProcessingArray(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -59,6 +63,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
"1x Energy Hatch (Any casing)",
"Robust Tungstensteel Machine Casings for the rest (14 at least!)",
"Place up to 64 Single Block GT Machines into the Controller Inventory",
+ "Use screwdriver to enable separate input busses",
"Maximal overclockedness of machines inside: Tier 9"};
}
@@ -204,7 +209,6 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
GT_Recipe.GT_Recipe_Map map = getRecipeMap();
if (map == null) return false;
- ArrayList<ItemStack> tInputList = getStoredInputs();
if (mInventory[1].getUnlocalizedName().endsWith("10")) {
tTier = 9;
@@ -252,12 +256,33 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
if (!mMachine.equals(mInventory[1].getUnlocalizedName())) mLastRecipe = null;
mMachine = mInventory[1].getUnlocalizedName();
- ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
-
+
ArrayList<FluidStack> tFluidList = getStoredFluids();
-
FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
- if (tInputList.size() > 0 || tFluids.length > 0) {
+ if (mSeparate) {
+ ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>();
+ for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) {
+ IGregTechTileEntity tInpuBus = tHatch.getBaseMetaTileEntity();
+ for (int i = tInpuBus.getSizeInventory() - 1; i >= 0; i--) {
+ if (tInpuBus.getStackInSlot(i) != null)
+ tInputList.add(tInpuBus.getStackInSlot(i));
+ }
+ ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
+ if (processRecipe(tInputs, tFluids, map))
+ return true;
+ else
+ tInputList.clear();
+ }
+ } else {
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
+ return processRecipe(tInputs, tFluids, map);
+ }
+ return false;
+ }
+
+ public boolean processRecipe(ItemStack[] tInputs, FluidStack[] tFluids, GT_Recipe.GT_Recipe_Map map) {
+ if (tInputs.length > 0 || tFluids.length > 0) {
GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
if (tRecipe != null) {
if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 &&
@@ -344,7 +369,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
...remoteRecipeCheck()
}*/
}
- return false;
+ return false;
}
public static ItemStack[] clean(final ItemStack[] v) {
@@ -380,6 +405,24 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
return tAmount >= 14;
}
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mSeparate", mSeparate);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mSeparate = aNBT.getBoolean("mSeparate");
+ }
+
+ @Override
+ public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mSeparate = !mSeparate;
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") +" "+mSeparate);
+ }
public int getMaxEfficiency(ItemStack aStack) {
return 10000;