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] Bedrock Sun Glare and Sky Color #224
[feat] Bedrock Sun Glare and Sky Color #224
Conversation
The feature of Bedrock Sun Glare and Sky Color. This is enabled by the `sunlightIntensity` value and `bedrockShading` option in the Visual Improvements settings. * new configurable parameters - int `BedrockifyClientSettings#sunlightIntensity`: 0 - 100, default 50 * update `lang/en_us.json` - edit `bedrockify.options.bedrockShading` - add `bedrockify.options.sunlightIntensity` - add tooltip texts: + `bedrockify.options.bedrockShading.tooltip` + `bedrockify.options.sunlightIntensity.tooltip` * update `BedrockifyClientSettings` - add a field `sunlightIntensity` * update `SettingsGUI` - add tooltip for the options: + `bedrockShading` + `sunlightIntensity` * registered new mixins - `mixin.client.features.bedrockShading.sunGlare.ClientWorldMixin` + to modify the Sky color - `mixin.client.features.bedrockShading.sunGlare.WorldRendererMixin` + to modify the Sun radius * moved mixins - `mixin.client.features.bedrockShading.AbstractQuadRendererMixin` -> `lightBlock.AbstractQuadRendererMixin` - `mixin.client.features.bedrockShading.BlockModelRendererMixin` -> `lightBlock.BlockModelRendererMixin` - `mixin.client.features.bedrockShading.FluidRendererMixin` -> `lightBlock.FluidRendererMixin` * new files - `client.features.bedrockShading.BedrockSunGlareShading` + helper class that calculate angle diff
Make it compatible with shader mods. * update `BedrockSunGlareShading` - inner classes: + enum `ShaderState`: shows the state of custom shader + class `ClassMethodHolder`: holds class name, method name, args and predicate - fields: + ShaderState `shaderState`: to determine the state of custom shader + Map `MOD_ID_CLASS_MAP`: uses with Reflection - methods: + void `reloadCustomShaderState`: notifies changed the shader state + boolean `isEnabled` -> `shouldApplyShading`: gets whether can apply this feature + ShaderState `fetchShaderStateInternal`: gets the state of custom shader * update `mixin.client.features.bedrockShading.sunGlare.WorldRendererMixin` - new method `bedrockify$reloadWorldRendererCallback`: to reload the state of custom shader
Adds a test case to be compatible with Iris shaders using Reflection. * update dependencies - `build.gradle` + fabric loom 1.1-SNAPSHOT + add a sourceSet of the test + add Modrinth's maven repo + add Iris, JUnit - `gradle.properties` + add a property of Iris version * new files - `test.client.features.bedrockShading.sunGlare.IrisCompatTest` + > ./gradlew test
Update the sun vector after client tick due to the sun does not move so fast. Update the dot product only once when executed `WorldRenderer#renderSky`. * update `BedrockSunGlareShading` - fields: + float `sunAngleDiff` + Vector3f `sunVector3f` + MinecraftClient `client` - methods: + void `tick` + void `updateAngleDiff` + static float `getSunAngleDiffClamped(float)` -> float `getSunAngleDiff()` * update `BedrockifyClient` - register a new method in `END_CLIENT_TICK`: + `BedrockSunGlareShading#tick` * update `WorldRendererMixin` - method name has changed: `bedrockify$storeSunAngleDiff` -> `bedrockify$updateSunAngleDiff` - mixin injection point has changed: `HEAD` -> `BEFORE_INVOKE` target = `ClientWorld#getSkyColor`
* update `en_us.json` - the word "vanilla rendering" might not be user friendly * update `IrisCompatTest.java` - add JavaDoc - add affected class info to error message * update `BedrockSunGlareShading.java` - update JavaDoc - add new const: ClassMethodHolder `ClassMethodHolder#CONDITION_TRUE` * update `ClientWorldMixin.java` - does not require to extend super class
I know there is another way to inject into other mods that uses If more flexibility is needed in the future version, this may be discussed as a way to also obtain the sun angle that is changed by the shaders. |
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.
I've finally been able to take a look at it, sorry for the delay... Looks great, works great. Thanks :)
close #110
The feature of Bedrock Sun Glare and Sky Color. This is enabled by the
sunlightIntensity
value andbedrockShading
option in the Visual Improvements settings.Translation keys have been updated. Please check
lang/en_us.json
.Behavior
This is disabled by default when the external shader is turned on. It cannot be forced to be enabled at the moment.
Use Reflection to detect whether the external shader is present or not.
bedrockShading
package.Changes
new configurable parameter
BedrockifyClientSettings#sunlightIntensity
: 0 - 100, default 50update dependencies
build.gradle
gradle.properties
update
lang/en_us.json
bedrockify.options.bedrockShading
bedrockify.options.sunlightIntensity
bedrockify.options.bedrockShading.tooltip
bedrockify.options.sunlightIntensity.tooltip
update
SettingsGUI
bedrockShading
sunlightIntensity
update
BedrockifyClient
END_CLIENT_TICK
:BedrockSunGlareShading#tick
registered new mixins
mixin.client.features.bedrockShading.sunGlare.ClientWorldMixin
mixin.client.features.bedrockShading.sunGlare.WorldRendererMixin
moved mixins
mixin.client.features.bedrockShading.AbstractQuadRendererMixin
->lightBlock.AbstractQuadRendererMixin
mixin.client.features.bedrockShading.BlockModelRendererMixin
->lightBlock.BlockModelRendererMixin
mixin.client.features.bedrockShading.FluidRendererMixin
->lightBlock.FluidRendererMixin
new files
client.features.bedrockShading.BedrockSunGlareShading
test.client.features.bedrockShading.sunGlare.IrisCompatTest