Skip to content

Conversation

@kennytv
Copy link
Member

@kennytv kennytv commented Nov 21, 2024

Take an example from the data component api:

Equippable.Builder equippable = itemStack.getData(DataComponentTypes.EQUIPPABLE).toBuilder()
    .equipSound(Sound.ENTITY_GHAST_HURT.key());

For the equipment sound and similar methods taking some kind of key, we have wonderful Key classes that unfortunately aren't actually keys. So Sound.TYPE.key() ends up being less annoying to use than SoundEventKeys.TYPE.key() (though still annoying). Being able to actually use SoundEventKeys.TYPE as an argument makes it more likely for people to prefer it over the enums/enum-like registry values

Key extends Keyed, so this won't break existing plugins

@kennytv kennytv requested a review from a team as a code owner November 21, 2024 16:51
@lynxplay lynxplay merged commit f241260 into master Nov 23, 2024
6 checks passed
@lynxplay lynxplay deleted the typedkey-is-a-key branch November 23, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

4 participants