diff --git a/core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java b/core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java index 181131ec9e1..c18565b2f26 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java @@ -73,10 +73,10 @@ public enum BedrockEnchantment { BREACH, LUNGE; - public static final int INVALID = 43; - private static final BedrockEnchantment[] VALUES = values(); + public static final int INVALID = VALUES.length + 1; + private final String javaIdentifier; BedrockEnchantment() { diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java index a646920058c..947e70c424f 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java @@ -468,12 +468,8 @@ private static void setupBasicItemInfo(CustomItemDefinition definition, DataComp stackSize = 1; } } - // Bedrock's stack size can be at most 64 - if (stackSize > 64) { - stackSize = 64; - } - itemProperties.putInt("max_stack_size", stackSize); + itemProperties.putInt("max_stack_size", Math.min(stackSize, Item.BEDROCK_MAX_STACK_SIZE)); // Ignore durability if the item's predicates requires that it be unbreakable if (maxDamage > 0 && !isUnbreakableItem(definition)) { diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/custom/CustomItemContext.java b/core/src/main/java/org/geysermc/geyser/registry/populator/custom/CustomItemContext.java index 63541f0717c..791d15c77ae 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/custom/CustomItemContext.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/custom/CustomItemContext.java @@ -105,9 +105,9 @@ private static DataComponents checkComponents(CustomItemDefinition definition, I if (equippable != null && stackSize > 1 && firstPass) { GeyserImpl.getInstance().getLogger().warning("Bedrock doesn't support stackable equippable items! Custom item %s with stack size %s and equippable component for slot %s will not work as expected!" .formatted(definition.bedrockIdentifier(), stackSize, equippable.slot())); - } else if (stackSize > 64 && firstPass) { - GeyserImpl.getInstance().getLogger().warning("Bedrock doesn't support stack sizes above 64! Custom item %s with stack size %s will be clamped to 64!" - .formatted(definition.bedrockIdentifier(), stackSize)); + } else if (stackSize > Item.BEDROCK_MAX_STACK_SIZE && firstPass) { + GeyserImpl.getInstance().getLogger().warning("Bedrock doesn't support stack sizes above %s! Custom item %s with stack size %s will be clamped to %1$s!" + .formatted(Item.BEDROCK_MAX_STACK_SIZE, definition.bedrockIdentifier(), stackSize)); } else if (stackSize > 1 && maxDamage > 0) { throw new InvalidItemComponentsException("Stack size must be 1 when max damage is above 0"); }