22
33import com .lambda .event .EventFlow ;
44import com .lambda .event .events .WorldEvent ;
5+ import com .lambda .module .modules .render .WorldColors ;
6+ import com .lambda .util .math .ColorUtils ;
57import net .minecraft .block .BlockState ;
68import net .minecraft .client .world .ClientWorld ;
79import net .minecraft .entity .Entity ;
810import net .minecraft .util .math .BlockPos ;
11+ import net .minecraft .util .math .Vec3d ;
912import org .spongepowered .asm .mixin .Mixin ;
1013import org .spongepowered .asm .mixin .injection .At ;
1114import org .spongepowered .asm .mixin .injection .Inject ;
1215import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
16+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
1317
1418@ Mixin (ClientWorld .class )
1519public class ClientWorldMixin {
@@ -24,4 +28,18 @@ private void handleBlockUpdateInject(BlockPos pos, BlockState state, int flags,
2428 private void addEntity (Entity entity , CallbackInfo ci ) {
2529 if (EventFlow .post (new WorldEvent .EntitySpawn (entity )).isCanceled ()) ci .cancel ();
2630 }
31+
32+ @ Inject (method = "getCloudsColor" , at = @ At ("HEAD" ), cancellable = true )
33+ private void getCloudsColorInject (float tickDelta , CallbackInfoReturnable <Vec3d > cir ) {
34+ if (WorldColors .INSTANCE .isEnabled () && WorldColors .getCustomClouds ()) {
35+ cir .setReturnValue (ColorUtils .getVec3d (WorldColors .getCloudColor ()));
36+ }
37+ }
38+
39+ @ Inject (method = "getSkyColor" , at = @ At ("HEAD" ), cancellable = true )
40+ private void getSkyColorInject (Vec3d cameraPos , float tickDelta , CallbackInfoReturnable <Vec3d > cir ) {
41+ if (WorldColors .INSTANCE .isEnabled () && WorldColors .getCustomSky ()) {
42+ cir .setReturnValue (ColorUtils .getVec3d (WorldColors .getSkyColor ()));
43+ }
44+ }
2745}
0 commit comments