aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristina Berchtold <kekzdealer@gmail.com>2020-04-24 00:36:40 +0200
committerChristina Berchtold <kekzdealer@gmail.com>2020-04-24 00:36:40 +0200
commit1edc79e2b1f38c58bb8f978131acb8a83f8dbb63 (patch)
treec9b7b7895d73dab817155a172f686261b60059c2
parentd48674f9c4243fe4439999e59c798a13113f3037 (diff)
downloadGT5-Unofficial-1edc79e2b1f38c58bb8f978131acb8a83f8dbb63.tar.gz
GT5-Unofficial-1edc79e2b1f38c58bb8f978131acb8a83f8dbb63.tar.bz2
GT5-Unofficial-1edc79e2b1f38c58bb8f978131acb8a83f8dbb63.zip
Multi Hatch now pushes 1000L/s for each fluid into adjacent tanks
-rw-r--r--config/IC2.ini2
-rw-r--r--config/splash.properties2
-rw-r--r--src/main/java/tileentities/TE_TFFTMultiHatch.java33
3 files changed, 22 insertions, 15 deletions
diff --git a/config/IC2.ini b/config/IC2.ini
index 7849244d49..09e8de7425 100644
--- a/config/IC2.ini
+++ b/config/IC2.ini
@@ -1,5 +1,5 @@
; ic2 general config
-; created Apr 23, 2020 8:50:49 PM
+; created Apr 24, 2020 12:34:11 AM
;---
[worldgen]
diff --git a/config/splash.properties b/config/splash.properties
index 2e2172118a..419cbf36d7 100644
--- a/config/splash.properties
+++ b/config/splash.properties
@@ -1,5 +1,5 @@
#Splash screen properties
-#Thu Apr 23 20:50:25 CEST 2020
+#Fri Apr 24 00:33:58 CEST 2020
logoTexture=textures/gui/title/mojang.png
background=0xFFFFFF
font=0x0
diff --git a/src/main/java/tileentities/TE_TFFTMultiHatch.java b/src/main/java/tileentities/TE_TFFTMultiHatch.java
index 5e652b3cd8..358f02e4a8 100644
--- a/src/main/java/tileentities/TE_TFFTMultiHatch.java
+++ b/src/main/java/tileentities/TE_TFFTMultiHatch.java
@@ -1,5 +1,6 @@
package tileentities;
+import java.util.Iterator;
import java.util.List;
import blocks.Block_TFFTStorageFieldBlockT1;
@@ -19,7 +20,7 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler {
- private static final int OUTPUT_SPEED = 1000; // L/s
+ private static final int OUTPUT_PER_SECOND = 1000; // L/s
private MultiFluidHandler mfh;
private int tickCounter = 0;
@@ -32,7 +33,7 @@ public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler {
@Override
public void updateEntity() {
tickCounter++;
- if(tickCounter == 100 && mfh != null) {
+ if(tickCounter >= 20 && mfh != null) {
final ForgeDirection d = getOutwardsFacingDirection();
if(d == ForgeDirection.UNKNOWN) {
@@ -47,30 +48,34 @@ public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler {
final IFluidHandler fh = (IFluidHandler) t;
- System.out.println("Found connecting tank");
-
// Cycle through fluids
- for(FluidStack volume : mfh.getFluids()) {
+ final Iterator<FluidStack> volumes = mfh.getFluids().iterator();
+ while(volumes.hasNext()) {
+ final FluidStack volume = volumes.next();
+
+ // Remember for later
+ final int oVolume = volume.amount;
// Use API methods
if(fh.canFill(d.getOpposite(), volume.getFluid())) {
- System.out.println("Can fill " + volume.getLocalizedName());
// Test how much can be output
final FluidStack copy = volume.copy();
- copy.amount = Math.min(volume.amount, OUTPUT_SPEED);
+ copy.amount = Math.min(copy.amount, OUTPUT_PER_SECOND);
final int drawn = mfh.pullFluid(copy, false);
copy.amount = drawn;
- System.out.println("Can output " + copy.amount + "L of" + copy.getLocalizedName());
-
// Test how much can be filled (and fill if possible)
- final int filled = fh.fill(d.getOpposite(), copy, true);
- copy.amount = Math.min(drawn, filled);
-
+ copy.amount = fh.fill(d.getOpposite(), copy, true);
+
// Actually deplete storage
mfh.pullFluid(copy, true);
+
+ // Prevent ConcurrentModificationException
+ if(copy.amount >= oVolume) {
+ break;
+ }
}
}
}
@@ -110,7 +115,9 @@ public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler {
}
/**
- * Drains fluid out of 0th internal tank.
+ * Drains fluid out of 0th internal tank.
+ * If the TFFT Controller contains an Integrated Circuit, drain fluid
+ * from the slot equal to the circuit configuration.
*
* @param from
* Orientation the fluid is drained to.