mojira.dev
MC-198493

Villagers lose their discounts when relogging while it is a zombie villager

The bug

When you cure a zombie villager to get discounts, and then turn him back into a zombie villager and then relog and cure him again, it will lose the discounts. They only disappear upon relogging when he is a zombie villager.

How to reproduce

  1. Spawn a villager and make it link to a work station

  2. Make sure to play on hard difficulty

  3. Spawn a zombie to turn him into a zombie villager

  4. Cure him

  5. Use this to command to speed up the process:

    /execute as @e[type=minecraft:zombie_villager,distance=..20] run data merge entity @s {ConversionTime:0}
  6. Turn him back into a zombie villager

  7. Relog

  8. Cure him again and use this command:

    /execute as @e[type=minecraft:zombie_villager,distance=..20] run data merge entity @s {ConversionTime:0}

    ❌ The prices will be as they were before, because he lost all of its discounts and then got one single discount through the curing process.

Attachments

Comments 6

I think that this issue and MC-222462 are related. Can someone add "related to" or "duplicat"?

This issue and MC-222462 are duplicates. Both issues are saying zombie villagers lose their discount info when unloaded and reloaded. They are just saying it in different ways. I think discount info should be in the zombie villagers nbt tags.

Can confirm in Windows 10 1.19.20.

Villagers, after being cured either:

a) Do not provide a discount at all;

b) Provide a discount, but do not provide minor discounts for the curing of other villagers; or

c) Provide a discount, provide one or two minor discounts for the curing of other villagers, then do not provide any additional minor discounts for the curing of other villagers.

This can be really frustrating for new players, as they would waste a golden apple and a splash potion.

Took a look at the code for this bug. I found that the Gossips data for a zombie villager is being saved, as a List (nbt type 9) of Compounds (nbt type 10), in the entities/r.x.z.mca file.

But the code for reading the Gossips data in `net.minecraft.world.entity.monster.ZombieVillager` does not read it back correctly. That code looks like this:

if (compoundTag.contains("Gossips", 10)) {
            this.gossips = compoundTag.getList("Gossips", 10);
        }

Or in English, "if it contains a Gossips tag that is a Compound, read a List of Compounds from it".

That code should look like this instead:

if (compoundTag.contains("Gossips", 9)) {
            this.gossips = compoundTag.getList("Gossips", 10);
        }

I think this is a duplicate of MC-183977, in which case that report should be closed as Resolved too.

bugsbugsbugs

boq

Confirmed

Trading

1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, ..., 21w17a, 21w18a, 1.17, 1.17.1, 1.18.1

22w43a

Retrieved