From 0a7a06a0443f0b4bc81731255c47557456c43279 Mon Sep 17 00:00:00 2001 From: Eclipse Date: Sat, 11 May 2024 10:35:06 +0000 Subject: [PATCH] Add new vanilla custom item properties to JSON reader, needs testing --- .../mappings/versions/MappingsReader_v1.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/registry/mappings/versions/MappingsReader_v1.java b/core/src/main/java/org/geysermc/geyser/registry/mappings/versions/MappingsReader_v1.java index d32d5bc09..177137885 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/mappings/versions/MappingsReader_v1.java +++ b/core/src/main/java/org/geysermc/geyser/registry/mappings/versions/MappingsReader_v1.java @@ -225,6 +225,50 @@ public class MappingsReader_v1 extends MappingsReader { customItemData.tags(tagsSet); } + if (node.has("stack_size")) { + customItemData.stackSize(node.get("stack_size").asInt()); + } + + if (node.has("max_damage")) { + customItemData.maxDamage(node.get("max_damage").asInt()); + } + + if (node.has("attack_damage")) { + customItemData.maxDamage(node.get("attack_damage").asInt()); + } + + if (node.has("tool_type")) { + customItemData.toolType(node.get("tool_type").asText()); + } + + if (node.has("tool_tier")) { + customItemData.toolTier(node.get("tool_tier").asText()); + } + + if (node.has("armor_type")) { + customItemData.armorType(node.get("armor_type").asText()); + } + + if (node.has("protection_value")) { + customItemData.protectionValue(node.get("protection_value").asInt()); + } + + if (node.has("hat")) { + customItemData.hat(node.get("hat").asBoolean()); + } + + if (node.has("foil")) { + customItemData.foil(node.get("foil").asBoolean()); + } + + if (node.has("edible")) { + customItemData.edible(node.get("edible").asBoolean()); + } + + if (node.has("can_always_eat")) { + customItemData.canAlwaysEat(node.get("can_always_eat").asBoolean()); + } + return customItemData.build(); }