Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-221250

You cannot use hoes on blocks that are underwater

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.5, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1 Pre-release 2, 1.17.1 Release Candidate 1, 1.17.1, 1.18, 1.18.1, 22w05a, 1.18.2, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20.1, 1.20.4, 23w51b, 24w20a, 1.21, 1.21.1, 1.21.3
    • Confirmed
    • Items

      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 Avoma 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

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            7 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: