Skip to content

Fix [item] placeholder failing on Shulker Boxes with large contents#334

Open
daniel-skopek wants to merge 1 commit into
LOOHP:masterfrom
daniel-skopek:master
Open

Fix [item] placeholder failing on Shulker Boxes with large contents#334
daniel-skopek wants to merge 1 commit into
LOOHP:masterfrom
daniel-skopek:master

Conversation

@daniel-skopek

Copy link
Copy Markdown

Problem

When using [item] in chat while holding a Shulker Box filled with items that have many enchantments, persistent data, and custom resource pack textures, the chat packet JSON exceeds Minecraft's ~32767 character limit. The plugin cancels the oversized packet and sends the original unmodified message, displaying <chat=UUID:[item]:> in chat instead of the item.

Root Cause

ItemNBTUtils.getNMSItemStackDataComponents() serializes all data components including minecraft:container (the Shulker Box's 27 stored items with their full NBT) into the chat hover event. Even with the existing trimming logic, the threshold gap between ItemTagMaxLength (30767) and PacketStringMaxLength (32767) is too narrow, allowing container-heavy items to slip through untrimmed.

Fix

  1. ItemDisplay.java:188 — Added useInventoryView(item) || to the trimming condition. Items with non-empty containers (Shulker Boxes, etc.) are now always trimmed, creating a fresh ItemStack without minecraft:container data while preserving display name, lore, and enchantments.

  2. ItemDisplay.java:225-226 — Removed minecraft:container and minecraft:bundle_contents from the data components map as an additional safety net on 1.20.5+.

Container contents remain fully accessible through the existing click-to-view inventory GUI.

Prevents oversized chat packets when displaying containers filled
with enchanted items by trimming minecraft:container from the
data components used in the hover event.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant