mojira.dev
MC-256639

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

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.

Comments 0

No comments.

Anomie X

boq

Plausible

Platform

Very Important

Save Data

22w42a

22w43a

Retrieved