Skip to content

Commit 6843ae4

Browse files
committed
add weather changer
1 parent 7ec5217 commit 6843ae4

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

src/main/java/io/github/axolotlclient/config/AxolotlClientConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public class AxolotlClientConfig extends ConfigHolder {
106106
public final BooleanOption outlineChroma = new BooleanOption("chroma", false);
107107
public final DoubleOption outlineWidth = new DoubleOption("outlineWidth",1, 1, 10);
108108

109+
public final BooleanOption weatherChangerEnabled = new BooleanOption("enabled", false);
110+
public final EnumOption weather = new EnumOption("weather", new String[]{"clear", "rain"}, "clear");
111+
109112
public final GenericOption openCredits = new GenericOption("Credits", "Open Credits", (mouseX, mouseY)->
110113
MinecraftClient.getInstance().setScreen(new CreditsScreen(MinecraftClient.getInstance().currentScreen))
111114
);
@@ -118,6 +121,7 @@ public class AxolotlClientConfig extends ConfigHolder {
118121
public final OptionCategory outlines= new io.github.axolotlclient.AxolotlClientConfig.options.OptionCategory("blockOutlines");
119122
public final OptionCategory timeChanger = new io.github.axolotlclient.AxolotlClientConfig.options.OptionCategory("timeChanger");
120123
public final OptionCategory searchFilters = new io.github.axolotlclient.AxolotlClientConfig.options.OptionCategory("searchFilters");
124+
public final OptionCategory weatherChanger = new io.github.axolotlclient.AxolotlClientConfig.options.OptionCategory("weatherChanger");
121125

122126
private final List<Option<?>> options = new ArrayList<>();
123127
private final List<OptionCategory> categories = new ArrayList<>();
@@ -192,6 +196,10 @@ public void init(){
192196
outlines.add(outlineChroma);
193197
//outlines.add(outlineWidth); // I could not get this to have an effect.
194198

199+
weatherChanger.add(weatherChangerEnabled);
200+
weatherChanger.add(weather);
201+
rendering.add(weatherChanger);
202+
195203
AxolotlClient.config.add(creditsBGM);
196204

197205
}

src/main/java/io/github/axolotlclient/mixin/WorldRendererMixin.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
*
@@ -23,25 +23,23 @@
2323
package io.github.axolotlclient.mixin;
2424

2525
import com.mojang.blaze3d.systems.RenderSystem;
26-
import com.mojang.blaze3d.vertex.BufferBuilder;
27-
import com.mojang.blaze3d.vertex.VertexConsumer;
2826
import io.github.axolotlclient.AxolotlClient;
2927
import io.github.axolotlclient.modules.sky.SkyboxManager;
3028
import net.minecraft.client.MinecraftClient;
3129
import net.minecraft.client.render.Camera;
30+
import net.minecraft.client.render.LightmapTextureManager;
3231
import net.minecraft.client.render.WorldRenderer;
3332
import 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;
3634
import org.joml.Matrix4f;
37-
import org.lwjgl.opengl.GL11;
3835
import org.quiltmc.loader.api.QuiltLoader;
3936
import org.spongepowered.asm.mixin.Final;
4037
import org.spongepowered.asm.mixin.Mixin;
4138
import org.spongepowered.asm.mixin.Shadow;
4239
import org.spongepowered.asm.mixin.injection.At;
4340
import org.spongepowered.asm.mixin.injection.Inject;
4441
import org.spongepowered.asm.mixin.injection.ModifyArgs;
42+
import org.spongepowered.asm.mixin.injection.Redirect;
4543
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
4644
import 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
}

src/main/java/io/github/axolotlclient/util/FeatureDisabler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ public class FeatureDisabler {
5757
HashMap<String, BooleanOption> features = new HashMap<>();
5858
features.put("freelook", Freelook.getInstance().enabled);
5959
features.put("timechanger", AxolotlClient.CONFIG.timeChangerEnabled);
60+
features.put("lowfire", AxolotlClient.CONFIG.lowFire);
6061
features.put("fullbright", AxolotlClient.CONFIG.fullBright);
6162
return features;
6263
});
6364

6465
public static void init() {
6566
setServers(AxolotlClient.CONFIG.fullBright, NONE, "gommehd");
66-
setServers(AxolotlClient.CONFIG.timeChangerEnabled, NONE, "gommehd");
67+
setServers(AxolotlClient.CONFIG.lowFire, NONE, "gommehd");
6768
setServers(Freelook.getInstance().enabled, () -> Freelook.getInstance().needsDisabling(), "hypixel", "mineplex", "gommehd", "nucleoid");
6869
setServers(((ToggleSprintHud) HudManager.getInstance().get(ToggleSprintHud.ID)).toggleSneak, NONE, "hypixel");
6970

src/main/resources/assets/axolotlclient/lang/en_us.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"category.axolotlclient": "AxolotlClient",
8080
"chathud": "Chat HUD",
8181
"chromaSpeed": "Chroma Speed",
82+
"clear": "Clear",
8283
"clickToCopy": "Click to Copy",
8384
"close": "Close",
8485
"cloudHeight": "Cloud Height",
@@ -236,6 +237,7 @@
236237
"printGF": "Print GF",
237238
"printGG": "Print GG",
238239
"printGLHF": "Print GLHF",
240+
"rain": "Rain / Snow",
239241
"randomPlaceholder": "Random Placeholder",
240242
"reachhud": "Reach HUD",
241243
"refreshTime": "Refresh Delay",
@@ -326,6 +328,8 @@
326328
"upload_image": "Upload this image.",
327329
"useShadows": "Force Shadows",
328330
"viewScreenshot": "View shared Screenshot",
331+
"weather": "Weather",
332+
"weatherChanger": "Weather Changer",
329333
"width": "Width",
330334
"zoom": "Zoom",
331335
"zoomDivisor": "FOV Divisor",

0 commit comments

Comments
 (0)