Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 4dd9031

Browse files
committed
the skies are working now
1 parent 35c9b18 commit 4dd9031

File tree

8 files changed

+168
-60
lines changed

8 files changed

+168
-60
lines changed

run/options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ ao:2
3838
prioritizeChunkUpdates:0
3939
biomeBlendRadius:2
4040
renderClouds:"false"
41-
resourcePacks:["vanilla","file/testpack","programer_art"]
42-
incompatibleResourcePacks:["file/testpack"]
41+
resourcePacks:["vanilla","file/testpack","file/astralex-sky-overlay-for-1-8--sgdsdrgdyhd38745634867djhfkgkdyh.zip"]
42+
incompatibleResourcePacks:["file/testpack","file/astralex-sky-overlay-for-1-8--sgdsdrgdyhd38745634867djhfkgkdyh.zip"]
4343
lastServer:
4444
lang:en_us
4545
soundDevice:""

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ public class AxolotlClientConfig {
1818

1919
public final BooleanOption customSky = new BooleanOption("customSky", true);
2020
public final BooleanOption showSunMoon = new BooleanOption("showSunMoon", true);
21-
public final IntegerOption cloudHeight = new IntegerOption("cloudHeight", 128, 100, 512);
22-
public final FloatOption zoomDivisor = new FloatOption("zoomDivisor", 1F, 10F, 4F);
21+
public final BooleanOption customCloudHeight = new BooleanOption("customCloudHeight", false);
22+
public final FloatOption cloudHeight = new FloatOption("cloudHeight", 192F, 100F, 512F);
23+
public final FloatOption zoomDivisor = new FloatOption("zoomDivisor", 1F, 50F, 4F);
2324
public final IntegerOption zoomSpeed = new IntegerOption("zoomSpeed", 5, 1, 10);
2425
public final BooleanOption decreaseSensitivity = new BooleanOption("decreaseSensitivity", true);
2526
public final BooleanOption dynamicFOV = new BooleanOption("dynamicFov", true);
@@ -105,6 +106,7 @@ public void init(){
105106

106107
rendering.add(customSky);
107108
rendering.add(showSunMoon);
109+
rendering.add(customCloudHeight);
108110
rendering.add(cloudHeight);
109111
rendering.add(chromaSpeed);
110112
rendering.add(dynamicFOV);

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

Lines changed: 0 additions & 22 deletions
This file was deleted.

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

Lines changed: 150 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
package io.github.axolotlclient.mixin;
22

3+
import com.mojang.blaze3d.platform.GlStateManager;
4+
import com.mojang.blaze3d.systems.RenderSystem;
5+
import com.mojang.blaze3d.vertex.BufferBuilder;
6+
import com.mojang.blaze3d.vertex.BufferRenderer;
7+
import com.mojang.blaze3d.vertex.Tessellator;
38
import com.mojang.blaze3d.vertex.VertexBuffer;
9+
import com.mojang.blaze3d.vertex.VertexFormat;
10+
import com.mojang.blaze3d.vertex.VertexFormats;
411
import io.github.axolotlclient.AxolotlClient;
512
import io.github.axolotlclient.modules.sky.SkyboxManager;
613
import net.minecraft.client.MinecraftClient;
7-
import net.minecraft.client.render.*;
14+
import net.minecraft.client.render.BackgroundRenderer;
15+
import net.minecraft.client.render.Camera;
16+
import net.minecraft.client.render.GameRenderer;
17+
import net.minecraft.client.render.ShaderProgram;
18+
import net.minecraft.client.render.SkyProperties;
19+
import net.minecraft.client.render.WorldRenderer;
820
import net.minecraft.client.util.math.MatrixStack;
921
import net.minecraft.client.world.ClientWorld;
1022
import net.minecraft.util.Identifier;
23+
import net.minecraft.util.math.MathHelper;
1124
import net.minecraft.util.math.Matrix4f;
25+
import net.minecraft.util.math.Vec3d;
26+
import net.minecraft.util.math.Vec3f;
1227
import org.jetbrains.annotations.Nullable;
1328
import org.spongepowered.asm.mixin.Final;
1429
import org.spongepowered.asm.mixin.Mixin;
@@ -39,33 +54,145 @@ public abstract class MixinWorldRenderer {
3954

4055
@Shadow @Nullable private VertexBuffer darkSkyBuffer;
4156

42-
@Shadow protected abstract void renderEndSky(MatrixStack matrices);
57+
@Shadow @Nullable private VertexBuffer lightSkyBuffer;
4358

44-
@Shadow protected abstract boolean method_43788(Camera camera);
59+
@Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;disableTexture()V"), cancellable = true)
60+
public void renderSky(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera preStep, boolean bl, Runnable runnable, CallbackInfo ci){
61+
if(AxolotlClient.CONFIG.customSky.get() && SkyboxManager.getInstance().hasSkyBoxes()) {
62+
RenderSystem.disableTexture();
63+
Vec3d vec3d = this.world.getSkyColor(this.client.gameRenderer.getCamera().getPos(), tickDelta);
64+
float f = (float) vec3d.x;
65+
float g = (float) vec3d.y;
66+
float h = (float) vec3d.z;
67+
BackgroundRenderer.setShaderFogColor();
68+
BufferBuilder bufferBuilder = Tessellator.getInstance().getBufferBuilder();
69+
RenderSystem.depthMask(false);
70+
RenderSystem.setShaderColor(f, g, h, 1.0F);
71+
ShaderProgram shaderProgram = RenderSystem.getShader();
72+
this.lightSkyBuffer.bind();
73+
this.lightSkyBuffer.setShader(matrices.peek().getPosition(), projectionMatrix, shaderProgram);
74+
VertexBuffer.unbind();
4575

46-
/*@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/render/Camera;)V"))
47-
public void idkRenderMySkies(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f projectionMatrix, CallbackInfo ci){
48-
if(AxolotlClient.CONFIG.customSky.get() && SkyboxManager.getInstance().hasSkyBoxes()){
49-
MinecraftClient.getInstance().getProfiler().swap("Custom Skies");
50-
//BackgroundRenderer.clearFog();
76+
this.client.getProfiler().push("Custom Skies");
5177
SkyboxManager.getInstance().renderSkyboxes(matrices);
52-
//MinecraftClient.getInstance().getProfiler().pop();
53-
}
54-
}*/
55-
56-
@Inject(method = "renderSky",
57-
at=@At(value = "HEAD"),
58-
cancellable = true)
59-
public void sky(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera preStep, boolean bl, Runnable runnable, CallbackInfo ci){
60-
//runnable.run();
61-
if(AxolotlClient.CONFIG.customSky.get() && SkyboxManager.getInstance().hasSkyBoxes()){
62-
MinecraftClient.getInstance().getProfiler().swap("Custom Skies");
63-
BackgroundRenderer.clearFog();
64-
SkyboxManager.getInstance().renderSkyboxes(matrices);
65-
//MinecraftClient.getInstance().getProfiler().pop();
78+
79+
this.client.getProfiler().pop();
80+
81+
RenderSystem.enableBlend();
82+
RenderSystem.defaultBlendFunc();
83+
float[] fs = this.world.getSkyProperties().getFogColorOverride(this.world.getSkyAngle(tickDelta), tickDelta);
84+
if (fs != null) {
85+
RenderSystem.setShader(GameRenderer::getPositionColorShader);
86+
RenderSystem.disableTexture();
87+
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
88+
matrices.push();
89+
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90.0F));
90+
float i = MathHelper.sin(this.world.getSkyAngleRadians(tickDelta)) < 0.0F ? 180.0F : 0.0F;
91+
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(i));
92+
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90.0F));
93+
float j = fs[0];
94+
float k = fs[1];
95+
float l = fs[2];
96+
Matrix4f matrix4f = matrices.peek().getPosition();
97+
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
98+
bufferBuilder.vertex(matrix4f, 0.0F, 100.0F, 0.0F).color(j, k, l, fs[3]).next();
99+
int m = 16;
100+
101+
for (int n = 0; n <= 16; ++n) {
102+
float o = (float) n * (float) (Math.PI * 2) / 16.0F;
103+
float p = MathHelper.sin(o);
104+
float q = MathHelper.cos(o);
105+
bufferBuilder.vertex(matrix4f, p * 120.0F, q * 120.0F, -q * 40.0F * fs[3]).color(fs[0], fs[1], fs[2], 0.0F).next();
106+
}
107+
108+
BufferRenderer.drawWithShader(bufferBuilder.end());
109+
matrices.pop();
110+
}
111+
112+
RenderSystem.enableTexture();
113+
RenderSystem.blendFuncSeparate(GlStateManager.class_4535.SRC_ALPHA, GlStateManager.class_4534.ONE, GlStateManager.class_4535.ONE, GlStateManager.class_4534.ZERO);
114+
115+
116+
if(AxolotlClient.CONFIG.showSunMoon.get()) {
117+
matrices.push();
118+
float i = 1.0F - this.world.getRainGradient(tickDelta);
119+
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, i);
120+
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
121+
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(this.world.getSkyAngle(tickDelta) * 360.0F));
122+
Matrix4f matrix4f2 = matrices.peek().getPosition();
123+
float k = 30.0F;
124+
RenderSystem.setShader(GameRenderer::getPositionTexShader);
125+
RenderSystem.setShaderTexture(0, SUN);
126+
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
127+
bufferBuilder.vertex(matrix4f2, -k, 100.0F, -k).uv(0.0F, 0.0F).next();
128+
bufferBuilder.vertex(matrix4f2, k, 100.0F, -k).uv(1.0F, 0.0F).next();
129+
bufferBuilder.vertex(matrix4f2, k, 100.0F, k).uv(1.0F, 1.0F).next();
130+
bufferBuilder.vertex(matrix4f2, -k, 100.0F, k).uv(0.0F, 1.0F).next();
131+
BufferRenderer.drawWithShader(bufferBuilder.end());
132+
k = 20.0F;
133+
RenderSystem.setShaderTexture(0, MOON_PHASES);
134+
int r = this.world.getMoonPhase();
135+
int s = r % 4;
136+
int m = r / 4 % 2;
137+
float t = (float) (s) / 4.0F;
138+
float o = (float) (m) / 2.0F;
139+
float p = (float) (s + 1) / 4.0F;
140+
float q = (float) (m + 1) / 2.0F;
141+
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
142+
bufferBuilder.vertex(matrix4f2, -k, -100.0F, k).uv(p, q).next();
143+
bufferBuilder.vertex(matrix4f2, k, -100.0F, k).uv(t, q).next();
144+
bufferBuilder.vertex(matrix4f2, k, -100.0F, -k).uv(t, o).next();
145+
bufferBuilder.vertex(matrix4f2, -k, -100.0F, -k).uv(p, o).next();
146+
BufferRenderer.drawWithShader(bufferBuilder.end());
147+
148+
149+
RenderSystem.disableTexture();
150+
float u = this.world.getStarBrightness(tickDelta) * i;
151+
if (u > 0.0F) {
152+
RenderSystem.setShaderColor(u, u, u, u);
153+
BackgroundRenderer.clearFog();
154+
this.starsBuffer.bind();
155+
this.starsBuffer.setShader(matrices.peek().getPosition(), projectionMatrix, GameRenderer.getPositionShader());
156+
VertexBuffer.unbind();
157+
runnable.run();
158+
}
159+
160+
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
161+
RenderSystem.disableBlend();
162+
matrices.pop();
163+
}
164+
RenderSystem.disableTexture();
165+
RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F);
166+
double d = this.client.player.getCameraPosVec(tickDelta).y - this.world.getLevelProperties().getSkyDarknessHeight(this.world);
167+
if (d < 0.0) {
168+
matrices.push();
169+
matrices.translate(0.0, 12.0, 0.0);
170+
this.darkSkyBuffer.bind();
171+
this.darkSkyBuffer.setShader(matrices.peek().getPosition(), projectionMatrix, shaderProgram);
172+
VertexBuffer.unbind();
173+
matrices.pop();
174+
}
175+
176+
if (this.world.getSkyProperties().isAlternateSkyColor()) {
177+
RenderSystem.setShaderColor(f * 0.2F + 0.04F, g * 0.2F + 0.04F, h * 0.6F + 0.1F, 1.0F);
178+
} else {
179+
RenderSystem.setShaderColor(f, g, h, 1.0F);
180+
}
181+
182+
RenderSystem.enableTexture();
183+
RenderSystem.depthMask(true);
66184
ci.cancel();
67185
}
68-
}
186+
}
187+
188+
@Redirect(method = "renderClouds(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FDDD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/SkyProperties;getCloudsHeight()F"))
189+
public float customCloudHeight(SkyProperties instance){
190+
191+
if(AxolotlClient.CONFIG.customCloudHeight.get()) {
192+
return AxolotlClient.CONFIG.cloudHeight.get();
193+
}
194+
return instance.getCloudsHeight();
195+
}
69196

