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

Loot entries serialise incorrectly


    • Confirmed

      Note: All class, field and method names used are from the stable_29 MCP mappings.

      Due to a typo in LootEntry.Serialiser#serialize(), instances of LootEntryTable have their type set to "item" when serialised, instead of "loot_table". Any produced loot table containing these entries will error when they are deserialised.

      I have verified this in MCP 9.24(MC 1.9), MCP 9.28(MC 1.9.4), MCP 9.30(MC 1.10) and MCP 9.37(MC 1.11.2).

      pau101 has verified this in snapshot 17w31b.

      The cause of this issue is this if statement in LootEntry.Serialiser#serialize():

      if (p_serialize_1_ instanceof LootEntryItem)
          jsonobject.addProperty("type", "item");
      else if (p_serialize_1_ instanceof LootEntryTable)
          jsonobject.addProperty("type", "item");

      The fix is to replace "item" with "loot_table".

      This bug is only exposed if mods or other third-party applications are used to serialise loot tables, as vanilla does not serialise them.

            dinnerbone [Mojang] Nathan Adams
            Daomephsta Daomephsta
            1 Vote for this issue
            1 Start watching this issue