Skip to content

Fix CustomModelData for paper#231

Merged
Maxlego08 merged 3 commits intoMaxlego08:developfrom
1robie:developement
Mar 18, 2026
Merged

Fix CustomModelData for paper#231
Maxlego08 merged 3 commits intoMaxlego08:developfrom
1robie:developement

Conversation

@1robie
Copy link
Copy Markdown
Collaborator

@1robie 1robie commented Mar 17, 2026

This pull request refactors and improves the handling of the CustomModelDataComponent across the codebase, with a particular focus on simplifying data structures and adding better support for Paper/Folia servers. The main changes include removing the use of Optional for component lists, improving data loading logic, and introducing Paper-specific implementations for custom model data components.

Refactoring and simplification of CustomModelDataComponent:

  • Removed the use of Optional for the colors, flags, floats, and strings fields in CustomModelDataComponent, replacing them with non-optional lists and updating constructors and getters accordingly. This simplifies the API and usage throughout the codebase.
  • Updated the apply method in CustomModelDataComponent to check for non-empty lists instead of using Optional.ifPresent, ensuring properties are only set when data is present.

Component loader improvements:

  • Refactored SpigotCustomModelDataItemComponentLoader to remove all Optional usage, streamline list extraction, and add helper methods (getFloats, getBooleans, getStrings, getColors) for cleaner and more maintainable code. [1] [2]
  • Added a new PaperCustomModelDataComponentLoader that extends the Spigot loader and constructs a Paper-specific CustomModelData using the Paper API, enabling enhanced support for Paper/Folia servers.
  • Introduced a new PaperCustomModelDataComponent class that applies the Paper CustomModelData to item stacks.

General codebase cleanup:

  • Removed the unused MenuItemStackFormMap class, cleaning up legacy or unnecessary code.

Plugin initialization logic:

  • Modified the component registration logic to use the new PaperCustomModelDataComponentLoader when running on Paper or Folia, ensuring the correct loader is used based on the server type.

@Maxlego08 Maxlego08 merged commit a93f70c into Maxlego08:develop Mar 18, 2026
2 checks passed
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.

2 participants