70197
/*@ModifyArg(method = "method_1380", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glLineWidth(F)V"))
71198
public float OutlineWidth(float width){
@@ -101,11 +228,4 @@ public void customOutlineColor(Args args){
101228
}
102229
}
103230
}
104-
105-
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BackgroundRenderer;applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZF)V"))
106-
public void noFog(Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, float tickDelta){
107-
if(!AxolotlClient.CONFIG.customSky.get() || !SkyboxManager.getInstance().hasSkyBoxes()){
108-
BackgroundRenderer.applyFog(camera, fogType, viewDistance, thickFog, tickDelta);
109-
}
110-
}
111231
}

src/main/java/io/github/axolotlclient/modules/sky/FSBSkyboxInstance.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import com.mojang.blaze3d.platform.GlStateManager;
55
import com.mojang.blaze3d.systems.RenderSystem;
66
import com.mojang.blaze3d.vertex.BufferBuilder;
7+
import com.mojang.blaze3d.vertex.BufferRenderer;
78
import com.mojang.blaze3d.vertex.Tessellator;
89
import com.mojang.blaze3d.vertex.VertexFormat;
910
import com.mojang.blaze3d.vertex.VertexFormats;
11+
import net.minecraft.client.render.GameRenderer;
1012
import net.minecraft.client.util.math.MatrixStack;
1113
import net.minecraft.util.Identifier;
1214
import net.minecraft.util.math.Matrix4f;
@@ -40,9 +42,9 @@ public void renderSkybox(MatrixStack matrices) {
4042
this.alpha=getAlpha();
4143

4244
RenderSystem.setShaderColor(1,1,1,1);
43-
RenderSystem.enableTexture();
4445
RenderSystem.enableBlend();
4546
RenderSystem.blendFunc(GlStateManager.class_4535.SRC_ALPHA, GlStateManager.class_4534.ONE_MINUS_SRC_ALPHA);
47+
RenderSystem.setShader(GameRenderer::getPositionTexShader);
4648

4749
Tessellator tessellator = Tessellator.getInstance();
4850
BufferBuilder bufferBuilder = tessellator.getBufferBuilder();
@@ -81,7 +83,7 @@ public void renderSkybox(MatrixStack matrices) {
8183
bufferBuilder.vertex(matrix4f, -100, -100, 100).uv(0F, 1F).color(1F, 1F, 1F, alpha).next();
8284
bufferBuilder.vertex(matrix4f, 100, -100, 100).uv(1F, 1F).color(1F, 1F, 1F, alpha).next();
8385
bufferBuilder.vertex(matrix4f, 100, -100, -100).uv(1F, 0F).color(1F, 1F, 1F, alpha).next();
84-
tessellator.draw();
86+
BufferRenderer.drawWithShader(bufferBuilder.end());
8587

8688
matrices.pop();
8789
}

src/main/java/io/github/axolotlclient/modules/sky/MCPSkyboxInstance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void renderSkybox(MatrixStack matrices) {
2828
this.alpha=getAlpha();
2929

3030
RenderSystem.setShaderColor(1,1,1,1);
31-
RenderSystem.enableTexture();
31+
//RenderSystem.enableTexture();
3232
RenderSystem.enableBlend();
3333
RenderSystem.blendFunc(GlStateManager.class_4535.SRC_ALPHA, GlStateManager.class_4534.ONE_MINUS_SRC_ALPHA);
3434

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@
2929
"customSky.tooltip": "Whether to enable custom skies.",
3030
"showSunMoon": "Custom Sky Sun & Moon",
3131
"showSunMoon.tooltip": "Whether to show sun and moon on custom skies.",
32+
"customCloudHeight": "Custom Cloud Height",
33+
"customCloudHeight.tooltip": "Whether to use a custom cloud height.",
3234
"cloudHeight": "Cloud Height",
35+
"cloudHeight.tooltip": "The custom cloud height to use <br>Needs custom cloud height enabled.",
3336
"zoomDivisor": "Zoom Divisor",
37+
"zoomDivisor.tooltip": "The Zoom Divisor to calculate the zoomed view.",
3438
"zoomSpeed": "Zoom Speed",
39+
"zoomSpeed.tooltip": "The speed in which to transition <br>between the normal and the zoomed view.",
3540
"decreaseSensitivity": "Reduce Sensitivity",
41+
"decreaseSensitivity.tooltip": "Whether to reduce the mouse sensitivity while in a zoomed state.",
3642
"dynamicFov": "Dynamic FOV",
3743
"fullBright": "FullBright",
3844
"strength": "Strength",
@@ -72,6 +78,7 @@
7278
"hiddenNameOthers": "Hide others as:",
7379
"hideOwnName": "Hide your own name",
7480
"hideOtherNames": "Hide others' names",
81+
"hideOtherNames.tooltip": "Hides other peoples",
7582
"hideOwnSkin": "Hide your own skin",
7683
"hideOtherSkins": "Hide others' skins",
7784
"autoBoop": "AutoBoop",

src/main/resources/axolotlclient.mixins.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"AccessorMinecraftClient",
1212
"AccessorShaderEffect",
1313
"MixinAddServerScreen",
14-
"MixinBackgroundRenderer",
1514
"MixinBossBarHud",
1615
"MixinChatHud",
1716
"MixinClientBrandRetriever",

0 commit comments

Comments
 (0)