Skip to content

Expand Custom Model Data syntaxes to support new CMD component #7807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev/feature
Choose a base branch
from

Conversation

sovdeeth
Copy link
Member

Description

All previous behavior should remain the same.
In 1.21.4+:

  • with model data %...% now supports numbers, strings, booleans, and colors.
  • ExprCustomModelData has 3 modes
    • back compat: custom model data of {_x}. This remains the same as previous versions, a single int value. Setting this will remove any other CMD data on the item.
    • single type: custom model data (floats|flags|strings|colors) of {_x}. This returns a list of the given type from the custom model data and supports all changers.
    • all types: (full|complete) custom model data of {_x}. This returns a list of all the values in the CMD, in float-flag-string-color order. This supports all changers.
  • CondHasCustomModelData allows checking for any custom model data, or for specific types of custom model data.

Target Minecraft Versions: any
Requirements: none
Related Issues: #7782

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Apr 17, 2025
@sovdeeth sovdeeth requested a review from a team as a code owner April 17, 2025 22:36
@sovdeeth sovdeeth requested review from Efnilite and cheeezburga and removed request for a team April 17, 2025 22:36
Copy link
Contributor

@Burbulinis Burbulinis left a comment

Choose a reason for hiding this comment

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

i like this :) lgtm

@sovdeeth sovdeeth requested a review from Efnilite April 22, 2025 17:32
@Since("2.5")
@Example("player's tool has custom model data")
@Since("2.5, INSERT VERSION (expanded data types)")
@RequiredPlugins("1.21.4+ (floats/flags/strings/colours)")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@RequiredPlugins("1.21.4+ (floats/flags/strings/colours)")
@RequiredPlugins("Minecraft 1.21.4+ (floats/flags/strings/colours)")

@Example("""
set the full custom model data of {_item} to 10, "sword", and rgb(100, 200, 30)
""")
@RequiredPlugins("1.21.4+ (floats/flags/strings/colours/full model data)")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@RequiredPlugins("1.21.4+ (floats/flags/strings/colours/full model data)")
@RequiredPlugins("Minecraft 1.21.4+ (floats/flags/strings/colours/full model data)")

@Example("give player a diamond sword with custom model data 2")
@Example("set slot 1 of inventory of player to wooden hoe with custom model data 357")
@Example("give player a diamond hoe with custom model data 2, true, true, \"scythe\", and rgb(0,0,100)")
@RequiredPlugins("1.21.4+ (boolean/string/color support)")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@RequiredPlugins("1.21.4+ (boolean/string/color support)")
@RequiredPlugins("Minecraft 1.21.4+ (boolean/string/color support)")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants