mojira.dev
MC-78780

/fill hollow and destroy calculates number of blocks incorrectly

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;
    }
}

Comments 5

Well, physically, it just changed it to air, and I don't think air is counted, thus making it as 'No blocks were changed'?

Well there is another bug with the /fill command with air and the destroy mode

MC-58297 describes the "opposite". It says that Minecraft calculates the block count in this example with 3*3*3 (which is not the case in the latest version, in hollow mode it is always 26 (instead of 27))

Fixed in some 1.13 snapshot. Partial dupe of MC-55800, but both issues are fixed.

Marcono1234

(Unassigned)

Confirmed

/fill, block, command, hollow

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

Minecraft 18w03b

Retrieved