If you hold an item that the villager is buying, it will hold out an item that its selling corresponding to the item you were holding. Now if that item were to be a totem of undying the villager holds, you can kill it and make it use it to glitch out that trade. I would expect a different result like either the trade being removed or the totem still being able to be traded, but it just transforms the totem item into air in the trade.
To replicate this, summon a villager that is selling a totem for any item, using the command below, and hold out the item it's selling, like the emerald using the command, then kill the villager and watch it use the totem. Now you can open its trading menu and see that the totem item has been replaced with air. I wouldn't expect it to be like that and would expect a different outcome or even having the villager not able to use the totem. But I guess this is what happens if you perform these very specific steps.
/summon minecraft:villager ~ ~ ~ {VillagerData:
{type:plains,profession:farmer,level:2}
,Offers:{Recipes:[{buy:
{id:emerald,Count:1}
,sell:{id:totem_of_undying,Count:1}}]},Health:1,Attributes:[{Name:"generic.max_health",Base:1f}]}
Linked issues
relates to 1
Attachments
Comments 8
I tested and yes, in the left list of items on the left, it say you can trade air. But if you try to trade, you can see that it's not possible, there is nothing to pick up in the trade result and the emerald is not consumed.
I assume that "air" is the default display when, for some reason, the item to trade is unavailable or invalid. For example this reddit post, the guy enter a wrong command and the item traded by the villager is invalid, and replaced by "Air": https://www.reddit.com/r/Minecraft/comments/ehgy6l/help_with_custom_villager_keeps_trading_air/
So I think it work as intended. I personally consider it as a unwanted easter egg.
Update: the only problem that I can find is that the trade is blocked after that. You may consider that as a bug... I don't know.
The problem is that a valid trade turns invalid, rather than being removed from the list; it's also the only trade that can change (seemingly unintentionally) due to item consumption.
There's several things that say "bug" here, none that say "easter egg".
I think this comment sounds more like a feature request than a bug report. This is not the right place for that.