aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/CodeChickenLib.cfg2
-rw-r--r--config/IC2.ini2
-rw-r--r--config/splash.properties2
-rw-r--r--options.txt2
-rw-r--r--src/main/java/tileentities/TE_TFFTMultiHatch.java80
5 files changed, 84 insertions, 4 deletions
diff --git a/config/CodeChickenLib.cfg b/config/CodeChickenLib.cfg
index 096dec5432..94d4c170a5 100644
--- a/config/CodeChickenLib.cfg
+++ b/config/CodeChickenLib.cfg
@@ -3,6 +3,6 @@
dump_asm=true
#Path to directory holding packaged.srg, fields.csv and methods.csv for mcp remapping
-mappingDir=C:\Users\kekzd\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1614-1.7.10\unpacked\conf
+mappingDir=C:\Users\Kekzdealer\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1614-1.7.10\unpacked\conf
textify=true
diff --git a/config/IC2.ini b/config/IC2.ini
index 859e45e7f7..b697f12fba 100644
--- a/config/IC2.ini
+++ b/config/IC2.ini
@@ -1,5 +1,5 @@
; ic2 general config
-; created 10-Mar-2020 20:15:10
+; created Mar 29, 2020 9:14:07 PM
;---
[worldgen]
diff --git a/config/splash.properties b/config/splash.properties
index 7f5845bd66..8e6a55cf2e 100644
--- a/config/splash.properties
+++ b/config/splash.properties
@@ -1,5 +1,5 @@
#Splash screen properties
-#Tue Mar 10 20:14:59 CET 2020
+#Sun Mar 29 21:13:56 CEST 2020
logoTexture=textures/gui/title/mojang.png
background=0xFFFFFF
font=0x0
diff --git a/options.txt b/options.txt
index 52068ec4d9..f087516d51 100644
--- a/options.txt
+++ b/options.txt
@@ -1,6 +1,6 @@
invertYMouse:false
mouseSensitivity:0.5
-fov:0.125
+fov:0.0
gamma:0.18309858
saturation:0.0
renderDistance:6
diff --git a/src/main/java/tileentities/TE_TFFTMultiHatch.java b/src/main/java/tileentities/TE_TFFTMultiHatch.java
index 94d7d9283a..1f92f924c4 100644
--- a/src/main/java/tileentities/TE_TFFTMultiHatch.java
+++ b/src/main/java/tileentities/TE_TFFTMultiHatch.java
@@ -2,7 +2,13 @@ package tileentities;
import java.util.List;
+import blocks.Block_TFFTStorageFieldBlockT1;
+import blocks.Block_TFFTStorageFieldBlockT2;
+import blocks.Block_TFFTStorageFieldBlockT3;
+import blocks.Block_TFFTStorageFieldBlockT4;
+import blocks.Block_TFFTStorageFieldBlockT5;
import kekztech.MultiFluidHandler;
+import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@@ -13,13 +19,87 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler {
+ private static final int OUTPUT_SPEED = 100; // L/s
+
private MultiFluidHandler mfh;
+ private int tickCounter = 0;
public void setMultiFluidHandler(MultiFluidHandler mfh) {
+ System.out.println("Set MFH");
this.mfh = mfh;
}
@Override
+ public void updateEntity() {
+ tickCounter++;
+ if(tickCounter == 100 && mfh != null) {
+
+ final ForgeDirection d = getOutwardsFacingDirection();
+ if(d == ForgeDirection.UNKNOWN) {
+ return;
+ }
+ final TileEntity t = this.getWorldObj().getTileEntity(
+ this.xCoord + d.offsetX,
+ this.yCoord + d.offsetY,
+ this.zCoord + d.offsetZ);
+
+ if(t != null && t instanceof IFluidHandler) {
+
+ final IFluidHandler fh = (IFluidHandler) t;
+
+ System.out.println("Found connecting tank");
+
+ // Cycle through fluids
+ for(FluidStack volume : mfh.getFluids()) {
+
+ // 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);
+
+ 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);
+
+ // Actually deplete storage
+ mfh.pullFluid(copy, true);
+ }
+ }
+ }
+
+ tickCounter = 0;
+ }
+ }
+
+ private ForgeDirection getOutwardsFacingDirection() {
+ // TODO Revisit this once the hatch has a facing side
+ // Look up which side has the storage field block and choose the other side.
+ // This is important so the tank doesn't output into itself in case
+ // there is another hatch next to this one.
+ for(ForgeDirection direction : ForgeDirection.values()) {
+
+ final Block b = this.getWorldObj().getBlock(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ);
+ if(b != null && (
+ b.equals(Block_TFFTStorageFieldBlockT1.getInstance())
+ || b.equals(Block_TFFTStorageFieldBlockT2.getInstance())
+ || b.equals(Block_TFFTStorageFieldBlockT3.getInstance())
+ || b.equals(Block_TFFTStorageFieldBlockT4.getInstance())
+ || b.equals(Block_TFFTStorageFieldBlockT5.getInstance()))) {
+ return direction.getOpposite();
+ }
+ }
+ return ForgeDirection.UNKNOWN;
+ }
+
+ @Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return (mfh != null) ? mfh.pushFluid(resource, doFill) : 0;
}