Reference to unexisting predicate in a datapack causes java.lang.NullPointerException
Referencing an unexisting predicate in an advancement that uses an inventory changed trigger causes a java.lang.NullPointerException upon triggering the advancement.
How to reproduce:
Create an advancement with the inventory changed trigger. In the conditions section, add a player[{}] condition. There, add a reference predicate, and set the name to one that doesn't exist. Cause the advancement to trigger by picking up an item. Do not use the /advancement command, as it will not cause a crash. If everything was done correctly, thr game should crash.
It also doesn't allow the player to join back until either the datapack is disabled, or the reference name is fixed, however, this is inconsistent. Sometimes it is possible to join back after the first or second crash, but eventually it becomes impossible.
Attached is a datapack which can cause this crash.
Environment
Windows 10, Singleplayer, bundled Java, Vanilla
Created Issue:
Custom datapack crashes game and permanently locks the player out of the world
For a project, I was writing a datapack that adds some gamemodes and other things along with that. While creating a respawn system for one of the modes, I encountered a reproducible and quite harmful issue.
This is a recreated report, because the previous report contained mods.
The issue:
Upon dying while the datapack is enabled and while a certain function is ticking (Gamemode is active), the game crashes. I would expect a faulty datapack to either not work, or work in a way that is not intended. But I would not expect it to crash the game.
After restarting Minecraft, attempting to join back into the world will show that I was disconnected (See attachment).
How to reproduce:
A copy of this world has been attached. This copy is taken right before I first encountered the issue. It can be reproduced in either this world, or in a any other world if you extract out the datapack.
Note: The attached world was created on a modded version of Minecraft, but still works on vanilla Minecraft. However, this bug is also reproducible in vanilla Minecraft, and the attached crash logs are from tests in brand new worlds made in vanilla Minecraft.
If you use the provided world:
1: Run the command "/function bsr_tools:load" anywhere in the world, preferably in the location where you spawn.
2: Run "/function bsr_tools:reset/reset_players".
3: Use /team to join any of the teams, it doesn't matter.
4: Near the stone floor, there should be a command block with a sign above it which should start the game. Either activate that command block, or run "/function bsr_diamond_rush:start". Wait until the game starts (10 seconds).
5: Once you get teleported and receive items, kill yourself.
6: Game crashes
If you use a new world:
1: Extract the datapack from the world that is attached in this report, and insert it into a new world.
2: In any location, run "/function bsr_tools:load".
3: In any location, preferably close to where you did the previous step, run "/function bsr_tools:diamond_rush/global_marker/set".
4: In any location, preferably close to where you did the previous step, run "/function bsr_tools:diamond_rush/spawn_position/set". Repeat this step 6 times.
5: Run "/function bsr_tools:reset/reset_players".
6:: Use /team to join any team, it doesn't matter.
7: Run "/function bsr_diamond_rush:start". Wait until the game starts (10 seconds).
8: Once you get teleported and receive items, kill yourself.
9: Game crashes
Environment
Windows 10, Singleplayer, bundled Java, Vanilla
Custom datapack crashes game and permanently locks the player out of the worldInvalid referemce
For a project, I was writing a datapack that adds some gamemodes and other things along with that. While creatingarespawn system for one of the modes, I encountered a reproducible and quite harmful issue.This is a recreated report, because the previous report contained mods.
The issue:
Upon dying while the datapack is enabled and while a certain function is ticking (Gamemode is active), the game crashes. I would expect a faulty datapack to either not work, or work in a way that is not intended. But I would not expect it to crash the game.
After restarting Minecraft, attempting to join back into the world will show that I was disconnected (See attachment).
How to reproduce:
A copy of this world has been attached. This copy is taken right before I first encountered the issue. It can be reproduced in either this world, or in a any other world if you extract out the datapack.
Note: The attached world was created on a modded version of Minecraft, but still works on vanilla Minecraft. However, this bug is also reproducible in vanilla Minecraft, and the attached crash logs are from tests in brand new worlds made in vanilla Minecraft.
If you use the provided world:
1: Run the command "/function bsr_tools:load" anywhere in the world, preferably in the location where you spawn.
2: Run "/function bsr_tools:reset/reset_players".
3: Use /team to join any of the teams, it doesn't matter.
4: Near the stone floor, there should be a command block with a sign above it which should start the game. Either activate that command block, or run "/function bsr_diamond_rush:start". Wait until the game starts (10 seconds).
5: Once you get teleported and receive items, kill yourself.
6: Game crashes
If you use a new world:
1: Extract the datapack from the world that is attached in this report, and insert it into a new world.
2: In any location, run "/function bsr_tools:load".
3: In any location, preferably close to where you did the previous step, run "/function bsr_tools:diamond_rush/global_marker/set".
4: In any location, preferably close to where you did the previous step, run "/function bsr_tools:diamond_rush/spawn_position/set". Repeat this step 6 times.
5: Run "/function bsr_tools:reset/reset_players".
6:: Use /team to join any team, it doesn't matter.
7: Run "/function bsr_diamond_rush:start". Wait until the game starts (10 seconds).
8: Once you get teleported and receive items, kill yourself.
9: Game crashes
Referencing an unexisting predicate in an advancement causes a java.lang.NullPointerException.
How to reproduce:
Create an advancement with any trigger. In the conditions part, add a player[{}] condition. There, add a reference condition, and set the name to one that doesn't exist. Cause the advancement to trigger. Game crashes.It also doesn't allow the player to join back until either the datapack is disabled, or the reference name is fixed.
Attached is a datapack which can cause this crash.
Invalid referemceReference to unexisting predicate in a datapack causes java.lang.NullPointerException
Referencing an unexisting predicate in an advancement causes a java.lang.NullPointerException.
How to reproduce:
Create an advancement withanytrigger. In the conditionspart, add a player[{}] condition. There, add a referencecondition, and set the name to one that doesn't exist. Cause the advancement to trigger. Game crashes.It also doesn't allow the player to join back until either the datapack is disabled, or the reference name is fixed.
Attached is a datapack which can cause this crash.Referencing an unexisting predicate in an advancement that uses an inventory changed trigger causes a java.lang.NullPointerException upon triggering the advancement.
How to reproduce:
Create an advancement with the inventory changed trigger. In the conditions section, add a player[{}] condition. There, add a reference predicate, and set the name to one that doesn't exist. Cause the advancement to trigger by picking up an item. Do not use the /advancement command, as it will not cause a crash. If everything was done correctly, thr game should crash.It also doesn't allow the player to join back until either the datapack is disabled, or the reference name is fixed, however, this is inconsistent. Sometimes it is possible to join back after the first or second crash, but eventually it becomes impossible.
Attached is a datapack which can cause this crash.
Is this still an issue for you in 1.18.2?
Yes, this issue still occurs on 1.18.2