mojira.dev
MC-274342

Commands specifying nonexistent functions/advancements parse correctly

Description

Unlike loot tables, predicates and all hardcoded registries, the command parser doesn't throw an error if a specified function or advancement doesn't exist, and instead tries to run, only to fail.

How to Reproduce

1. Open the chat and type /function foo:bar without pressing Enter.
→ ❌ The game accepts the invalid argument and doesn't show a warning.
2. Actually execute the aforementioned command.
→ ❌ The command parses correctly and fails, instead of being unparseable.

Expected Behavior

The command parser would render any command containing a nonexistent function or advancement unparseable.

Observed Behavior

The command parser tries to run the command despite it containing a nonexistent function or advancement.

Attachments

Comments 5

The /function command is not unparseable if the specified function doesn't exist, so your test1 function is a valid function, since all commands in it are parseable.

I mean why it's still parseable unlike test2, where's the difference between function and predicate?

You can try this in game to understand what I mean. If you type /function, then a space and then type anything you like, the game doesn't tell you that what you're typing is incorrect, as it colors it in light blue text. However, when you run that command, the game tells you it couldn't find that function, so the command failed.

Your other function tries to find a predicate that doesn't exist, and since that command is coded to be unparseable if an unknown predicate is specified, the command and by extension the function is unparseable and throws an error.

You should probably make this report more specific to the /function command being able to parse nonexistent functions.

I know how functions are loaded and how the parser works, but my argument is why they should be different. The description said it's not only happened in /function, it's general inconsistency in parsing argument types of datapack stuff.

The reason why functions load correctly even when unknown functions and advancements are specified is because the underlying commands don't fail to parse. Therefore, I've generified this report for you.

ccJerrycc

(Unassigned)

Confirmed

Platform

Low

Commands, Data Packs

1.21

Retrieved