mojira.dev
MC-221250

You cannot use hoes on blocks that are underwater

The Bug:

You cannot use hoes on blocks that are underwater.

Steps to Reproduce:

  1. Obtain a hoe and right-click on a dirt block that is underwater.

  2. Take note as to whether or not you can use hoes on blocks that are underwater.

Observed Behavior:

You cannot use hoes on blocks that are underwater.

Expected Behavior:

You would be able to use hoes on blocks that are underwater.

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.HoeItem.java

public class HoeItem extends DiggerItem {
   protected static final Map<Block, Pair<Predicate<UseOnContext>, Consumer<UseOnContext>>> TILLABLES = Maps.newHashMap(ImmutableMap.of(Blocks.GRASS_BLOCK, Pair.of(HoeItem::onlyIfAirAbove, changeIntoState(Blocks.FARMLAND.defaultBlockState())), Blocks.DIRT_PATH, Pair.of(HoeItem::onlyIfAirAbove, changeIntoState(Blocks.FARMLAND.defaultBlockState())), Blocks.DIRT, Pair.of(HoeItem::onlyIfAirAbove, changeIntoState(Blocks.FARMLAND.defaultBlockState())), Blocks.COARSE_DIRT, Pair.of(HoeItem::onlyIfAirAbove, changeIntoState(Blocks.DIRT.defaultBlockState())), Blocks.ROOTED_DIRT, Pair.of(($$0) -> {
      return true;
   }, changeIntoStateAndDropItem(Blocks.DIRT.defaultBlockState(), Items.HANGING_ROOTS))));
   ...
   public static boolean onlyIfAirAbove(UseOnContext $$1) {
      return $$1.getClickedFace() != Direction.DOWN && $$1.getLevel().getBlockState($$1.getClickedPos().above()).isAir();
   }
}

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

HoeItem::onlyIfAirAbove

Linked issues

Attachments

Comments 3

bugsbugsbugs

I can confirm, duplicates/relates to MC-85237. Also affects the shovel.

Ethan Grant Holsopple

You shouldn't be able to anyways...

ampolive

Relates to MC-103899.

Avoma

(Unassigned)

Confirmed

Items

hoe

1.16.5, 21w11a, 21w13a, 21w14a, 21w15a, ..., 1.21, 1.21.1, 1.21.3, 1.21.4, 1.21.5

Retrieved