Create

Create

86M Downloads

Unable to pump fluid source blocks into flowing fluids of the same type

JamesLaverack opened this issue · 0 comments

commented

Describe the Bug

When pumping fluids out of empty pipes, the usual behaviour is to place a source block of that fluid in the space infront of the open end of the pipe — if the space is empty. If a the target block instead has a flowing fluid of the same type, then the pipe will not place a source block.

Reproduction Steps

With water, but the same is true for any fluid:

  1. Construct a pump, drawing from a water source (water source block, fluid tank with water, etc)
  2. Place water such that the block infront of the pump's output is flowing water.
  3. Power the pump

Expected Result

The flowing fluid in the space infront of the pump is replaced with a fluid source block.

Screenshots and Videos

A screenshot of the test setup for water:
image
Same for lava:
image
Same for honey:
image

Crash Report or Log

N/A

Operating System

macOS

Mod Version

0.5.1f

Minecraft Version

1.20.1

Forge Version

NeoForge 47.1.83

Other Mods

None.

Additional Context

Having searched through the code, I believe this is because of the fluid collision check.

In the method provideFluidToSpace, Create gets both the fluid of the pipe (as the local variable fluid) and the "fluid state" of the target block (as fluidState). One of the checks done is to decide if two different fluids are "colliding", and call the fluid collision behaviour if so:

		if (!fluidState.isEmpty() && fluidState.getType() != fluid.getFluid()) {
			FluidReactions.handlePipeSpillCollision(world, outputPos, fluid.getFluid(), fluidState);
			return false;
		}

The issue is that "water" and "flowing water" are two different fluids. So when fluid.getFluid() (i.e., the fluid in the pipe) is "water" and fluidState.getType() is "flowing water", this check considers them to be different and calls out to the handlePipeSpillCollision. That method has no handling code for water interacting with flowing water, so nothing happens.

(Interestingly something different happens for Milk, as there is a special case for milk before we get to this check. But the end result there is that the milk is drained from the pipe but a source block isn't placed.)

One possible solution is to repalce this check with:

		if (!fluidState.isEmpty() && FluidHelper.convertToStill(fluidState.getType()) != fluid.getFluid()) {

Here the existing convertToStill method is used to consider only the still variant of the fluid in the output block. I tested this in the Fabric version of Create (as that's where I found this), but I think the code is the same in both Forge and Fabric versions.