Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-256639

Allays, Piglins, and Villagers lose inventory if unloaded and reloaded

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • 22w43a
    • 22w42a
    • None
    • Plausible
    • Save Data
    • Very Important
    • Platform

    Description

      If an allay has items in its inventory, and the game is exited and reloaded or the entity is unloaded (e.g. due to distance) and reloaded, the items in the allay's inventory are lost.

      This is due to a change in 22w42a, class net.minecraft.world.entity.animal.allay.Allay, method readAdditionalSaveData:

      -        this.inventory.fromTag(compoundTag.getList("Inventory", 10));
      +        if (compoundTag.contains("Inventory", 10)) {
      +            this.inventory.fromTag(compoundTag.getList("Inventory", 10));
      +        }
      

      The "Inventory" tag is a List, which is type 9. So the added check for contains("Inventory", 10) will never succeed.

      The same error was made in net.minecraft.world.entity.monster.piglin.Piglin and net.minecraft.world.entity.npc.AbstractVillager.

      P.S. This is the same type of error that's causing MC-198493.

      Attachments

        Activity

          People

            boq [Mojang] Bartosz Bok
            anomie x Anomie X
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              CHK: