-
Notifications
You must be signed in to change notification settings - Fork 23
Feature/register helper #146
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
Conversation
calmilamsy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, this is a HUGE QoL improvement.
| Registry.register(PacketTypeRegistry.INSTANCE, NAMESPACE.id("items/entity_spawn"), StationItemEntitySpawnS2CPacket.TYPE); | ||
| Registry.register(PacketTypeRegistry.INSTANCE, NAMESPACE.id("items/interact"), StationPlayerInteractBlockC2SPacket.TYPE); | ||
| Registry.register(PacketTypeRegistry.INSTANCE, NAMESPACE.id("items/slot_update"), StationScreenHandlerSlotUpdateS2CPacket.TYPE); | ||
| BulkBiConsumer.of((String id, PacketType<?> type) -> Registry.register(PacketTypeRegistry.INSTANCE, NAMESPACE.id(id), type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be an idea to add a helper method inside Registry that just requires the registry instance and returns this for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, didn't think of that.
…and redirected event method helpers to that.
…he original method arguments.
* Switched from HMI to RetroCommands * Removed broken reimplementation of Divisor's old PlayerAPI. (#139) * Removed Indigo renderer (#140) * Updated UnsafeEvents * ContextVariable * ContextVariable#get * Feature/register helper (#146) * Added register helper methods to RegistryEvent * Remove unused BulkConsumer. * Updated all registries to be entry type bound. * Updated all usages of Registry#register to new helper methods where applicable. * Moved bulk registration helpers implementation to Registry interface and redirected event method helpers to that. * Swapped namespace and rawIdGetter placements so they better reflect the original method arguments. * cleanup/java-hacks (#145) * Cleaned up Java hacks related to entrypoints * Removed EnumFactory. * Removed NativeImage Unsafe buffer cleaner invocation. * Replaced fake BlockItem with null, since MixinExtras allows that, unlike vanilla Mixin's Redirect. * Removed UnsafeProvider. * Updated javadoc for EntrypointManager#registerLookup * Fix a NPE in shears override * Fix a NPE in FuelRegistry * Added StationFlatteningBlock#onStateReplaced * Fixed #159 * Change version
* Switched from HMI to RetroCommands * Removed broken reimplementation of Divisor's old PlayerAPI. (#139) * Removed Indigo renderer (#140) * Updated UnsafeEvents * ContextVariable * ContextVariable#get * Feature/register helper (#146) * Added register helper methods to RegistryEvent * Remove unused BulkConsumer. * Updated all registries to be entry type bound. * Updated all usages of Registry#register to new helper methods where applicable. * Moved bulk registration helpers implementation to Registry interface and redirected event method helpers to that. * Swapped namespace and rawIdGetter placements so they better reflect the original method arguments. * cleanup/java-hacks (#145) * Cleaned up Java hacks related to entrypoints * Removed EnumFactory. * Removed NativeImage Unsafe buffer cleaner invocation. * Replaced fake BlockItem with null, since MixinExtras allows that, unlike vanilla Mixin's Redirect. * Removed UnsafeProvider. * Updated javadoc for EntrypointManager#registerLookup * Fix a NPE in shears override * Fix a NPE in FuelRegistry * Added StationFlatteningBlock#onStateReplaced * Fixed #159 * Change version * Merge pull request #165 from ThexXTURBOXx/develop Don't close filesystems when resolving mod namespaces * Update modmenu * Merge pull request #168 * Yeet * Wait this is wrong * Merge branch 'develop' into namespace-change * Make stapi get angree (#169) * Update BiomeMixin.java (#196) * Add Block Support to CustomTooltipProvider (#187) * Add Block support to CustomTooltipProvider * Add some documentation to the interface * Make Leaves' Log Check Work With Modded Logs and Leaves (#186) * Fix * And comment this out cause it's ugly * Fix (#185) * FUCK (#200) * Why mine (#197) * Potentially make mine scream (#188) * Implement onBonemealUse on Vanilla Crops (#170) * Yeet * Also do sapling, also fix multiplayer * Use the appropriate random --------- Co-authored-by: mineLdiver <aabesedin@mail.ru> * Fixed cal L moment (cascaded test worldgen) * Change version --------- Co-authored-by: Nico Mexis <nico.mexis@kabelmail.de> Co-authored-by: calmilamsy <bumbill00@gmail.com>
Added helper methods for registering new entries to registries.
Examples:
The event methods are only available in a subclass of RegistryEvent, specifically RegistryEvent.EntryTypeBound, because the RegistryEvent doesn't define the registry's entry generic type (so Block for BlockRegistry), making it impossible to implement type-safe helper methods. Defining the generic type in a subclass allows to introduce these helper methods in a backwards-compatible way. All StationAPI registry events were updated to extend RegistryEvent.EntryTypeBound, and all usages of
Registry#registerwere changed to the helper methods where applicable.