mojira.dev
MC-163744

Missing predicates return true/false rather than failing

The bug

When a predicate does not exist, commands that evaluate it act as though it existed, ran properly, and returned false.

Compare the following:

@a[advancements={does_not_exist=false}]   // finds nobody
@a[advancements={does_not_exist=true}]    // finds nobody
@a[predicate=!does_not_exist]             // finds everyone

How to reproduce

/execute unless predicate aklsdjfaksjfa
/execute if entity @s[predicate=!alskdjf]

Expected result: error, 'aklsdjfaksjfa' not found

Actual result: Test passed

Comments 1

Using 19w41a's official mappings.

Both predicates in entity selectors and in execute commands fallback to LootItemCondition.FALSE. (See net/minecraft/commands/arguments/selector/options/EntitySelectorOptions#bootstrap and net/minecraft/server/commands/ExecuteCommand#checkCustomPredicate).

However advancements argument in entity selectors checks whether the advancement doesn't equal null instead of using a fallback, so it will always return false if the specific advancement doesn't exist.

imo removing the fallback and checking if customPredicate != null && ... will fix this bug.

tryashtar

boq

Confirmed

Normal

Advancements, Loot tables

19w41a

19w44a

Retrieved