Open eve0415 opened 3 years ago
Looking at the code, the fluid in the pipes is never persisted.
This is a simple patch that fixes the immediate problem, by storing the FluidNetTank in the world saved data:
'''
diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
old mode 100644
new mode 100755
index db8cb1be..e70d8955
--- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
+++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
@@ -154,4 +154,19 @@ public class FluidPipeNet extends MonolithicPipeNet
} '''
This fixes the immediate problem for single player and on the server.
But the client will always see the wrong amounts in the pipes since there is no mechanism to synchronize the FluidNetTank between the server and client.
If the client has TOP like in the above image, they will still see an empty pipe after relogging or unloading chunks, etc. But connecting it to a tank will magically make the missing fluid reappear when the tank is filled on the server and resyncs with the client.
This is still better than what happens now, which is the fluid disappearing into the void when restarting single player or the server.
Better formatted patch?
diff --git a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
old mode 100644
new mode 100755
index db8cb1be..e70d8955
--- a/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
+++ b/src/main/java/gregtech/common/pipelike/fluidpipe/net/FluidPipeNet.java
@@ -154,4 +154,19 @@ public class FluidPipeNet extends MonolithicPipeNet<FluidPipeProperties> {
return new FluidPipeProperties(maxTemperature, throughput, gasProof);
}
+ @Override
+ public NBTTagCompound serializeNBT() {
+ final NBTTagCompound nbt = super.serializeNBT();
+ nbt.setTag("FluidNetTank", this.fluidNetTank.writeToNBT(new NBTTagCompound()));
+ return nbt;
+ }
+
+ @Override
+ public void deserializeNBT(final NBTTagCompound nbt) {
+ super.deserializeNBT(nbt);
+ final NBTTagCompound tankData = nbt.getCompoundTag("FluidNetTank");
+ if (tankData != null)
+ this.fluidNetTank.readFromNBT(tankData);
+ }
+
}
Accepted based on provided information and current code.
@warjort Seems like you already try fixing it. Why don't you create PR with provided code?
PR seems like a lot of work for a 10 line fix?
Describe the bug When the server restarted / reloading the world or chunk, the pipe buffer gets empty.
This make it hard for people like me when you are using steam boiler, with two pipes (In: water from pump, Out: steam) When I reload the world (entering the game), the pipe buffer get empty resulting back-flow of steam where it should be water.
Versions Forge: forge-14.23.5.2854 GTCE: Modpack: ArchitPack Greg Modified:
GTCE Bees
&Greg's Construct
&Shadows of Greg
.GregTech Community Edition
>ce2oc
to the latest version.Setup Played both, multiplayer and solo.
Steps To Reproduce 1) Place some pipes. 2) Input something (steam, water, can be anything I hope). 3) Remove the source of input (just make the pipe alone with full of liquid). 4) Re-enter the world (solo) or restart the server. 5) See empty pipes which was full before re-entering.
Expected behavior The pipe's buffer should not be empty when reloading the chunks/world.
Screenshots Before: After: