This line of a fox's loot table:
"conditions": [
{
"condition": "entity_properties",
"predicate": {
"nbt": "{HandItems:[{id:\"minecraft:wheat\"},{}],Type:\"red\",Sleeping:0b}"
},
"entity": "this"
}
should check for a fox, holding wheat that is red and isn't sleeping. With the /loot command it works as if the mob is alive and holding the wheat. But when it is killed, it produces a different loot as the hand items are dropped before the loot table is processed. With other mobs, the hand items are consistent and can be read through the loot table to process the correct loot as the hand items are processed after the loot table instead of before.
Confirmed. And here's a shaky code analysis:
dropAllDeathLoot
calls, in order,dropFromLootTable
anddropCustomDeathLoot
. The latter drops and removes equipment. Therefore, whendropFromLootTable
runs, the equipment is present and can be detected.For some reason, foxes override
dropAllDeathLoot
to manually drop the hand item first, and then call the super method. Therefore, whendropFromLootTable
runs, the equipment is already gone and cannot be detected. It's unclear to me why this override is present, since presumablydropCustomDeathLoot
would handle the fox's held item just fine like it does for other mobs. I'm not able to test what the effects of removing the override would be, though.