Entity predicates for advancements fail if "type" not specified
The bug
The following advancement will not be granted due to the lack of a type string:
{
"criteria": {
"run": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"damage": {
"source_entity": {
"nbt": "{SelectedItem:{}}"
}
}
}
}
}
}
Adding type will allow all checks to function correctly:
{
"criteria": {
"run": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"damage": {
"source_entity": {
"type": "minecraft:player",
"nbt": "{SelectedItem:{}}"
}
}
}
}
}
}
Code analysis
In 1.12 MCP, net.minecraft.advancements.critereon.EntityPredicate(), the method to compare the incoming entity to the data contains this line, which first ensures that type was specified before comparing it to the incoming entity:
else if (this.field_192484_b != null && !EntityList.isStringEntityName(p_192482_2_, this.field_192484_b)) { return false; }
However, in 1.13, the check for null does not exist, meaning the whole predicate fails at this point (preventing all other options from working).
Linked Issues
is duplicated by4
Created Issue:
Entity predicates for advancements fail if "type" not specified
The bug
The following advancement will not be granted due to the lack of a type string:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "a": { "source_entity": { "nbt": "{SelectedItem:{}}" } } } } } }Adding type will allow all checks to function correctly:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "a": { "source_entity": { "type": "minecraft:player", "nbt": "{SelectedItem:{}}" } } } } } }Code analysis
In 1.12 MCP, net.minecraft.advancements.critereon.EntityPredicate(), the method to compare the incoming entity to the data contains this line, which first ensures that type was specified before comparing it to the incoming entity:
else if (this.field_192484_b != null && !EntityList.isStringEntityName(p_192482_2_, this.field_192484_b)) { return false; }However, in 1.13, the check for null does not exist, meaning the whole predicate fails at this point (preventing all other options from working).
The bug
The following advancement will not be granted due to the lack of a type string:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "a": { "source_entity": { "nbt": "{SelectedItem:{}}" } } } } } }Adding type will allow all checks to function correctly:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "a": { "source_entity": { "type": "minecraft:player", "nbt": "{SelectedItem:{}}" } } } } } }Code analysis
In 1.12 MCP, net.minecraft.advancements.critereon.EntityPredicate(), the method to compare the incoming entity to the data contains this line, which first ensures that type was specified before comparing it to the incoming entity:
else if (this.field_192484_b != null && !EntityList.isStringEntityName(p_192482_2_, this.field_192484_b)) { return false; }However, in 1.13, the check for null does not exist, meaning the whole predicate fails at this point (preventing all other options from working).
The bug
The following advancement will not be granted due to the lack of a type string:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "damage": { "source_entity": { "nbt": "{SelectedItem:{}}" } } } } } }Adding type will allow all checks to function correctly:
{ "criteria": { "run": { "trigger": "minecraft:player_hurt_entity", "conditions": { "damage": { "source_entity": { "type": "minecraft:player", "nbt": "{SelectedItem:{}}" } } } } } }Code analysis
In 1.12 MCP, net.minecraft.advancements.critereon.EntityPredicate(), the method to compare the incoming entity to the data contains this line, which first ensures that type was specified before comparing it to the incoming entity:
else if (this.field_192484_b != null && !EntityList.isStringEntityName(p_192482_2_, this.field_192484_b)) { return false; }However, in 1.13, the check for null does not exist, meaning the whole predicate fails at this point (preventing all other options from working).
is duplicated by
can confirm
still present in:
18w20a
18w20b
18w20c
affects 18w21a
affects 18w21b
affects 1.13 pre1