-
Bug
-
Resolution: Fixed
-
1.21.2 Hotfix
-
Unconfirmed
-
iOS
I found a very specific bug regarding the Minecraft Server-API (1.12.0-beta).
If the execute command is run on a dimension & the command run by the execute command fails THEN the game will crash.
Expected Behavior:
Command silently fails.
Observed Behavior:
Game crashes if: 1. Command run on a dimension 2. Command is an execute command 3. The chained command fails
All three criterea must be met for the game to crash as seen in my example video.
How to reproduce:
Run "dimension.runCommand(<cmd>)" in a script with any command that fulfills the crash condition. Command used in my example: "execute run give @a[hasitem=
{item=stick}] apple" (no target found, so the command failed).
Alternate way to reproduce:
Download the “MCPE-185196” mcaddon file, install it on a version of Minecraft that supports the 1.12.0-beta server API, enable it on a world with beta APIs, then click/use the brick item to crash the game. Look into the main.js file in the add-on & you will see all that it is doing is running the failing command on the dimension.
Workaround:
For anyone who needs a workaround, you can effectively run a command on a dimension without directly running with .runCommand method. You can do this by summoning an entity in the dimension, running the command on the entity, then removing the entity in the same tick. Here is what I use:
let dummy = Context.dimension.spawnEntity('minecraft:snowball', Context.location);
dummy.runCommand(cmd);
dummy.remove();