aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java104
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java27
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java14
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java14
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java21
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java100
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java103
12 files changed, 354 insertions, 55 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index cfb34eb34e..9fd8e75754 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -1,5 +1,15 @@
package gregtech.api.metatileentity;
+import appeng.api.networking.IGridNode;
+import appeng.api.networking.security.IActionHost;
+import appeng.api.util.AECableType;
+import appeng.api.util.DimensionalCoord;
+import appeng.me.helpers.AENetworkProxy;
+import appeng.me.helpers.IGridProxyable;
+import appeng.tile.TileEvent;
+import appeng.tile.events.TileEventType;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.Optional;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
@@ -51,7 +61,10 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
* <p/>
* This is the main TileEntity for EVERYTHING.
*/
-public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity {
+@Optional.InterfaceList(value = {
+ @Optional.Interface(iface = "appeng.api.networking.security.IActionHost", modid = "appliedenergistics2", striprefs = true),
+ @Optional.Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2", striprefs = true)})
+public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable {
private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior};
protected MetaTileEntity mMetaTileEntity;
protected long mStoredEnergy = 0, mStoredSteam = 0;
@@ -843,8 +856,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (isValidFacing(aFacing)) {
mFacing = aFacing;
mMetaTileEntity.onFacingChange();
- onMachineBlockUpdate();
+
doEnetUpdate();
+
+ if (mMetaTileEntity.shouldTriggerBlockUpdate()) {
+ // If we're triggering a block update this will call onMachineBlockUpdate()
+ GregTech_API.causeMachineUpdate(worldObj, xCoord, yCoord, zCoord);
+ } else {
+ // If we're not trigger a cascading one, call the update here.
+ onMachineBlockUpdate();
+ }
}
}
@@ -910,11 +931,15 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mMetaTileEntity.setBaseMetaTileEntity(null);
}
super.invalidate();
+ if (GregTech_API.mAE2)
+ invalidateAE();
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
+ if (GregTech_API.mAE2)
+ onChunkUnloadAE();
}
@Override
@@ -2202,5 +2227,78 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
return slotIndex + indexShift;
}
-}
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public IGridNode getGridNode(ForgeDirection forgeDirection) {
+ if (mFacing != forgeDirection.ordinal())
+ return null;
+ AENetworkProxy gp = getProxy();
+ return gp != null ? gp.getNode() : null;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public AECableType getCableConnectionType(ForgeDirection forgeDirection) {
+ return mMetaTileEntity == null ? AECableType.NONE : mMetaTileEntity.getCableConnectionType(forgeDirection);
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public void securityBreak() {}
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public IGridNode getActionableNode() {
+ AENetworkProxy gp = getProxy();
+ return gp != null ? gp.getNode() : null;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public AENetworkProxy getProxy() {
+ return mMetaTileEntity == null ? null : mMetaTileEntity.getProxy();
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public DimensionalCoord getLocation() { return new DimensionalCoord( this ); }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public void gridChanged() {
+ if (mMetaTileEntity != null)
+ mMetaTileEntity.gridChanged();
+ }
+
+ @TileEvent( TileEventType.WORLD_NBT_READ )
+ @Optional.Method(modid = "appliedenergistics2")
+ public void readFromNBT_AENetwork( final NBTTagCompound data )
+ {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ getProxy().readFromNBT( data );
+ }
+
+ @TileEvent( TileEventType.WORLD_NBT_WRITE )
+ @Optional.Method(modid = "appliedenergistics2")
+ public void writeToNBT_AENetwork( final NBTTagCompound data )
+ {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.writeToNBT( data );
+ }
+ @Optional.Method(modid = "appliedenergistics2")
+ void onChunkUnloadAE() {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.onChunkUnload();
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ void invalidateAE() {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.invalidate();
+ }
+}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index 9fa16b9890..31ec73d04b 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -130,6 +130,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
*/
public abstract boolean renderInside(byte aSide);
+ public boolean isDisplaySecondaryDescription() {
+ return false;
+ }
+
@Override
public IGregTechTileEntity getBaseMetaTileEntity() {
return mBaseMetaTileEntity;
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index d08a8d9da5..79447a96cb 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -1,5 +1,9 @@
package gregtech.api.metatileentity;
+import appeng.api.util.AECableType;
+import appeng.me.helpers.AENetworkProxy;
+import appeng.me.helpers.IGridProxyable;
+import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -95,6 +99,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
mName = aName;
}
+ /**
+ * This method will only be called on client side
+ * @return whether the secondary description should be display. default is false
+ */
+ public boolean isDisplaySecondaryDescription() {
+ return false;
+ }
+
@Override
public IGregTechTileEntity getBaseMetaTileEntity() {
return mBaseMetaTileEntity;
@@ -933,4 +945,19 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
}
public boolean shouldJoinIc2Enet() { return false; }
+
+ public boolean shouldTriggerBlockUpdate() { return false; }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public AECableType getCableConnectionType(ForgeDirection forgeDirection) {
+ return AECableType.NONE;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public AENetworkProxy getProxy() {
+ return null;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public void gridChanged() {}
}
diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
index 4d54a142cd..d0f3074af1 100644
--- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
+++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
@@ -44,7 +44,7 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null;
+ return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (mDisableFilter || GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64, aStack), false, null) != null);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index 2afc996df2..e472305a36 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -111,7 +111,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (aSide >= 0 && aSide < 6) {
for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i;
//Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate
- if (aSide == 5 || aSide == 2 || aSide == 0)
+ if (aSide == 5 || aSide == 2)
if (tMask > 3 && tMask < 12)
tMask = (byte) (tMask ^ 12);
}
@@ -675,4 +675,16 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb);
}
}
+ @Override
+ public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ if (aFluid == null)
+ return null;
+ for (int i = 0; i < mFluids.length; ++i) {
+ final FluidStack f = mFluids[i];
+ if (f == null || !f.isFluidEqual(aFluid))
+ continue;
+ return drainFromIndex(aFluid.amount, doDrain, i);
+ }
+ return null;
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
index c73e95e95b..6ed5a9edd0 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
@@ -38,6 +38,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
public int mTransferredItems = 0;
public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0;
public boolean mIsRestrictive = false;
+ private int[] cacheSides;
public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) {
super(aID, aName, aNameRegional, aInvSlotCount, false);
@@ -313,6 +314,19 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}
@Override
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity();
+ boolean tAllow = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity);
+ if (tAllow) {
+ if (cacheSides == null)
+ cacheSides = super.getAccessibleSlotsFromSide(aSide);
+ return cacheSides;
+ } else {
+ return new int[0];
+ }
+ }
+
+ @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return isConnectedAtSide(aSide);
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index 2c632c596b..fa653df16f 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -53,6 +54,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public final ItemStack[] mOutputItems;
public final int mInputSlotCount, mAmperage;
public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
+ public boolean mDisableFilter = true;
public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
public FluidStack mOutputFluid;
public String mGUIName, mNEIName;
@@ -418,6 +420,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
aNBT.setBoolean("mItemTransfer", mItemTransfer);
aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated);
aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide);
+ aNBT.setBoolean("mDisableFilter", mDisableFilter);
aNBT.setInteger("mEUt", mEUt);
aNBT.setInteger("mMainFacing", mMainFacing);
aNBT.setInteger("mProgresstime", mProgresstime);
@@ -437,6 +440,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mItemTransfer = aNBT.getBoolean("mItemTransfer");
mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated");
mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide");
+ mDisableFilter = aNBT.getBoolean("mDisableFilter");
mEUt = aNBT.getInteger("mEUt");
mMainFacing = aNBT.getInteger("mMainFacing");
mProgresstime = aNBT.getInteger("mProgresstime");
@@ -516,8 +520,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (tMaxStacks > mOutputItems.length)
tMaxStacks = mOutputItems.length;
- int tCost = moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks);
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCost, true);
+ moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks);
// for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
// tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
// if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
@@ -792,8 +795,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aSide == getBaseMetaTileEntity().getFrontFacing() || aSide == mMainFacing) {
- mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
- GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? trans("095","Input from Output Side allowed") : trans("096","Input from Output Side forbidden"));
+ if (aPlayer.isSneaking()){
+ mDisableFilter = !mDisableFilter;
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter." + mDisableFilter));
+ } else {
+ mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
+ GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? trans("095", "Input from Output Side allowed") : trans("096", "Input from Output Side forbidden"));
+ }
}
}
@@ -811,11 +819,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing()))
return false;
+ if (mDisableFilter) return true;
for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
return true;
}
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return true;
+ }
+
/**
* @return the Recipe List which is used for this Machine, this is a useful Default Handler
*/
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
index 17dbd560a2..147973b183 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
@@ -1,7 +1,11 @@
package gregtech.api.metatileentity.implementations;
import cpw.mods.fml.common.Loader;
-import gregtech.api.enums.*;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures;
+import gregtech.api.enums.Tier;
import gregtech.api.gui.GT_Container_BasicMachine;
import gregtech.api.gui.GT_GUIContainer_BasicMachine;
import gregtech.api.interfaces.ITexture;
@@ -22,7 +26,10 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.Locale;
import java.util.Random;
-import static gregtech.api.enums.GT_Values.*;
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.VN;
+import static gregtech.api.enums.GT_Values.W;
+import static gregtech.api.enums.GT_Values.ticksBetweenSounds;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -36,8 +43,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
private final String mSound;
private final boolean mSharedTank, mRequiresFluidForFiltering;
private final byte mGUIParameterA, mGUIParameterB;
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) {
- super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")));
+
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(
+ int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes,
+ int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe
+ ) {
+ super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName,
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")),
+ new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")));
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
this.mSpecialEffect = aSpecialEffect;
@@ -657,13 +677,22 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
throw new IllegalArgumentException("MISSING TIER MAPPING FOR: " + aRecipe[i] + " AT TIER " + mTier);
}
- if (!GT_ModHandler.addCraftingRecipe(getStackForm(1), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, aRecipe)) {
+ if (
+ !GT_ModHandler.addCraftingRecipe(
+ getStackForm(1),
+ GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, aRecipe
+ )
+ ) {
throw new IllegalArgumentException("INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName());
}
}
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(
+ String aName, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
+ int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, int aSpecialEffect
+ ) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
@@ -675,7 +704,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
this.mGUIParameterB = (byte) aGUIParameterB;
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(
+ String aName, int aTier, String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage,
+ int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank,
+ boolean aRequiresFluidForFiltering, int aSpecialEffect
+ ) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
@@ -689,7 +722,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_BasicMachine_GT_Recipe(this.mName, this.mTier, this.mDescriptionArray, this.mRecipes, this.mInputSlotCount, this.mOutputItems == null ? 0 : this.mOutputItems.length, this.mTankCapacity, this.mAmperage, this.mGUIParameterA, this.mGUIParameterB, this.mTextures, this.mGUIName, this.mNEIName, this.mSound, this.mSharedTank, this.mRequiresFluidForFiltering, this.mSpecialEffect);
+ return new GT_MetaTileEntity_BasicMachine_GT_Recipe(
+ this.mName, this.mTier, this.mDescriptionArray, this.mRecipes, this.mInputSlotCount, this.mOutputItems == null ? 0 : this.mOutputItems.length,
+ this.mTankCapacity, this.mAmperage, this.mGUIParameterA, this.mGUIParameterB, this.mTextures, this.mGUIName, this.mNEIName, this.mSound,
+ this.mSharedTank, this.mRequiresFluidForFiltering, this.mSpecialEffect
+ );
}
@Override
@@ -699,23 +736,54 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName, GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", this.mGUIParameterA, this.mGUIParameterB);
+ return new GT_GUIContainer_BasicMachine(
+ aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName,
+ GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "",
+ this.mGUIParameterA, this.mGUIParameterB
+ );
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false;
- if (this.mInventory[aIndex] != null) return true;
+ if (this.mInventory[aIndex] != null || mDisableFilter) return true;
switch (this.mInputSlotCount) {
case 0:
return false;
case 1:
- return this.getFillableStack() == null ? !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack) : null != this.getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier], new FluidStack[]{this.getFillableStack()}, this.getSpecialSlot(), new ItemStack[]{aStack});
+ if (this.getFillableStack() == null)
+ return !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack);
+ else
+ return this.getRecipeList().findRecipe(
+ this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier], new FluidStack[]{this.getFillableStack()},
+ this.getSpecialSlot(), new ItemStack[]{aStack}
+ ) != null;
case 2:
- return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0) != null && this.getInputAt(1) != null) || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList().containsInput(aStack) : (this.getRecipeList().containsInput(aStack) && null != this.getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier], new FluidStack[]{this.getFillableStack()}, this.getSpecialSlot(), aIndex == this.getInputSlot() ? new ItemStack[]{aStack, this.getInputAt(1)} : new ItemStack[]{this.getInputAt(0), aStack})))));
+
+ return (
+ !this.mRequiresFluidForFiltering || this.getFillableStack() != null) &&
+ (
+ (
+ (this.getInputAt(0) != null && this.getInputAt(1) != null) ||
+ (
+ this.getInputAt(0) == null && this.getInputAt(1) == null ?
+ this.getRecipeList().containsInput(aStack) :
+ (
+ this.getRecipeList().containsInput(aStack) &&
+ this.getRecipeList().findRecipe(
+ this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier],
+ new FluidStack[]{this.getFillableStack()},
+ this.getSpecialSlot(), aIndex == this.getInputSlot() ?
+ new ItemStack[]{aStack, this.getInputAt(1)} :
+ new ItemStack[]{this.getInputAt(0), aStack}
+ ) != null
+ )
+ )
+ )
+ );
default:{
int tID = this.getBaseMetaTileEntity().getMetaTileID();
- if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) {//assembler lv-iv; circuit asseblers lv - uv; assemblers luv-uev
+ if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) { //assembler lv-iv; circuit asseblers lv - uv; assemblers luv-uev
if (GT_Utility.isStackValid(aStack))
for (int oreID : OreDictionary.getOreIDs(aStack)) {
if (OreDictionary.getOreName(oreID).contains("circuit"))
@@ -739,7 +807,11 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 1:
if (aBaseMetaTileEntity.getFrontFacing() != 1 && aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0 && !aBaseMetaTileEntity.getOpacityAtSide((byte) 1)) {
Random tRandom = aBaseMetaTileEntity.getWorld().rand;
- aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F, 0.0D, 0.0D, 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle(
+ "smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F,
+ aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F,
+ aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F, 0.0D, 0.0D, 0.0D
+ );
}
break;
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index 8758ea1a02..7c57076ae9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -97,10 +97,10 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
break;
case WEST:
switch (side) {
- case DOWN:
case UP:
case SOUTH:
return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT
+ case DOWN:
case NORTH:
return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT
default:
@@ -108,10 +108,10 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
break;
case EAST:
switch (side) {
- case DOWN:
case UP:
case SOUTH:
return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT
+ case DOWN:
case NORTH:
return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT
default:
@@ -248,7 +248,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
+ if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {
mSuccess--;
moveItems(aBaseMetaTileEntity, aTimer);
for(byte b = 0;b<6;b++)
@@ -261,7 +261,6 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
if (mInventory[i] == null) {
for(byte b = 0;b<6;b++)
aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b,bInvert ? (byte)15 : (byte)0);
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(1, true);
break;
}
}
@@ -284,7 +283,6 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
index b3998b62e7..1e5c86108b 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
@@ -35,8 +35,8 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length);
desc[mDescriptionArray.length] = "DO NOT OBSTRUCT THE OUTPUT!";
desc[mDescriptionArray.length + 1] = "Reduces Pollution to " + calculatePollutionReduction(100) + "%";
- //Pollution Recovery scales from 5% at LV to 100% at MAX Voltage
- desc[mDescriptionArray.length + 2] = "Recovers " + (105 - calculatePollutionReduction(100)) + "% of CO2/CO/SO2";
+ //Pollution Recovery scales from 0% at LV to 100% at UHV Voltage
+ desc[mDescriptionArray.length + 2] = "Recovers " + (100 - calculatePollutionReduction(100)) + "% of CO2/CO/SO2";
return desc;
}
@@ -97,7 +97,9 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
public int calculatePollutionReduction(int aPollution) {
- return (int) (aPollution * (Math.pow(0.85F, mTier - 1)));
+ if ((float) mTier < 2)
+ return aPollution;
+ return (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F));
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
index 1dafbcce5a..aaa0dc9df5 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
@@ -20,6 +20,10 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch {
"Capacity: " + getSlots(aTier) + " stack" + (getSlots(aTier) >= 2 ? "s" : "")});
}
+ public GT_MetaTileEntity_Hatch_OutputBus(int aID, String aName, String aNameRegional, int aTier, String[] aDescription) {
+ super(aID, aName, aNameRegional, aTier, getSlots(aTier), aDescription);
+ }
+
public GT_MetaTileEntity_Hatch_OutputBus(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription, aTextures);
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 202e542c88..6f211631f2 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -16,6 +16,8 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -23,6 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
+import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
@@ -34,21 +37,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public static boolean disableMaintenance;
public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false;
public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0;
- public volatile int mUpdate = 0;
+ public volatile int mUpdate = 0; //TODO: Replace with AtomicInteger
public ItemStack[] mOutputItems = null;
public FluidStack[] mOutputFluids = null;
public String mNEI;
public int damageFactorLow = 5;
public float damageFactorHigh = 0.6f;
- public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>();
- public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>();
- public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>();
- public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>();
- public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>();
- public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>();
- public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>();
- public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>();
public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 2);
@@ -70,6 +73,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
@Override
+ public boolean isDisplaySecondaryDescription() {
+ return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
+ }
+
+ @Override
public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
return aSide != getBaseMetaTileEntity().getFrontFacing();
}
@@ -727,11 +735,25 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public boolean addOutput(ItemStack aStack) {
if (GT_Utility.isStackInvalid(aStack)) return false;
aStack = GT_Utility.copy(aStack);
-// FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true);
-// if (aLiquid == null) {
boolean outputSuccess = true;
while (outputSuccess && aStack.stackSize > 0) {
outputSuccess = false;
+
+ if (GregTech_API.mAE2) {
+ // this separate cycle may be refactored out, after this function will hopefully be totally refactored
+ // for now it is here to avoid splitting stack when we have ME output bus
+ for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
+ // TODO: If ever there will be another hatch storing in some external storage, here should be an interface check
+ if (tHatch instanceof GT_MetaTileEntity_Hatch_OutputBus_ME && isValidMetaTileEntity(tHatch)) {
+ int rest = ((GT_MetaTileEntity_Hatch_OutputBus_ME) tHatch).store(aStack);
+ if (rest != aStack.stackSize)
+ outputSuccess = true;
+ aStack.stackSize = rest;
+ if (rest == 0)
+ return true;
+ }
+ }
+ }
ItemStack single = aStack.splitStack(1);
for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
if (!outputSuccess && isValidMetaTileEntity(tHatch)) {
@@ -746,16 +768,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
}
}
-// }else {
-// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
-// if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) {
-// int tAmount = tHatch.fill(aLiquid, false);
-// if (tAmount >= aLiquid.amount) {
-// return tHatch.fill(aLiquid, true) >= aLiquid.amount;
-// }
-// }
-// }
-// }
return outputSuccess;
}
@@ -791,7 +803,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<ItemStack> getStoredOutputs() {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> rList = new ArrayList<>();
// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
// if (isValidMetaTileEntity(tHatch)) {
// rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
@@ -808,7 +820,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<FluidStack> getStoredFluids() {
- ArrayList<FluidStack> rList = new ArrayList<FluidStack>();
+ ArrayList<FluidStack> rList = new ArrayList<>();
for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
@@ -819,7 +831,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public ArrayList<ItemStack> getStoredInputs() {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ ArrayList<ItemStack> rList = new ArrayList<>();
// for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
// tHatch.mRecipeMap = getRecipeMap();
// if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) {
@@ -1003,4 +1015,47 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
+
+ protected ItemStack[] getCompactedInputs(){
+ //TODO: repalce method with a cleaner one
+ ArrayList<ItemStack> tInputList = getStoredInputs();
+ int tInputList_sS = tInputList.size();
+ for (int i = 0; i < tInputList_sS - 1; i++) {
+ for (int j = i + 1; j < tInputList_sS; j++) {
+ if (!GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j)))
+ continue;
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ tInputList_sS = tInputList.size();
+ } else {
+ tInputList.remove(i--);
+ tInputList_sS = tInputList.size();
+ break;
+ }
+ }
+ }
+ return tInputList.toArray(new ItemStack[0]);
+ }
+
+ protected FluidStack[] getCompactedFluids(){
+ //TODO: repalce method with a cleaner one
+ ArrayList<FluidStack> tFluidList = getStoredFluids();
+ int tFluidList_sS = tFluidList.size();
+ for (int i = 0; i < tFluidList_sS - 1; i++) {
+ for (int j = i + 1; j < tFluidList_sS; j++) {
+ if (!GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j)))
+ continue;
+
+ if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
+ tFluidList.remove(j--);
+ tFluidList_sS = tFluidList.size();
+ } else {
+ tFluidList.remove(i--);
+ tFluidList_sS = tFluidList.size();
+ break;
+ }
+ }
+ }
+ return tFluidList.toArray(new FluidStack[0]);
+ }
}