mojira.dev
MC-81806

worldborder add allows size >= 0 while worldborder set only allows size >= 1

The bug

When using /worldborder set 0 it gives you an error message and says that it has to be at least 1.0, however when using /worldborder add -60000000 it works perfectly fine. When you try after that to reduce the size of the worldborder, it will say that the maximum size is 0.

/worldborder set

[14:20:26] [Client thread/INFO]: [CHAT] Set world border to 1,0 blocks wide (from 10,0 blocks)
[14:20:29] [Client thread/INFO]: [CHAT] The number you have entered (0.0) is too small, it must be at least 1.0

/worldborder add

[14:20:36] [Client thread/INFO]: [CHAT] Set world border to 0,0 blocks wide (from 1,0 blocks)
[14:20:37] [Client thread/INFO]: [CHAT] The number you have entered (-1.0) is too small, it must be at least -0.0

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.CommandWorldBorder.execute(MinecraftServer, ICommandSender, String[]) only tests for the "add" argument if the value is between -diameter and 60,000,000 - diameter. Instead it should test if the value is between -diameter + 1 and 60,000,000 - diameter.

Linked issues

Comments 6

Confirmed for 1.9

Confirmed for 1.11.2

Can confirm for 17w43a/b

marcono1234

(Unassigned)

Confirmed

/worldborder, size

Minecraft 1.8.7, Minecraft 16w05a, Minecraft 1.9, Minecraft 1.9.1, Minecraft 1.9.2, ..., Minecraft 1.11.2, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b

Minecraft 18w02a

Retrieved