mojira.dev
MC-170089

You cannot create a path block underwater

You can't create a path block underwater with any block that you can make a path block out of.

Code analysis

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

Attachments

Comments 8

I can confirm for 1.16.4pr-1

Can confirm in 20w51a, however, this seems intentional.

Can confirm in 21w11a.

Can confirm in 1.17.

Can confirm in 1.17.1.

I can confirm this behavior in 1.18.

Here's a code analysis of this issue. The following is based on a decompiled version of Minecraft 1.18 using MCP-Reborn. Please note that I'm quite tentative about this analysis, although I'm persuaded to believe that this is likely the cause of the problem. 🙂

Code Analysis (tentative):

net.minecraft.world.item.ShovelItem.java

public class ShovelItem extends DiggerItem {
   protected static final Map<Block, BlockState> FLATTENABLES = Maps.newHashMap((new Builder()).put(Blocks.GRASS_BLOCK, Blocks.DIRT_PATH.defaultBlockState()).put(Blocks.DIRT, Blocks.DIRT_PATH.defaultBlockState()).put(Blocks.PODZOL, Blocks.DIRT_PATH.defaultBlockState()).put(Blocks.COARSE_DIRT, Blocks.DIRT_PATH.defaultBlockState()).put(Blocks.MYCELIUM, Blocks.DIRT_PATH.defaultBlockState()).put(Blocks.ROOTED_DIRT, Blocks.DIRT_PATH.defaultBlockState()).build());
   ...
   public InteractionResult useOn(UseOnContext $$0) {
      Level level = $$0.getLevel();
      BlockPos blockpos = $$0.getClickedPos();
      BlockState blockstate = level.getBlockState(blockpos);
      if ($$0.getClickedFace() == Direction.DOWN) {
         return InteractionResult.PASS;
      } else {
         Player player = $$0.getPlayer();
         BlockState blockstate1 = FLATTENABLES.get(blockstate.getBlock());
         BlockState blockstate2 = null;
         if (blockstate1 != null && level.getBlockState(blockpos.above()).isAir()) {
            level.playSound(player, blockpos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
            ...

If we look at the above class, we can see that you can only convert blocks into dirt paths using shovels if air is above them. This is evident through the following line of code:

if (blockstate1 != null && level.getBlockState(blockpos.above()).isAir())

I can confirm this, by removing that check, you can create paths underwater, creating check that makes sure there is no solid faces or blocks above instead of checking for air above fixes the issue, assuming your not meant to create paths under blocks, if you're supposed to be able to, you can just remove the check for air above the path block entirely.

Can confirm in 1.18.2 and 22w18a.

Jetaru

(Unassigned)

Confirmed

(Unassigned)

1.15.1, 1.15.2 Pre-release 2, 1.16.3, 1.16.4 Pre-release 1, 20w51a, ..., 1.18, 1.18.2, 22w18a, 1.20.1, 23w33a

Retrieved