-
Notifications
You must be signed in to change notification settings - Fork 405
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
Add builders for BlockSetType and WoodType to replace registries #3115
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds `BlockSetTypeBuilder` and `WoodTypeBuilder` to replace `BlockSetTypeRegistry` and `WoodTypeRegistry` respectively.
Technici4n
reviewed
Jun 12, 2023
.../src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/type/BlockSetTypeBuilder.java
Outdated
Show resolved
Hide resolved
Separated the register and build methods, with the former calling the latter. Their relationship is explained in the javadoc.
Technici4n
approved these changes
Jun 23, 2023
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.
Looks good, though someone else should check in an IDE that the names make sense.
.../src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/type/BlockSetTypeBuilder.java
Outdated
Show resolved
Hide resolved
modmuss50
approved these changes
Jun 23, 2023
.../src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/type/BlockSetTypeBuilder.java
Outdated
Show resolved
Hide resolved
modmuss50
pushed a commit
that referenced
this pull request
Jul 3, 2023
* Add builders for BlockSetType and WoodType to replace registries Adds `BlockSetTypeBuilder` and `WoodTypeBuilder` to replace `BlockSetTypeRegistry` and `WoodTypeRegistry` respectively. * whoops * double whoops * Register and Build now separate methods Separated the register and build methods, with the former calling the latter. Their relationship is explained in the javadoc. * Update BlockSetTypeBuilder.java Signed-off-by: modmuss50 <modmuss50@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
last call
If you care, make yourself heard right away!
merge me please
Pull requests that are ready to merge
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
BlockSetTypeBuilder
andWoodTypeBuilder
to replaceBlockSetTypeRegistry
andWoodTypeRegistry
respectively.The builder format is more suited to these as they have an large amount of values which aren't often changed.
BlockSetTypeRegistry
's register method in particular has a whopping 11 parameters, most of which are sound events that you'd have to try not to mess up the order on.Previously, if you wanted a
BlockSetType
that was identical toBlockSetType.OAK
except with custom button sounds and doors that require redstone to open, you'd have to write:Now you can write simply:
Much clearer what each value does (particularly the
openableByHand
boolean value!), no need to worry about getting the order wrong for the many sound events, and thecopyOf
method allows to skip things that are already set just how you want them.An added bonus is, that if Mojang decides to add new values to block set types or wood types (as they did in 1.20 by adding the openableByHand boolean!), where previously the already unwieldy
register
methods would need those new values added, changing the method signatures and making them even longer, now with the builder format we can simply add a new method.All the values default to those used by the shortform constructors of
BlockSetType
andWoodType
.The old registry classes are deprecated in favour of these builders.
This can be backported to 1.19.4 (would need references to the
openableByHand
boolean removed).