Skip to content
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

[1.21] Field Registraction Adjustments #268

Conversation

Dragon-Seeker
Copy link
Member

Adjusts the Field registration API to handle Registry Entries combined with a supplier method of deferred registration

- Inject supplier into RegistryEntry
- MemoizedSupplier's that caches the first get call made to the supplier
- Made such abstract classes instead of interfaces to allow for direct calls to entry method on AutoRegistryContainer
- Fix MemoizedEntry name
- Move iterateAccessibleStaticFieldsAllowingMemorizedSuppliers to FieldRegistrationHandler
@Dragon-Seeker
Copy link
Member Author

Note: This will cause breaking changes fyi

src/main/resources/fabric.mod.json Outdated Show resolved Hide resolved
import java.util.function.Supplier;

public class MemoizedEntry<T> implements Supplier<T> {

Copy link
Contributor

Choose a reason for hiding this comment

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

is this class needed if there already is a helper method on AutoRegistryContainer for making a MemoizedRegistryEntry? any people who only want a supplier can still use the registry entry class since you made it extend supplier

src/main/java/io/wispforest/owo/util/ReflectionUtils.java Outdated Show resolved Hide resolved
@Dragon-Seeker Dragon-Seeker mentioned this pull request Oct 11, 2024
@Dragon-Seeker
Copy link
Member Author

Closing this as such changes with Item, Block, and EntityType basically make it nearly impossible to use AutoRegistryContainer tbh

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