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

Ice with non-solid blocks below them doesn't create water when mined by players

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.7.9, Minecraft 1.7.10-pre4, Minecraft 14w25b, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03a, Minecraft 19w03b, Minecraft 19w03c, 1.15.1, 1.16 Pre-release 3, 1.16.2, 1.16.4, 20w46a, 20w48a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 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 Pre-release 3, 1.17.1 Release Candidate 1, 1.17.1, 21w38a, 21w39a, 21w41a, 21w42a, 21w43a, 1.18 Pre-release 1, 1.18 Pre-release 7, 1.18, 1.18.1, 22w03a, 22w05a, 22w06a, 22w07a, 1.18.2 Release Candidate 1, 1.18.2, 22w17a, 22w18a, 1.19, 1.19.1, 1.19.2, 22w43a, 1.19.3, 1.19.4, 1.20, 1.20.1, 23w51b, 24w11a, 1.21, 1.21.1, 1.21.3
    • Confirmed
    • Block states
    • Low
    • Gameplay

      The Bug:

      Ice with non-solid blocks below them doesn't create water when mined by players.

      Steps to Reproduce:

      1. Place down some ice and ensure that there's air below it.
      2. Break the ice.
      3. Take note as to whether or not ice with non-solid blocks below them doesn't create water when mined by players.

      Observed Behavior:

      No water is created.

      Expected Behavior:

      Water would be created.

      Code Analysis:

      Code analysis by Avoma can be found below. An additional code analysis by TriWonder81 can be found in this comment.

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

      net.minecraft.world.level.block.IceBlock.java
      public class IceBlock extends HalfTransparentBlock {
         ...
         public void playerDestroy(Level level, Player player, BlockPos blockPos, BlockState blockState, @Nullable BlockEntity blockEntity, ItemStack itemStack) {
            super.playerDestroy(level, player, blockPos, blockState, blockEntity, itemStack);
            if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemStack) == 0) {
               if (level.dimensionType().ultraWarm()) {
                  level.removeBlock(blockPos, false);
                  return;
               }
      
               Material material = level.getBlockState(blockPos.below()).getMaterial();
               if (material.blocksMotion() || material.isLiquid()) {
                  level.setBlockAndUpdate(blockPos, Blocks.WATER.defaultBlockState());
               }
            }
      
         }
         ...

      If we look at the above class, we can see that there are two checks that are carried out before allowing ice blocks to be converted into water upon being mined by players. One of these checks is to make sure that the player isn't holding an item enchanted with silk touch at the time of the interaction, and the other is to check if the material below the ice block blocks motion or is a liquid. Because of the material check that's in place here, when ice with non-solid blocks below them is mined by players, it doesn't create water, therefore resulting in this problem occurring.

      Fix:

      Simply removing the material check within this piece of code before allowing ice blocks to be converted into water upon being mined by players will resolve this problem.

      Current Code:
      ...
      Material material = level.getBlockState(blockPos.below()).getMaterial();
      if (material.blocksMotion() || material.isLiquid()) {
         level.setBlockAndUpdate(blockPos, Blocks.WATER.defaultBlockState());
      }
      ...
      Fixed Code:
      ...
      level.setBlockAndUpdate(blockPos, Blocks.WATER.defaultBlockState());
      ...

        1. MC-58208 - Fixed Code.png
          MC-58208 - Fixed Code.png
          40 kB
        2. MC-58208 - Current Code.png
          MC-58208 - Current Code.png
          50 kB
        3. MC-58208.png
          MC-58208.png
          699 kB
        4. MC-58208.mp4
          2.89 MB
        5. 2014-06-20_12.33.54.png
          2014-06-20_12.33.54.png
          220 kB
        6. 2014-06-20_12.32.53.png
          2014-06-20_12.32.53.png
          324 kB
        7. 2014-06-20_12.32.14.png
          2014-06-20_12.32.14.png
          451 kB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            19 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              CHK: