Skip to content

Some tidying up of constants#6389

Merged
valaphee merged 1 commit into
GeyserMC:masterfrom
valaphee:clean-up
May 11, 2026
Merged

Some tidying up of constants#6389
valaphee merged 1 commit into
GeyserMC:masterfrom
valaphee:clean-up

Conversation

@valaphee
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 11, 2026 07:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes a couple of previously hard-coded constants by reusing existing/shared values (e.g., Bedrock’s max stack size) and deriving a sentinel “invalid” enchantment ID from the current enum size.

Changes:

  • Replaced hard-coded Bedrock max stack size checks/clamps (64) with Item.BEDROCK_MAX_STACK_SIZE.
  • Updated the custom item validation warning to reference the max stack size constant in its message.
  • Made BedrockEnchantment.INVALID derive from the enum’s current size instead of a fixed literal.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java Uses Item.BEDROCK_MAX_STACK_SIZE when clamping custom item stack sizes.
core/src/main/java/org/geysermc/geyser/registry/populator/custom/CustomItemContext.java Uses Item.BEDROCK_MAX_STACK_SIZE for the “stack sizes above …” warning message.
core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java Derives the INVALID enchantment sentinel from the enum’s size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -469,8 +469,8 @@ private static void setupBasicItemInfo(CustomItemDefinition definition, DataComp
}
}
// Bedrock's stack size can be at most 64
Comment on lines 76 to 79
public static final int INVALID = BedrockEnchantment.values().length + 1;

private static final BedrockEnchantment[] VALUES = values();

Copy link
Copy Markdown
Member

@onebeastchris onebeastchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for following up!

Comment thread core/src/main/java/org/geysermc/geyser/inventory/item/BedrockEnchantment.java Outdated
Copilot AI review requested due to automatic review settings May 11, 2026 21:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@valaphee valaphee merged commit 38fa094 into GeyserMC:master May 11, 2026
6 checks passed
@valaphee valaphee deleted the clean-up branch May 11, 2026 22:15
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.

3 participants