diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java | 4 | ||||
-rw-r--r-- | src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java | 33 |
2 files changed, 24 insertions, 13 deletions
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 d462e8adb9..1122f6f906 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 @@ -20,6 +20,8 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM private static final int ARROW_UP_INDEX = 4; private static final int FRONT_INDEX = 5; + public int maxStackSize = 64; + public static int MAX = 8; public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false, bSortStacks = false; public int mSuccess = 0, mTargetStackSize = 0; @@ -242,7 +244,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM if (aSide == getBaseMetaTileEntity().getBackFacing()) { mTargetStackSize = (byte) ((mTargetStackSize + (aPlayer.isSneaking()? -1 : 1)) % 65); - if(mTargetStackSize <0){mTargetStackSize = 64;} + if(mTargetStackSize <0){mTargetStackSize = maxStackSize;} if (mTargetStackSize == 0) { GT_Utility.sendChatToPlayer(aPlayer, trans("098","Do not regulate Item Stack Size")); } else { diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index 73a8fac252..e07d9d0536 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -18,7 +18,9 @@ import java.util.Arrays; import java.util.Comparator; public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { - private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1}; + + private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1}; + private static final int[] maxStacks = { 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 64, 128}; public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) { @@ -60,17 +62,19 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aTimer % tickRate[mTier] > 0) return; - if(aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - // mSuccess will be negative if the call is caused by the %200 aTimer, always try to push. Otherwise it will be positive. - // For the first 6 ticks after a successful move (49->44), push every tick. Then go to every 5 ticks. - if ( (mSuccess <= 0 ) || (mSuccess > 43) || ((mSuccess % 5) == 0 )){ - super.moveItems(aBaseMetaTileEntity, aTimer); - } + for (int i = 0; i < MAX; i++ ){ + if(aBaseMetaTileEntity.hasInventoryBeenModified()) { + fillStacksIntoFirstSlots(); + } + // mSuccess will be negative if the call is caused by the %200 aTimer, always try to push. Otherwise it will be positive. + // For the first 6 ticks after a successful move (49->44), push every tick. Then go to every 5 ticks. + if ( (mSuccess <= 0 ) || (mSuccess > 43) || ((mSuccess % 5) == 0 )){ + super.moveItems(aBaseMetaTileEntity, aTimer); + } - if(mSuccess < 0) { - mSuccess = 0; + if(mSuccess < 0) { + mSuccess = 0; + } } } @@ -141,7 +145,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { int tickRate = getTickRate(tier); String s = ""; if (tickRate < 20) - s = "1/" + 20/tickRate + " "; + s = maxStacks[tier] + "/" + 20/tickRate + " "; else if (tickRate > 20) { s = (tickRate / 20) + "th "; } @@ -153,4 +157,9 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { return 1; return tickRate[tier]; } + + protected static int getMaxStacks(int tier) { + // Included higher tiers on the off chance they actually work without blowing things up lmao + return tier > 9 ? MAX : Math.min(maxStacks[tier], MAX); + } } |