mojira.dev
MC-56376

Villagers with blank or invalid items in their trades cause their chunk to fail to save

I was messing around with villagers in creative mode, and creating some with custom trades. I wanted to make a villager that cannot be traded with, so I used this command:

/summon Villager ~ ~1 ~ {Offers:{Recipes:[{maxUses:1,buy:{id:,Count:1},sell:{id:,Count:1}}]},Profession:3,CustomName:"Npc1",CustomNameVisible:1}

This command summons a proper villager with blank slots in its trade menu. However, closing and reopening the world causes the chunk the villager is in to revert to what it was before the villager was spawned. Summoning a villager with actual item IDs will not cause this error. For example:

/summon Villager ~ ~1 ~ {Offers:{Recipes:[{maxUses:1,buy:{id:"minecraft:barrier",Count:1},sell:{id:"minecraft:barrier",Count:1}}]},Profession:3,CustomName:"Npc1",CustomNameVisible:1}

Although villagers with blank trades was probably not intended to exist, I think that this bug could use to be fixed just to make stuff look better... Without losing tons of work in one chunk.

Linked issues

Comments 3

Getting:

[20:36:22 INFO]: Client> [20:36:22] [Server thread/INFO]: Saving and pausing game...
[20:36:22 INFO]: Client> [20:36:22] [Server thread/INFO]: Saving chunks for level 'Flatworld'/Overworld
[20:36:22 INFO]: Client> s: Saving entity NBT
[20:36:22 INFO]: Client> 	at ub.e(SourceFile:1112)
[20:36:22 INFO]: Client> 	at ub.d(SourceFile:1074)
[20:36:22 INFO]: Client> 	at ayx.a(SourceFile:210)
[20:36:22 INFO]: Client> 	at ayx.a(SourceFile:99)
[20:36:22 INFO]: Client> 	at op.b(SourceFile:161)
[20:36:22 INFO]: Client> 	at op.a(SourceFile:192)
[20:36:22 INFO]: Client> 	at oq.a(SourceFile:700)
[20:36:22 INFO]: Client> 	at net.minecraft.server.MinecraftServer.a(SourceFile:339)
[20:36:22 INFO]: Client> 	at cln.v(SourceFile:128)
[20:36:22 INFO]: Client> 	at net.minecraft.server.MinecraftServer.run(SourceFile:422)
[20:36:22 INFO]: Client> 	at java.lang.Thread.run(Unknown Source)
[20:36:22 INFO]: Client> Caused by: java.lang.NullPointerException
[20:36:22 INFO]: Client> 	at aku.k(SourceFile:127)
[20:36:22 INFO]: Client> 	at akv.a(SourceFile:128)
[20:36:22 INFO]: Client> 	at acc.b(SourceFile:228)
[20:36:22 INFO]: Client> 	at ub.e(SourceFile:1100)
[20:36:22 INFO]: Client> 	... 10 more

According to this video, this can happen as a result of old villager trades updating to a newer version. It was probably because the conversion from numeric IDs to named IDs failed in one of the farmer villager's trades. Etho has been using the snapshots, so I'm not sure if updating a world from 1.7 to 1.8 directly would cause the same problem. Also, those villagers were quite old; I'm not sure if the same thing would happen to newer villagers or not.

Oddly enough, both villagers in the affected chunk had to be killed, even though only one of them had a bugged trade.

According to this video, this can happen as a result of old villager trades updating to a newer version. It was probably because the conversion from numeric IDs to named IDs failed in one of the farmer villager's trades. Etho has been using the snapshots, so I'm not sure if updating a world from 1.7 to 1.8 directly would cause the same problem. Also, those villagers were quite old; I'm not sure if the same thing would happen to newer villagers or not.

Oddly enough, both villagers in the affected chunk had to be killed, even though only one of them had a bugged trade.

Nate Bairen

(Unassigned)

Unconfirmed

Minecraft 14w21b

Retrieved