mojira.dev
MC-121768

Function parsing fails silently

According to Dinnerbone, "Functions will be completely parsed & cached on load. This means if there's any command that isn't correct for whatever reason, you will know about it on load."
However, loading a function from a datapack (both via loading the world and using /reload) fails silently so you won't know wheather parsing succeded. Functions containing only valid commands are still loaded when the datapack contains functions with invalid commands and can be executed properly, but other functions can't be used, printing either "Unknown function:" or java.lang.NullPointerException to chat when one using /function instead of throwing an error on loading.

How to reproduce:
Create a data pack, add a .mcfunction file with invalid commands, load the world or reload data packs and try to execute the function.

Attachments

Comments 6

If it errors, it doesn't load and doesn't get added to the list of loaded functions, this is by design.

Yes, but it doesn't say whether it fails on load. According to Dinnerbone: "Functions will be completely parsed & cached on load. This means if there's any command that isn't correct for whatever reason, you will know about it on load."

Try in the b snapshot (as execute was rather broken), and see if it still happens.

Thank you for the response, but sadly, 17w45b didn't fix it. Are you able to replicate the problem?

Check the output log for information about why something won't load.

Probably invalid. Like @unknown said it is written to the log:

[Server thread/ERROR]: Couldn't load function at test:functions/invalid.mcfunction
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 0: Unknown command at position 0: <--[HERE]

VincentJunge

(Unassigned)

Unconfirmed

Minecraft 17w45a, Minecraft 17w45b

Retrieved