Skip to content

Conversation

@aromaa
Copy link
Member

@aromaa aromaa commented Feb 26, 2025

Sponge | SpongeAPI

Notable changes:

  • Template's have been removed.
    • Builders have been moved to the registry types.
    • If someone wishes, they can still serialize (if possible) the types marked as DataPackSerializable to a DataView.
  • DataPack has been removed.
    • Replacement can be implemented in follow-up PR if desired.
  • RegisterDataPackValueEvent removed
    • New types are registered directly to the registries.
      • Everything is purely runtime only and transient.
  • Commands now operate at the server registry layer.
    • CommandRegistrarType takes in RegistryHolder.
    • CommandTreeNodeTypes is now only available in the server layer.
      • Command.Raw#commandTree takes in RegistryHolder.
    • ResourceKeyedValueParameters remains in the game layer.
      • Parameters that require registry data can be defined using ValueParameter.Bindable.
  • RegisterRegistryEvent & RegisterRegistryValueEvent improvements.
    • Registries can now depend on other registries, allowing chaining.
    • RegisterRegistryValueEvent may be called multiple times in the same layer as registries are being appended or reloaded.
      • Plugins wanting to modify specific registry call the #registry method and the implementation consumes the consumer if appropriate.
      • Helper type RegistryRegistrationSet<T> avoids invalid use cases.
  • Registries that have no vanilla equivalent, a Sponge one has been added in-place to iterate and add new entries.
    • Recipes
    • Advancements
  • Loading of custom worlds is now explicitly required as WorldTemplete is gone.
    • Loading and creation of new world is made easier using the ServerWorldProperties.LoadOptions type.
  • AdvancementTreeEvent.GenerateLayout now exposes the RegistryHolder that contains the updated registry data.

@aromaa aromaa changed the title WIP registry rework Registry rework Mar 6, 2025
@aromaa aromaa marked this pull request as ready for review March 6, 2025 23:15
*
* @return The stream
*/
Stream<Registry<?>> streamRegistries();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just registries? Rename the below to that but has the parameter

Copy link
Member Author

Choose a reason for hiding this comment

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

We seem to prefer the stream prefix, leaving this as is as other relevant files have it too. We could revisit that at some point and change them all at once.

@MrHell228
Copy link
Contributor

MrHell228 commented Mar 7, 2025

Due to datapack entries being added only at runtime now, I guess this builder shouldn't require providing a way to (de)serialize anymore. Don't know if it would be better to make it optional or completely remove though

@aromaa
Copy link
Member Author

aromaa commented Mar 7, 2025

The Trigger stuff has been runtime only-ish since its introduction. There seems to be some overlap and would need more investigation on whats happening there. It would be more ideal as follow up than trying to squeeze it here.

aromaa added 2 commits March 7, 2025 22:05
These should go to 12. 'Inherited' from the Sponge root project.
@aromaa aromaa merged commit 7dd5188 into api-14 Mar 8, 2025
9 checks passed
@aromaa aromaa deleted the api14/registry-rework branch March 8, 2025 12: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