Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JamesLaverack opened this issue Dec 17, 2023 · 0 comments · May be fixed by #7054
Open

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

JamesLaverack opened this issue Dec 17, 2023 · 0 comments · May be fixed by #7054
Assignees
Labels
type: bug Issue where something isn't working

Comments

@JamesLaverack
Copy link

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.

@JamesLaverack JamesLaverack added the type: bug Issue where something isn't working label Dec 17, 2023
@IThundxr IThundxr self-assigned this Oct 8, 2024
IThundxr added a commit to IThundxr/Create that referenced this issue Oct 11, 2024
IThundxr added a commit to IThundxr/Create that referenced this issue Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issue where something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants