-
Notifications
You must be signed in to change notification settings - Fork 774
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
Added biome color cache support for custom color resolver #2222
Conversation
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
I don't think the solution is to duplicate code paths for "custom" and "vanilla" color resolvers, since it's fundamentally the same interface being used. There should just be one code path, and a |
Sorry for my carelessness, I'll change the code as soon as possible |
Merge "custom" and "vanilla" color resolvers. Fixed issue where custom resolvers would always use the default grass color.
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.
The abstract of this looks good, just some performance concerns.
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
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.
Performance optimization
src/main/java/me/jellysquid/mods/sodium/client/world/biome/BiomeColorCache.java
Outdated
Show resolved
Hide resolved
- Utilize Reference2ReferenceOpenHashMap: Replaced the usage of `HashMap` with `Reference2ReferenceOpenHashMap`. - Slice Initialization Refactoring: Extracted the slice initialization branch into a new function called `initializeSlices`. - Enhanced Populated Status Check: Implemented an incremental flag `populateStamp` (without loops) to check for populated status, replacing the reliance on two nested for-loops.
All requested changes have been implemented |
Thanks for the contribution. It is worth mentioning that Fabric API is considering implementing an interface for mods to use custom ColorResolvers (since vanilla currently doesn't allow this, and Sodium is exposing additional functionality) but this should not affect your patch at all. |
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 from my end as well.
Will this be added to previous version aswell? |
Currently there's no back-porting policy (see #2230). But we'll likely publish future versions of Sodium 0.5.x for both MC 1.20.1 (LTS) and MC 1.20.4 (Latest) in the meanwhile. |
Added biome color cache support for custom color resolver.
WorldSlice#getColor
can now be invoked with a customColorResolver
.WorldSlice#getColor
cannot be called with custom ColorResolvers #2166