-
-
Notifications
You must be signed in to change notification settings - Fork 308
feat: Using Block Registry to Replace Iterating Over the Material Enum #3057
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
feat: Using Block Registry to Replace Iterating Over the Material Enum #3057
Conversation
|
I would point out that (iirc) Spigot (and paper) plan to replace enums for materials with a registry of similar sorts (this has already been done for biomes). |
|
I assume this is supposed to fix #3060? In that case, I'd be fine with the change, at least until spigot marks it BlockType class/Block registry as non-internal. |
I'm not sure, I feel we'd have more reports if there was a consistent issue? It should only be an issue if Spigot/Paper have stopped maintaining the Material enum for some reason... Regardless, the API-breaking change needs to go |
worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java
Show resolved
Hide resolved
|
I'd like to test with P2 first as I'm not fully convinced this will allow data to be available at the point it's needed there |
dordsor21
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.
Took a second to give it a test, but looks to be working. lgtm
The Material in Bukkit is an enum, which is not very flexible. This PR replaces it with Minecraft's built-in block registry to reduce unnecessary checks. Additionally, it changes values() to getAllDefaultBlockStates() to improve readability.