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

Fix water bottle filling not working in the end dimension #4327

Merged

Conversation

TheRealWormbo
Copy link
Collaborator

Fix for #4273. Botania's logic for creating ender air bottles is skipped if the player aims at water.
(Grabbing fluids from blocks, e.g. getting honey bottles from full bee nests, was not affected.)

BlockHitResult hitResult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.SOURCE_ONLY);
if (hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = hitResult.getBlockPos();
return world.mayInteract(player, pos) && !world.getFluidState(pos).is(FluidTags.WATER);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this mayInteract here? Pretty sure mc internals already do this check before calling any item specific stuff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BottleItem also does a mayInteract check first. I believe the "global" mayInteract check applies to the player's location, while this one here applies to the block the bottle is potentially being used on.
The situation this covers is as follows: The player stands in an unprotected area, but aims at a water block in a protected area. The question is, should that mean the player can't use the bottle at all (without the mayInteract call) or should it fall back to picking up air from the end (with the call).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, is this meant to only check for water or absence of any fluid? the logic doesn't match the method name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was supposed to be water (covering the vanilla glass bottle logic), but the bug report mentioned fluids in general. Which way do you prefer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to check for absolutely any fluids (even flowing ones) for maximum compatibility. You need to use the bottle in the air or against some block now.

@TheRealWormbo
Copy link
Collaborator Author

Just wondering, that Discord discussion about potentially using empty managlass vials or even alfglass flasks (or either?) for bottling ender air instead of using regular empty bottles – is that something you folks would want something prototyped for?

@TheRealWormbo TheRealWormbo force-pushed the 1.19.x-ender-air-bottling-fix branch 2 times, most recently from cf8244f to 09bc3f5 Compare May 20, 2023 20:32
@TheRealWormbo TheRealWormbo force-pushed the 1.19.x-ender-air-bottling-fix branch from 09bc3f5 to 181d69c Compare May 29, 2023 07:09
While in the End, don't attempt to pick up ender air while looking at fluids. This more generic approach will disallow ender air bottling while looking at lava, even if attempting to use a bottle this way wouldn't do anything by default, but it's less likely to cause issues with other mods that attempt to bottle fluids from the world.
@TheRealWormbo TheRealWormbo force-pushed the 1.19.x-ender-air-bottling-fix branch from 181d69c to 84fddef Compare May 29, 2023 17:04
@williewillus williewillus merged commit 92f78d7 into VazkiiMods:1.19.x May 29, 2023
@TheRealWormbo TheRealWormbo deleted the 1.19.x-ender-air-bottling-fix branch May 29, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants