LD Fluid Pipe doesn't work in some cases
ConstasJ opened this issue ยท 6 comments
Checked for existing issues
- I have checked for existing issues, and have found none.
Tested latest version
- I have checked that this occurs on the latest version.
GregTech CEu Version
v1.2.3.a
Recipe Viewer Installed
None
Environment
Dedicated Server
Cross-Mod Interaction
Unsure
Other Installed Mods
AE2, Mekanism, Botania, Thermal Series, Immersive Engineering, Railcraft Reborn, Ender IO
Expected Behavior
Expect to normally transfer fluids from the input interface to output interface
Actual Behavior
Nothing happened.
Steps to Reproduce
- Build a LD fluid pipe with complicated shape.
- Then put some fluid into input side.
- You'll find nothing out from output side.
Additional Information
When there is no complicated shape for pipe, like only a straight line, it works normally.
I've tested more, and find that it often not work, even in a straight line.
How long are the LD Fluid pipelines you are making, can you attach some example screenshots?
There's a minimum amount of casing blocks that need to be between the input and output which is why I ask
For reference, here is some information I was able to gather from testing and looking at code:
Number of pipes includes endpoints.
It correctly gets the number of pipes + inputs if endpoints face in or out.
Removing pipe blocks does not properly update the network.
If you remove a pipe in a connected network and replace it, the network is broken on both endpoints (no network found). Replacing an endpoint at that point makes it unable to connect to the existing endpoint, finding only the pipes. Replacing both endpoints makes it work again.
Rotating an endpoint back and forth has the same effect as breaking and replacing it.
Having weird shapes in the pipeline doesn't matter, it's robust against that. Some extra pipelines that go nowhere is fine too (at least sometimes) when it goes nowhere and you can break them without breaking the link.
Resetting both endpoints always makes it work again.
Pumping only works when AND the network is connected (of course) AND the pipes face in the same direction.
Below code is from MetaMachineBlockEntity
} else if (cap == ForgeCapabilities.FLUID_HANDLER) {
if (machine instanceof LDFluidEndpointMachine fluidEndpointMachine) {
if (machine.getLevel().isClientSide) return null;
ILDEndpoint endpoint = fluidEndpointMachine.getLink();
if (endpoint == null) return null;
Direction outputFacing = fluidEndpointMachine.getOutputFacing();
IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(machine.getLevel(),
endpoint.getPos().relative(outputFacing), outputFacing.getOpposite());
if (transfer != null) {
return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, LazyOptional.of(() -> FluidTransferHelperImpl
.toFluidHandler(new LDFluidEndpointMachine.FluidHandlerWrapper(transfer))));
}
}
When removing a fluid pipeline:
destroy
(in PipeBlock) -> LongDistanceNetwork.onRemovePipe -> sees neighbors are in same network, recalculateNetwork for those neighbors, which invalidates the entire network (removing any trace) and starts a NetworkBuilder from the two neighbor positions
NetworkBuilder happens on a new thread, but getBlockEntity does not work on a different thread, so it cannot find the endpoint as a network part. However, trying to fix only that is not enough, it still sometimes gets into a corrupted state.
fixed as of #2246