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

Commit b72ecc5

Browse files
committed
Sky blending + Fancy Zoom
Fancy Zoom by TheKodeToad in #16
1 parent 4dd9031 commit b72ecc5

File tree

12 files changed

+250
-117
lines changed

12 files changed

+250
-117
lines changed

run/options.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version:3105
2-
quilt_available_resource_packs:["programer_art","vanilla","file/testpack","file/square_textured","file/astralex-sky-overlay-for-1-8--sgdsdrgdyhd38745634867djhfkgkdyh.zip","file/OF-Testpack"]
2+
quilt_available_resource_packs:["programer_art","vanilla","file/testpack","file/square_textured","file/astralex-sky-overlay-for-1-8--sgdsdrgdyhd38745634867djhfkgkdyh.zip","file/OF-Testpack","file/! §bNebula - [sky only]"]
33
autoJump:false
44
autoSuggestions:true
55
chatColors:true
@@ -22,7 +22,7 @@ toggleSprint:false
2222
darkMojangStudiosBackground:false
2323
hideLightningFlashes:false
2424
mouseSensitivity:0.5
25-
fov:0.375
25+
fov:0.4
2626
screenEffectScale:1.0
2727
fovEffectScale:1.0
2828
darknessEffectScale:1.0
@@ -38,8 +38,8 @@ ao:2
3838
prioritizeChunkUpdates:0
3939
biomeBlendRadius:2
4040
renderClouds:"false"
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"]
41+
resourcePacks:["vanilla","file/! §bNebula - [sky only]","file/testpack","file/astralex-sky-overlay-for-1-8--sgdsdrgdyhd38745634867djhfkgkdyh.zip"]
42+
incompatibleResourcePacks:["file/! §bNebula - [sky only]","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/AxolotlClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public static void tickClient(){
126126
HypixelMods.getInstance().tick();
127127
DiscordRPC.update();
128128
Color.tickChroma();
129+
Zoom.tick();
129130

130131
if(tickTime % 20 == 0){
131132
if(MinecraftClient.getInstance().getCurrentServerEntry() != null){

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public class AxolotlClientConfig {
2020
public final BooleanOption showSunMoon = new BooleanOption("showSunMoon", true);
2121
public final BooleanOption customCloudHeight = new BooleanOption("customCloudHeight", false);
2222
public final FloatOption cloudHeight = new FloatOption("cloudHeight", 192F, 100F, 512F);
23-
public final FloatOption zoomDivisor = new FloatOption("zoomDivisor", 1F, 50F, 4F);
24-
public final IntegerOption zoomSpeed = new IntegerOption("zoomSpeed", 5, 1, 10);
25-
public final BooleanOption decreaseSensitivity = new BooleanOption("decreaseSensitivity", true);
2623
public final BooleanOption dynamicFOV = new BooleanOption("dynamicFov", true);
2724
public final BooleanOption fullBright = new BooleanOption("fullBright", false);
2825
public final IntegerOption chromaSpeed = new IntegerOption("chromaSpeed", 20, 10, 50);
@@ -51,7 +48,6 @@ public class AxolotlClientConfig {
5148
public final OptionCategory general = new OptionCategory("general");
5249
public final OptionCategory nametagOptions = new OptionCategory( "nametagOptions");
5350
public final OptionCategory rendering = new OptionCategory("rendering");
54-
public final OptionCategory zoom = new OptionCategory("zoom");
5551
public final OptionCategory outlines= new OptionCategory("blockOutlines");
5652
public final OptionCategory motionBlur = new OptionCategory("motionBlur");
5753

@@ -83,7 +79,6 @@ public void init(){
8379
categories.add(nametagOptions);
8480
categories.add(rendering);
8581

86-
rendering.addSubCategory(zoom);
8782
rendering.addSubCategory(outlines);
8883

8984
categories.forEach(OptionCategory::clearOptions);
@@ -117,10 +112,6 @@ public void init(){
117112
motionBlur.add(motionBlurInGuis);
118113
rendering.addSubCategory(motionBlur);
119114

120-
zoom.add(zoomDivisor);
121-
zoom.add(zoomSpeed);
122-
zoom.add(decreaseSensitivity);
123-
124115
outlines.add(enableCustomOutlines);
125116
outlines.add(outlineColor);
126117
outlines.add(outlineChroma);

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ public abstract class MixinGameRenderer {
2525
@Final
2626
@Shadow private MinecraftClient client;
2727

28-
@Shadow private float viewDistance;
29-
30-
@Shadow public abstract void tick();
31-
3228
/*@Inject(method = "renderFog", at = @At("HEAD"), cancellable = true)
3329
public void noFog(int i, float tickDelta, CallbackInfo ci){
3430
@@ -93,10 +89,10 @@ public void noFog(int i, float tickDelta, CallbackInfo ci){
9389

9490
@Inject(method = "getFov", at = @At(value = "RETURN", ordinal = 1), cancellable = true)
9591
public void setZoom(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable<Double> cir){
96-
Zoom.manageZoom();
97-
if(Zoom.isZoomed()||Zoom.isFadingOut()){
98-
cir.setReturnValue(Zoom.getFov(cir.getReturnValue()));
99-
} else if(!AxolotlClient.CONFIG.dynamicFOV.get()) {
92+
Zoom.update();
93+
double returnValue = cir.getReturnValue();
94+
95+
if(!AxolotlClient.CONFIG.dynamicFOV.get()) {
10096
Entity entity = this.client.getCameraEntity();
10197
double f = changingFov ? client.options.getFov().get() :70F;
10298
if (entity instanceof LivingEntity && ((LivingEntity)entity).getHealth() <= 0.0F) {
@@ -108,8 +104,11 @@ public void setZoom(Camera camera, float tickDelta, boolean changingFov, Callbac
108104
if (cameraSubmersionType == CameraSubmersionType.LAVA || cameraSubmersionType == CameraSubmersionType.WATER) {
109105
f *= MathHelper.lerp(this.client.options.getFovEffectScale().get(), 1.0, 0.85714287F);
110106
}
111-
cir.setReturnValue(f);
107+
returnValue = f;
112108
}
109+
returnValue = Zoom.getFov(returnValue, tickDelta);
110+
111+
cir.setReturnValue(returnValue);
113112
}
114113

115114
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;viewport(IIII)V",

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1313
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1414

15-
/* Debugging...
16-
import org.spongepowered.asm.mixin.injection.Inject;
17-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
18-
import io.github.moehreag.branding.Axolotlclient;
19-
*/
20-
2115
@Mixin(MinecraftClient.class)
2216
public class MixinMinecraftClient {
2317

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package io.github.axolotlclient.mixin;
22

3+
import io.github.axolotlclient.modules.zoom.Zoom;
34
import io.github.axolotlclient.util.Hooks;
45
import net.minecraft.client.Mouse;
56
import org.spongepowered.asm.mixin.Mixin;
67
import org.spongepowered.asm.mixin.injection.At;
78
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.ModifyArg;
810
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
911

1012
@Mixin(Mouse.class)
@@ -16,4 +18,12 @@ private void onMouseButton(long window, int button, int action, int mods, Callba
1618
Hooks.MOUSE_INPUT.invoker().onMouseButton(window, button, action, mods);
1719
}
1820
}
21+
22+
@ModifyArg(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;scrollInHotbar(D)V"))
23+
public double scrollZoom(double scrollAmount){
24+
if(scrollAmount != 0 && Zoom.scroll(scrollAmount)){
25+
return 0;
26+
}
27+
return scrollAmount;
28+
}
1929
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void renderSky(MatrixStack matrices, Matrix4f projectionMatrix, float tic
7474
VertexBuffer.unbind();
7575

7676
this.client.getProfiler().push("Custom Skies");
77-
SkyboxManager.getInstance().renderSkyboxes(matrices);
77+
SkyboxManager.getInstance().renderSkyboxes(matrices, world.getRainGradient(tickDelta));
7878

7979
this.client.getProfiler().pop();
8080

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

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
package io.github.axolotlclient.modules.sky;
22

33
import com.google.gson.JsonObject;
4+
import com.mojang.blaze3d.systems.RenderSystem;
5+
import io.github.axolotlclient.AxolotlClient;
46
import io.github.axolotlclient.util.Util;
57
import net.minecraft.client.MinecraftClient;
68
import net.minecraft.client.util.math.MatrixStack;
79
import net.minecraft.util.Identifier;
810

11+
import java.util.Locale;
912
import java.util.Objects;
1013

1114
/**
1215
* This implementation of custom skies is based on the FabricSkyBoxes mod by AMereBagatelle
1316
* https://github.com/AMereBagatelle/FabricSkyBoxes
1417
**/
1518

16-
public class SkyboxInstance {
19+
public abstract class SkyboxInstance {
1720

1821
JsonObject object;
1922
float alpha = 1F;
@@ -22,7 +25,7 @@ public class SkyboxInstance {
2225

2326
// ! These are the options variables. Do not mess with these.
2427
protected float maxAlpha = 1f;
25-
int distance;
28+
protected int blendMode;
2629

2730
public SkyboxInstance(JsonObject json){
2831
this.object=json;
@@ -92,6 +95,91 @@ public float getAlpha(){
9295
return maxPossibleAlpha;
9396
}
9497

95-
public void renderSkybox(MatrixStack matrices){
96-
}
98+
protected int parseBlend(String str){
99+
if (str == null) {
100+
return 1;
101+
} else {
102+
103+
switch (str.toLowerCase(Locale.ENGLISH).trim()) {
104+
case "alpha":
105+
return 0;
106+
case "add":
107+
return 1;
108+
case "subtract":
109+
return 2;
110+
case "multiply":
111+
return 3;
112+
case "dodge":
113+
return 4;
114+
case "burn":
115+
return 5;
116+
case "screen":
117+
return 6;
118+
case "overlay":
119+
return 7;
120+
case "replace":
121+
return 8;
122+
default:
123+
AxolotlClient.LOGGER.warn("Unknown blend: " + str);
124+
return 1;
125+
}
126+
}
127+
}
128+
129+
protected void setupBlend(float brightness){
130+
131+
switch (blendMode) {
132+
case 0 -> {
133+
RenderSystem.enableBlend();
134+
RenderSystem.blendFunc(770, 771);
135+
}
136+
case 1 -> {
137+
RenderSystem.enableBlend();
138+
RenderSystem.blendFunc(770, 1);
139+
}
140+
case 2 -> {
141+
RenderSystem.enableBlend();
142+
RenderSystem.blendFunc(775, 0);
143+
}
144+
case 3 -> {
145+
RenderSystem.enableBlend();
146+
RenderSystem.blendFunc(774, 771);
147+
}
148+
case 4 -> {
149+
RenderSystem.enableBlend();
150+
RenderSystem.blendFunc(1, 1);
151+
}
152+
case 5 -> {
153+
RenderSystem.enableBlend();
154+
RenderSystem.blendFunc(0, 769);
155+
}
156+
case 6 -> {
157+
RenderSystem.enableBlend();
158+
RenderSystem.blendFunc(1, 769);
159+
}
160+
case 7 -> {
161+
RenderSystem.enableBlend();
162+
RenderSystem.blendFunc(774, 768);
163+
}
164+
case 8 -> RenderSystem.disableBlend();
165+
}
166+
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, brightness);
167+
168+
RenderSystem.enableTexture();
169+
}
170+
171+
protected void clearBlend(float brightness){
172+
//RenderSystem.disableAlphaTest();
173+
RenderSystem.enableBlend();
174+
RenderSystem.blendFunc(770, 1);
175+
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, brightness);
176+
}
177+
178+
public void render(MatrixStack matrices, float brightness){
179+
setupBlend(brightness);
180+
renderSkybox(matrices);
181+
clearBlend(brightness);
182+
}
183+
184+
public abstract void renderSkybox(MatrixStack matrices);
97185
}

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package io.github.axolotlclient.modules.sky;
22

3-
import com.google.common.collect.Iterables;
43
import net.minecraft.client.util.math.MatrixStack;
54

65
import java.util.ArrayList;
76
import java.util.Objects;
87
import java.util.function.Predicate;
9-
import java.util.stream.StreamSupport;
108

119
/**
1210
* This implementation of custom skies is based on the FabricSkyBoxes mod by AMereBagatelle
@@ -25,9 +23,9 @@ public class SkyboxManager {
2523

2624
private static final SkyboxManager INSTANCE = new SkyboxManager();
2725

28-
public void renderSkyboxes(MatrixStack matrices){
26+
public void renderSkyboxes(MatrixStack matrices, float brightness){
2927
this.skyboxes.stream().filter(this.renderPredicate).forEach(this.active_skies::add);
30-
this.active_skies.forEach(skyboxInstance -> {if(skyboxInstance!=null)skyboxInstance.renderSkybox(matrices);});
28+
this.active_skies.forEach(skyboxInstance -> {if(skyboxInstance!=null)skyboxInstance.render(matrices, brightness);});
3129
this.active_skies.removeIf((skybox) -> skybox.getAlpha() <= MINIMUM_ALPHA);
3230
}
3331

@@ -36,10 +34,6 @@ public void clearSkyboxes() {
3634
active_skies.clear();
3735
}
3836

39-
public float getTotalAlpha() {
40-
return (float) StreamSupport.stream(Iterables.concat(this.skyboxes).spliterator(), false).mapToDouble(SkyboxInstance::getAlpha).sum();
41-
}
42-
4337
public void removeSkybox(SkyboxInstance skybox){
4438
this.skyboxes.remove(skybox);
4539
if(this.active_skies.contains(skybox))active_skies.remove(skybox);

0 commit comments

Comments
 (0)