Map unbreakable item component

Fixes #4893
This commit is contained in:
Camotoy 2024-07-24 14:27:05 -04:00
parent b664395684
commit 96c58566b5
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -170,6 +170,11 @@ public class Item {
builder.putInt("RepairCost", repairCost);
}
// If the tag exists, it's unbreakable; the value is just weather to show the tooltip. As of Java 1.21
if (components.getDataComponents().containsKey(DataComponentType.UNBREAKABLE)) {
builder.putByte("Unbreakable", (byte) 1);
}
// Prevents the client from trying to stack items with untranslated components
// Relies on correct hash code implementation, and some luck
builder.putInt("GeyserHash", components.hashCode()); // TODO: don't rely on this