(Original below)
The minecraft:player_interacted_with_entity
advancement trigger does not trigger if a player is holding only one item and that item gets consumed. This also affects the "Oh Shiny" advancement.
Steps to reproduce: (again, original below)
1. Find a piglin
2. Go into adventure/survival mode
3. Hold 1 gold ingot
4. Give the piglin the gold ingot
5. The item gets consumed (it's given to the piglin) but the "Oh Shiny" advancement is not granted
Original:
(original name: "player_interacted_with_entity on armour stand does not succeed if the item is specified and the selected item is only one item")
The minecraft:player_interacted_with_entity
advancement trigger does not trigger if the selected entity is an armour stand, if there is an item specified, and if you are in adventure/survival mode while holding only one item. It most likely changes the inventory first before checking the conditions, because if you take the item off it does trigger.
Steps to reproduce:
1. Add the following advancement
{
"criteria": {
"test": {
"trigger": "minecraft:player_interacted_with_entity",
"conditions": {
"item": {
"item": "minecraft:stone"
},
"entity": {
"type": "minecraft:armor_stand"
}
}
}
}
}
2. summon an armour stand with ShowArms: 1b
/summon armor_stand ~ ~ ~ {ShowArms: 1b}
3. Give yourself one stone
4. Go in either adventure mode or survival mode
5. Give the armour stand the stone by right clicking it
6. It does not trigger the advancement (it does work in creative mode or if you have multiple of the same item selected)
Linked issues
is duplicated by 1
relates to 2
Attachments
Comments 4
I guess the reason why this is happening is because the check of item
is performed after the interaction is finished, and when the player is interacting with an armor stand in survival mode the single item they hold will switch with the armor stand, therefore making the trigger no longer able to detect the original item. So this should only happen for armor stands (and item frames I suppose?) also happen for item frames and piglins with gold ingots.
Just tested it on a piglin, and it indeed appears it also affects the "Oh Shiny" advancement. Maybe I should change the name and description a bit to make it a bit more general?
The bug can also be reproduced with the following advancement below:
{
"criteria": {
"flint_and_steel": {
"trigger": "player_interacted_with_entity",
"conditions": {
"item": {
"item": "flint_and_steel"
},
"entity": [
{
"condition": "entity_properties",
"entity": "this",
"predicate": {
"type": "creeper"
}
}
]
}
}
}
}
Give yourself a broken Flint and Steel with the following command:
/give @s flint_and_steel{Damage:512}
When the item is used on a Creeper, the advancement trigger would not activate since it checks the item after it is used as mentioned by @unknown above.
I assume this also affects the "Oh Shiny" advancement then, is that correct? Or does it only happen for armor stands and nothing else?