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

/fill hollow and destroy calculates number of blocks incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 18w03b
    • Minecraft 1.8.3, Minecraft 15w37a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.10.2, Minecraft 16w42a, Minecraft 1.11, Minecraft 1.12.1, Minecraft 1.12.2
    • Confirmed

      This is probably caused by a unknown fix of MC-58297 or because of the seconds part of this report

      hollow mode not counting placed air blocks in middle

      The hollow mode calculates the block count like the outline mode, which can be incorrect if air blocks are placed in the middle

      How to reproduce
      1. /fill ~1 ~ ~1 ~3 ~2 ~3 glass 0 hollow
      2. Place a block at the free spot in the center
      3. Run the 1. command again
        It will show that no blocks were changed, but it actually removed the block in the middle.
        This can cause quite some problems if you use the /stats command in combination with it (it will shows the wrong block count).
      The reason

      The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

      The reason why this happens is because the method net.minecraft.command.CommandFill.execute(MinecraftServer, ICommandSender, String[]) only tries to set air in the middle but does increase the modified blocks count in case it was successful.

      if (args[8].equals("hollow"))
      {
          // Replaced this
          //world.setBlockState(blockpos4, Blocks.air.getDefaultState(), 2);
          //list.add(blockpos4);
          if (world.setBlockState(blockpos4, Blocks.air.getDefaultState(), 2)) {
              list.add(blockpos4);
              j++;
          }
      }
      

      destroy not working with air as block to be placed

      The destroy mode is not counting placed air blocks, this is not the case for the /setblock command

      How to reproduce
      1. Stand on a block
      2. /fill ~ ~-1 ~ ~ ~-1 ~ air 0 destroy
        "No blocks filled" is definitely wrong here, because it destroyed that block
      The reason

      The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

      The reason why this happens is because the method net.minecraft.command.CommandFill.execute(MinecraftServer, ICommandSender, String[]) first destroys the block which means that at this position is air and then later tries to replace the block with air which returns that the block could not be placed.

      if (args[8].equals("destroy"))
      {
          // Replaced this
          //world.destroyBlock(blockpos4, true);
          if (world.destroyBlock(blockpos4, true) && block == Blocks.air) {
              list.add(blockpos4);
              j++;
              continue;
          }
      }
      

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: