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

Optimization target on NBT saving

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.18.1
    • None
    • Plausible
    • (Unassigned)

      Hello.
      I have developed a optimized saving method for inventories that can compress them in the best case ~10-15x and in the worst case does save exactly the same as it does right now.
      For a little CPU overhead.

      This method basically Maps Exact same ItemStacks together (including stacksize).
      And creates a slot list per item.
      If the slot list is only 1 entry it will save it like default otherwise it is saved as a byte array.
      This would be backwards compatible and on top of that it would reduce NBT overhead for things like Shulkerboxes massively.
      Bugs like "Banning players by having to much NBT" could be less likely to hit since the compression would require a lot more effort to achieve this limitation.

      In the attachments you find example code that is running since roughly 5 months stable.
      A doublechest full of dirt goes from 3KB NBTdata to roughly 200Bytes.

      I hope this improves minecraft in some way.
      This patch can be applied to technically any game version

      Edit: These methods could be injected into the helper methods you already provide.

            Unassigned Unassigned
            NoUser No User
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: