-
Notifications
You must be signed in to change notification settings - Fork 13
Description
| Component | Version |
|---|---|
| Minecraft | 1.20.1 |
| Forge | 47.3.0 |
| Treasure² | 1.20.1‑3.11.1 |
| ModernFix | Default (mixin.perf.nbt_memory_usage = true) |
| Lithium | 0.11.2 |
| PacketFixer | 1.1.0 |
| OS | Debian Linux (dedicated server) |
When the server attempts to sync a Treasure² KeyItem (for example by opening an inventory or Refined Storage grid containing one), it crashes with either an ArrayIndexOutOfBoundsException or a NullPointerException originating in KeyItem.getShareTag(...). This disconnects all players holding that key.
Reproduction Steps
Start a Forge 1.20.1 server with Treasure² v3.11.1 (plus ModernFix, Lithium, PacketFixer).
Acquire or generate a Treasure² Key (the corruption appears after an update).
Put that key into a player’s inventory or place it inside a Refined Storage network.
Open the player inventory or open the Refined Storage GUI.
→ The server immediately prints a stack trace and forcibly disconnects the playe
ArrayIndexOutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3
at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.rehash(Object2ObjectOpenHashMap.java:1270)
at net.minecraft.nbt.CompoundTag.merge(CompoundTag.java:172)
at mod.gottsch.forge.treasure2.core.item.KeyItem.getShareTag(KeyItem.java:170)
… (packet encoding) …
NullPointerException:
java.lang.NullPointerException: Cannot invoke “net.minecraft.nbt.CompoundTag.getString(String)” because “tag” is null
at mod.gottsch.forge.treasure2.core.item.KeyItem.getShareTag(KeyItem.java:170)
… (packet encoding) …
Both errors originate from KeyItem.getShareTag(...) producing invalid or null NBT data. That invalid tag is then serialized by Minecraft’s packet encoder, causing the server crash.
Suggested Fix:
In KeyItem.getShareTag():
Check for itemStack.getTag() == null before merging.
Create a new empty CompoundTag if needed.
Avoid using FastUtil rehash without validating index bounds.
Thank you

