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
is duplicated by 1
relates to 2
Attachments
Comments 5
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.