Mojira Archive
MC-160539

/clone, /execute if blocks, and /fill have inconsistent behavior about chunk loading

The bug

  • A. /clone checks whether the level has all the target chunks and fails if not.
  • B. /fill and /execute if blocks check only the begin and end chunks. These commands cause all the target chunks to be loaded temporarily as a side effect.

These behaviors are inconsistent and should be unified into one of them.

How to reproduce

  1. /forceload add 0 0
  2. /forceload add 1023 0
  3. /clone 0 0 0 1023 0 0 0 0 1

    That position is not loaded (A)

  4. /fill 0 0 0 1023 0 0 minecraft:stone destroy

    Successfully filled 1024 blocks (B)

  5. /execute if blocks 0 0 0 1023 0 0 0 0 0 all

    Test passed, count: 1024 (B)

Code analysis

/clone uses LevelReader#hasChunkAt to check the chunks.

// net.minecraft.server.commands.CloneCommands#clone
if (level.hasChunksAt(begin, end) && level.hasChunksAt(destinationBegin, destinationEnd)) {
    // ...
} else {
    throw BlockPosArgument.ERROR_NOT_LOADED.create();
}

There are no preconditions like that in /fill or /execute if blocks.