Skip to content

DefaultedRegistryValue, Taggable & StringRepresentable expansion#2587

Closed
MrHell228 wants to merge 13 commits intoSpongePowered:api-14from
MrHell228:api-14-tag-expansion
Closed

DefaultedRegistryValue, Taggable & StringRepresentable expansion#2587
MrHell228 wants to merge 13 commits intoSpongePowered:api-14from
MrHell228:api-14-tag-expansion

Conversation

@MrHell228
Copy link
Copy Markdown
Contributor

@MrHell228 MrHell228 commented Apr 1, 2025

SpongeAPI | Sponge

QOL PR with big amount of lines but very small amont of actual changes.

List of changes:

  • Currently Taggable has registryType method, and I think it would be nice to have it for DefaultedRegistryValue too to be able to retrieve registry key just from value without need to pass registry. So old DefaultedRegistryValue methods moved to RegisryValue interface (i guess it makes sense).
  • #tags & #is in Taggable now defaulted so interface would be more friendly for plugin devs to use.
  • All DefaultedRegistryValue and Taggable subtypes now explicitly implement #registryType.
  • All vanilla registry types (except WorldType & WorldArchetypeType) implement Taggable because minecraft allows adding tags for them with data packs
  • A lot of registry types implement DefaultedRegistryValue because they were missing it
  • A lot of registry types implement StringRepresentable because they were missing it
  • Added missing builtin tag groups

If override RegistryValue methods in DefaultedRegistryValue, this whole PR shouldn't cause even binary breaking change. Don't know if it's needed though.

@MrHell228 MrHell228 force-pushed the api-14-tag-expansion branch from aed78da to 090b0d0 Compare April 1, 2025 16:12

/**
* A type that may be included in one or more {@link Tag} collections.
* A {@link DefaultedRegistryValue} that may be included in one or more {@link Tag} collections.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This feels like implementation creep onto the API where taggables must be defaulted registry values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah, I forgot to revert this line, sorry. (Taggable interface extends DefaultedRegsistryValue even without this PR though)

Comment thread src/main/java/org/spongepowered/api/registry/RegistryValue.java Outdated
@MrHell228 MrHell228 force-pushed the api-14-tag-expansion branch from 1c2f629 to 24fe544 Compare April 1, 2025 17:53
@MrHell228
Copy link
Copy Markdown
Contributor Author

Nuked RegistryValue interface.
Added overloads that take RegistryHolder for methods in DefaultedRegistryValue and Taggable.
Changed return type of Taggable#tags from Collection to Stream

@MrHell228 MrHell228 closed this Apr 5, 2025
@MrHell228 MrHell228 deleted the api-14-tag-expansion branch September 15, 2025 12:56
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