mojira.dev
MC-249250

Splash and lingering water bottles can be used to create mud

Splash/lingering water bottles can be used to create mud from dirt when right clicking with them on dirt. If done in survival mode, you get an empty bottle back, which does not seem to be consistent, with the general game mechanics regarding bottles and splash potions. To recreate, just open any world in 22w11a, give yourself a splash or lingering water bottle, and try right clicking dirt in survival mode.

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 5

Can confirm in 22w16b.

Code analysis (Mojang mappings, 22w18a): In PotionItem#useOn(...):

Level $$1 = $$0.getLevel();
        BlockPos $$2 = $$0.getClickedPos();
        Player $$3 = $$0.getPlayer();
        ItemStack $$4 = $$0.getItemInHand();
        BlockState $$5 = $$1.getBlockState($$2);
        if ($$0.getClickedFace() != Direction.DOWN && $$5.is(BlockTags.CONVERTABLE_TO_MUD) && PotionUtils.getPotion($$4) == Potions.WATER) {
            // converting code
            ...
        }
        return InteractionResult.PASS;

The conditional does not check if the potion is throwable. As ThrowablePotionItem extends PotionItem, this same logic is used for those items as well, and thus throwable potions (i.e. lingering and splash potions) can convert blocks to mud. Fix is to either check if the potion is not throwable or to override this method with a method that always returns InteractionResult.PASS in ThrowablePotionItem.

Can confirm in 1.19.

Can confirm in 1.19.

Sebastian Grau

(Unassigned)

Confirmed

Gameplay

Low

Items

22w11a, 22w16b, 22w18a, 22w19a, 1.19 Pre-release 1, ..., 1.21, 1.21.8 Release Candidate 1, 1.21.8, 25w33a, 25w34b

Retrieved