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

Frosted ice doesn't hydrate farmland

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.9, Minecraft 16w42a, Minecraft 1.11, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a, Minecraft 19w11b, Minecraft 19w12b, Minecraft 1.14, Minecraft 1.14.2, 1.15.2, 1.16.2, 1.16.4, 20w49a, 21w03a, 21w05b, 1.17, 1.18.1, 1.18.2 Pre-release 1, 1.18.2 Release Candidate 1, 1.18.2, 1.19, 1.19.1, 1.19.2, 22w43a, 1.19.3, 1.19.4, 1.20, 1.20.1, 24w11a, 1.21, 1.21.1, 1.21.2 Pre-Release 3, 1.21.3
    • Confirmed
    • Block states

      The Bug:

      Frosted ice doesn't hydrate farmland.

      It's important to note that sugar cane can rely on frosted ice blocks in order to exist within the world therefore one would expect similar behavior with farmland. If frosted ice can be used to support the existence of sugar cane, one would expect that it would also be able to hydrate farmland.

      I believe this could potentially be an issue because it creates a mild inconvenience for the player when they walk near their farms whilst wearing boots enchanted with frost walker. As a result of nearby water sources being converted into frosted ice, nearby farmland blocks will gradually lose their moisture level as frosted ice isn't seen as a valid block that can hydrate farmland. Because of this, the crops above the farmland grow slower, thus creating a minor annoyance.

      Steps to Reproduce:

      1. Build the setup as shown in the attachment below. setup.png
      2. Set the time to "night" to avoid frosted ice from melting.
      3. Replace the water within the setup with frosted ice by using the command provided below.
        /fill ~9 ~-1 ~9 ~-9 ~-4 ~-9 minecraft:frosted_ice replace minecraft:water
      4. Wait around thirty seconds and observe the moisture levels of the farmland.
      5. Take note as to whether or not frosted ice hydrates farmland.

      Observed Behavior:

      Frosted ice doesn't hydrate farmland.

      Expected Behavior:

      Frosted ice would hydrate farmland.

      Code Analysis:

      Code analysis by Avoma can be found below.

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

      net.minecraft.world.level.block.FarmBlock.java
      public class FarmBlock extends Block {
         ...
         private static boolean isNearWater(LevelReader levelReader, BlockPos blockPos) {
            for(BlockPos blockpos : BlockPos.betweenClosed(blockPos.offset(-4, 0, -4), blockPos.offset(4, 1, 4))) {
               if (levelReader.getFluidState(blockpos).is(FluidTags.WATER)) {
                  return true;
               }
            }
            return false;
         }
         ...

      If we look at the above class, we can see that the isNearWater() boolean returns true if water fluid is present near farmland, and within the randomTick() method located elsewhere within the FarmBlock.java class, the isNearWater() boolean must return true in order for farmland blocks to be hydrated. The issue here is that the isNearWater() boolean only checks for the presence of water fluid and not frosted ice blocks before allowing farmland to be hydrated, therefore resulting in this problem occurring.

      Fix:

      Simply altering the existing "if" statement within this piece of code to also check for the nearby presence of frosted ice blocks before allowing farmland to be hydrated will resolve this problem.

      Current "if" statement:
      if (levelReader.getFluidState(blockpos).is(FluidTags.WATER))
      Fixed "if" statement:
      if (levelReader.getFluidState(blockpos).is(FluidTags.WATER) || levelReader.getBlockState(blockpos).is(Blocks.FROSTED_ICE))

        1. 2016-03-07_17.47.17.png
          2016-03-07_17.47.17.png
          244 kB
        2. MC-99230 - Current Code.png
          MC-99230 - Current Code.png
          24 kB
        3. MC-99230 - Fixed Code.png
          MC-99230 - Fixed Code.png
          27 kB
        4. setup.png
          setup.png
          237 kB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            13 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              CHK: