aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorcharles <johnch18@isu.edu>2021-04-03 10:52:56 -0600
committercharles <johnch18@isu.edu>2021-04-03 10:52:56 -0600
commit3440f44467a0708a7f4428d7ba9cd9ee2f08bb24 (patch)
tree6c4dc7ef5ec9f55657519b639350b96dc4a8a3a2 /src/main
parent5132a027068d9a9e7eb1e7c0f3d2080288f1a918 (diff)
downloadGT5-Unofficial-3440f44467a0708a7f4428d7ba9cd9ee2f08bb24.tar.gz
GT5-Unofficial-3440f44467a0708a7f4428d7ba9cd9ee2f08bb24.tar.bz2
GT5-Unofficial-3440f44467a0708a7f4428d7ba9cd9ee2f08bb24.zip
Made it so that higher tier buffers try to move multiple stacks/tick
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java1
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java33
2 files changed, 22 insertions, 12 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 50611bca63..21c6bff512 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
@@ -21,6 +21,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
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;
public int mSuccess = 0, mTargetStackSize = 0;
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);
+ }
}