11/*
2- * Copyright © 2021-2022 moehreag <[email protected] > & Contributors 2+ * Copyright © 2021-2023 moehreag <[email protected] > & Contributors 33 *
44 * This file is part of AxolotlClient.
55 *
2323package io .github .axolotlclient .mixin ;
2424
2525import com .mojang .blaze3d .systems .RenderSystem ;
26- import com .mojang .blaze3d .vertex .BufferBuilder ;
27- import com .mojang .blaze3d .vertex .VertexConsumer ;
2826import io .github .axolotlclient .AxolotlClient ;
2927import io .github .axolotlclient .modules .sky .SkyboxManager ;
3028import net .minecraft .client .MinecraftClient ;
3129import net .minecraft .client .render .Camera ;
30+ import net .minecraft .client .render .LightmapTextureManager ;
3231import net .minecraft .client .render .WorldRenderer ;
3332import net .minecraft .client .util .math .MatrixStack ;
34- import net .minecraft .util .math .Vec3d ;
35- import net .minecraft .util .shape .VoxelShape ;
33+ import net .minecraft .client .world .ClientWorld ;
3634import org .joml .Matrix4f ;
37- import org .lwjgl .opengl .GL11 ;
3835import org .quiltmc .loader .api .QuiltLoader ;
3936import org .spongepowered .asm .mixin .Final ;
4037import org .spongepowered .asm .mixin .Mixin ;
4138import org .spongepowered .asm .mixin .Shadow ;
4239import org .spongepowered .asm .mixin .injection .At ;
4340import org .spongepowered .asm .mixin .injection .Inject ;
4441import org .spongepowered .asm .mixin .injection .ModifyArgs ;
42+ import org .spongepowered .asm .mixin .injection .Redirect ;
4543import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
4644import org .spongepowered .asm .mixin .injection .invoke .arg .Args ;
4745
@@ -58,8 +56,6 @@ public abstract class WorldRendererMixin {
5856 @ Final
5957 private MinecraftClient client ;
6058
61- @ Shadow protected abstract BufferBuilder .RenderedBuffer renderClouds (BufferBuilder builder , double x , double y , double z , Vec3d color );
62-
6359 @ Inject (method = "renderSky" , at = @ At ("HEAD" ), cancellable = true )
6460 public void axolotlclient$renderSky (MatrixStack matrices , Matrix4f projectionMatrix , float tickDelta , Camera preStep , boolean bl ,
6561 Runnable runnable , CallbackInfo ci ) {
@@ -90,4 +86,21 @@ public abstract class WorldRendererMixin {
9086 args .set (9 , a );
9187 }
9288 }
89+
90+ @ Inject (method = "renderWeather" , at = @ At ("HEAD" ), cancellable = true )
91+ private void axolotlclient$changeWeather (LightmapTextureManager manager , float tickDelta , double cameraX , double cameraY , double cameraZ , CallbackInfo ci ){
92+ if (AxolotlClient .CONFIG .weatherChangerEnabled .get ()){
93+ if (AxolotlClient .CONFIG .weather .get ().equals ("clear" )){
94+ ci .cancel ();
95+ }
96+ }
97+ }
98+
99+ @ Redirect (method = "renderWeather" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/world/ClientWorld;getRainGradient(F)F" ))
100+ private float axolotlclient$changeWeather$3 (ClientWorld instance , float v ){
101+ if (AxolotlClient .CONFIG .weatherChangerEnabled .get () && !AxolotlClient .CONFIG .weather .get ().equals ("clear" )) {
102+ return 100 ;
103+ }
104+ return MinecraftClient .getInstance ().world .getRainGradient (v );
105+ }
93106}
0 commit comments