mojira.dev
MC-85237

You cannot convert blocks into dirt paths when non-full blocks are above them

The Bug:

You cannot convert blocks into dirt paths when non-full blocks are above them.

Steps to Reproduce:

  1. Build the setup as shown in the attachment below. 

[media]
  1. Obtain a shovel and attempt to turn all of the three grass blocks into dirt paths.

  2. Take note as to whether or not you can convert blocks into dirt paths when non-full blocks are above them.

Observed Behavior:

You cannot convert blocks into dirt paths when non-full blocks are above them.

Expected Behavior:

You would be able to convert blocks into dirt paths when non-full blocks are above them.

Code Analysis:

Code analysis by @unknown can be found below.

The following is based on a decompiled version of Minecraft 1.18 using MCP-Reborn.

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())

Linked issues

Attachments

Comments

kumasasa

Confirmed.

migrated

Confirmed for 1.10-pre1

bemoty

Can confirm for MC 1.12.1

migrated

Confirmed in 1.16-pre5.

j_p_smith

Related to MC-84731.

Avoma

Can confirm for 20w46a.

Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 21w07a.

Avoma

Can confirm in 21w11a.

Avoma

Can confirm in 21w17a.

Avoma

Can confirm in 1.17.

Avoma

Can confirm in 1.17.1.

Avoma

Can confirm this behavior in 21w41a. Here are some extra details regarding this problem.

The Bug:

You cannot convert blocks into dirt paths when non-full blocks are above them.

Steps to Reproduce:

  • Build the setup as shown in the attachment below.

[media]
  • Obtain a shovel and attempt to turn all of the three grass blocks into dirt paths.

  • Take note as to whether or not you are able to convert blocks into dirt paths when non-full blocks are above them.

Observed Behavior:

You cannot convert blocks into dirt paths when non-full blocks are above them.

Expected Behavior:

You would be able to convert blocks into dirt paths when non-full blocks are above them.

Avoma

(Unassigned)

Confirmed

Gameplay

Low

Block states

Minecraft 15w32a, Minecraft 15w45a, Minecraft 1.9.4, Minecraft 1.10 Pre-Release 1, Minecraft 1.10.2, ..., 1.21.2 Pre-Release 3, 1.21.3, 1.21.4, 25w08a, 1.21.5

Retrieved