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

Commit 753436b

Browse files
committed
fix more bugs
- (1.21.1) remove custom sky module
1 parent a2df0bc commit 753436b

File tree

22 files changed

+139
-997
lines changed

22 files changed

+139
-997
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/mixin/ButtonWidgetMixin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import net.minecraft.client.util.math.MatrixStack;
3131
import net.minecraft.text.Text;
3232
import net.minecraft.util.Identifier;
33+
import org.spongepowered.asm.mixin.Final;
3334
import org.spongepowered.asm.mixin.Mixin;
3435
import org.spongepowered.asm.mixin.Shadow;
3536
import org.spongepowered.asm.mixin.injection.At;
@@ -58,6 +59,10 @@ public abstract class ButtonWidgetMixin {
5859
@Shadow
5960
protected abstract int getYImage(boolean hovered);
6061

62+
@Shadow
63+
@Final
64+
public static Identifier WIDGETS_LOCATION;
65+
6166
@Redirect(method = "renderButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/AbstractButtonWidget;drawCenteredText(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)V"))
6267
private void drawScrollableString(MatrixStack matrixStack, TextRenderer textRenderer, Text text, int centerX, int y_original, int color) {
6368
int left = x + 2;
@@ -74,6 +79,7 @@ private void remove2Slice(AbstractButtonWidget instance, MatrixStack stack, int
7479
private void addSlices(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
7580
Identifier tex = ButtonWidgetTextures.get(getYImage(hovered));
7681
DrawUtil.blitSprite(tex, x, y, width, height, new DrawUtil.NineSlice(200, 20, 3));
82+
MinecraftClient.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
7783
}
7884

7985
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/sky/SkyResourceManager.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.google.gson.JsonObject;
3333
import io.github.axolotlclient.AxolotlClient;
3434
import io.github.axolotlclient.modules.AbstractModule;
35+
import lombok.Getter;
3536
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
3637
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
3738
import net.minecraft.resource.Resource;
@@ -50,12 +51,9 @@ public class SkyResourceManager extends AbstractModule implements SimpleSynchron
5051

5152
private final static Gson gson = new GsonBuilder().setPrettyPrinting().create();
5253

54+
@Getter
5355
private final static SkyResourceManager Instance = new SkyResourceManager();
5456

55-
public static SkyResourceManager getInstance() {
56-
return Instance;
57-
}
58-
5957
@Override
6058
public void init() {
6159
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(this);
@@ -73,10 +71,15 @@ public void apply(ResourceManager manager) {
7371
continue;
7472
}
7573
AxolotlClient.LOGGER.debug("Loading FSB sky from " + entry);
76-
SkyboxManager.getInstance().addSkybox(new FSBSkyboxInstance(gson.fromJson(
74+
JsonObject json = gson.fromJson(
7775
new BufferedReader(new InputStreamReader(manager.getResource(entry).getInputStream(), StandardCharsets.UTF_8))
7876
.lines().collect(Collectors.joining("\n")),
79-
JsonObject.class)));
77+
JsonObject.class);
78+
if (!json.has("type") || !json.get("type").getAsString().equals("square-textured")) {
79+
AxolotlClient.LOGGER.debug("Skipping "+entry+" as we currently cannot load it!");
80+
continue;
81+
}
82+
SkyboxManager.getInstance().addSkybox(new FSBSkyboxInstance(json));
8083
AxolotlClient.LOGGER.debug("Loaded FSB sky from " + entry);
8184
}
8285

@@ -117,9 +120,7 @@ private void loadMCPSky(String loader, Identifier id, Resource resource) {
117120
if (!string.startsWith("#")) {
118121
option = string.split("=");
119122
if (option[0].equals("source")) {
120-
if (option[1].contains(":")) {
121-
option[1] = option[1].split(":")[1];
122-
} else {
123+
if (!option[1].contains(":")) {
123124
if (option[1].startsWith("assets")) {
124125
option[1] = option[1].replace("./", "").replace("assets/minecraft/", "");
125126
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/sky/SkyboxInstance.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
import io.github.axolotlclient.util.Util;
3434
import net.minecraft.client.MinecraftClient;
3535
import net.minecraft.client.gl.VertexBuffer;
36-
import net.minecraft.client.render.*;
36+
import net.minecraft.client.render.BackgroundRenderer;
37+
import net.minecraft.client.render.BufferBuilder;
38+
import net.minecraft.client.render.Tessellator;
39+
import net.minecraft.client.render.VertexFormats;
3740
import net.minecraft.client.util.math.MatrixStack;
3841
import net.minecraft.client.util.math.Vector3f;
3942
import net.minecraft.util.Identifier;
@@ -299,7 +302,7 @@ protected void renderDecorations(MatrixStack matrices, float delta) {
299302
bufferBuilder.vertex(matrix4f2, k, 100.0F, -k).texture(1.0F, 0.0F).next();
300303
bufferBuilder.vertex(matrix4f2, k, 100.0F, k).texture(1.0F, 1.0F).next();
301304
bufferBuilder.vertex(matrix4f2, -k, 100.0F, k).texture(0.0F, 1.0F).next();
302-
BufferRenderer.draw(bufferBuilder);
305+
Tessellator.getInstance().draw();
303306
}
304307
if (showMoon) {
305308
k = 20.0F;
@@ -316,7 +319,7 @@ protected void renderDecorations(MatrixStack matrices, float delta) {
316319
bufferBuilder.vertex(matrix4f2, k, -100.0F, k).texture(t, q).next();
317320
bufferBuilder.vertex(matrix4f2, k, -100.0F, -k).texture(t, o).next();
318321
bufferBuilder.vertex(matrix4f2, -k, -100.0F, -k).texture(p, o).next();
319-
BufferRenderer.draw(bufferBuilder);
322+
Tessellator.getInstance().draw();
320323
}
321324
if (showStars) {
322325
RenderSystem.disableTexture();

1.16_combat-6/src/main/java/io/github/axolotlclient/util/ButtonWidgetTextures.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public Identifier getFabricId() {
5252

5353
@Override
5454
public void apply(ResourceManager manager) {
55+
MinecraftClient.getInstance().getTextureManager().destroyTexture(disabledTexture);
56+
MinecraftClient.getInstance().getTextureManager().destroyTexture(activeTexture);
57+
MinecraftClient.getInstance().getTextureManager().destroyTexture(hoveredTexture);
5558
disabledTexture = activeTexture = hoveredTexture = null;
5659
}
5760
});
@@ -75,12 +78,10 @@ private static void load() {
7578

7679
private static Identifier register(BufferedImage atlas, String name, int imageY) throws IOException {
7780
var id = new Identifier("axolotlclient", "minecraft/buttonwidget/" + name);
78-
if (MinecraftClient.getInstance().getTextureManager().getTexture(id) != null) {
79-
return id;
80-
}
8181
NativeImage img;
8282
try (var out = new ByteArrayOutputStream()) {
83-
ImageIO.write(atlas.getSubimage(0, imageY, 200, 20), "png", out);
83+
int scale = atlas.getHeight()/256;
84+
ImageIO.write(atlas.getSubimage(0, imageY*scale, 200*scale, 20*scale), "png", out);
8485
var in = new ByteArrayInputStream(out.toByteArray());
8586
img = NativeImage.read(in);
8687
in.close();

1.20/src/main/java/io/github/axolotlclient/modules/sky/SkyResourceManager.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ private static JsonObject loadMCPSky(String loader, Identifier id, Resource reso
6363
String[] option = line.split("=");
6464

6565
if (option[0].equals("source")) {
66-
if (option[1].startsWith("assets")) {
67-
option[1] = option[1].replace("./", "").replace("assets/minecraft/", "");
68-
} else {
69-
if (id.getPath().contains("world")) {
70-
option[1] = loader + "/sky/world" + id.getPath().split("world")[1].split("/")[0] + "/"
71-
+ option[1].replace("./", "");
66+
if (!option[1].contains(":")) {
67+
if (option[1].startsWith("assets")) {
68+
option[1] = option[1].replace("./", "").replace("assets/minecraft/", "");
69+
} else {
70+
if (id.getPath().contains("world")) {
71+
option[1] = loader + "/sky/world" + id.getPath().split("world")[1].split("/")[0] + "/"
72+
+ option[1].replace("./", "");
73+
}
7274
}
7375
}
7476
}
@@ -102,8 +104,13 @@ public void reload(ResourceManager manager) {
102104
}
103105
AxolotlClient.LOGGER.debug("Loading FSB sky from " + entry.getKey());
104106
try (BufferedReader reader = entry.getValue().openBufferedReader()) {
107+
JsonObject json = gson.fromJson(reader.lines().collect(Collectors.joining("\n")), JsonObject.class);
108+
if (!json.has("type") || !json.get("type").getAsString().equals("square-textured")) {
109+
AxolotlClient.LOGGER.debug("Skipping "+entry+" as we currently cannot load it!");
110+
continue;
111+
}
105112
SkyboxManager.getInstance().addSkybox(new FSBSkyboxInstance(
106-
gson.fromJson(reader.lines().collect(Collectors.joining("\n")), JsonObject.class)));
113+
json));
107114
AxolotlClient.LOGGER.debug("Loaded FSB sky from " + entry.getKey());
108115
} catch (IOException ignored) {
109116
}
@@ -130,6 +137,6 @@ public void reload(ResourceManager manager) {
130137
}
131138

132139
private boolean isMCPSky(String path) {
133-
return path.endsWith(".properties") && path.startsWith("sky");
140+
return path.endsWith(".properties") && path.substring(path.lastIndexOf("/") + 1).startsWith("sky");
134141
}
135142
}

1.21/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import io.github.axolotlclient.modules.rpc.DiscordRPC;
4848
import io.github.axolotlclient.modules.screenshotUtils.ScreenshotUtils;
4949
import io.github.axolotlclient.modules.scrollableTooltips.ScrollableTooltips;
50-
import io.github.axolotlclient.modules.sky.SkyResourceManager;
5150
import io.github.axolotlclient.modules.tablist.Tablist;
5251
import io.github.axolotlclient.modules.tnttime.TntTime;
5352
import io.github.axolotlclient.modules.zoom.Zoom;
@@ -58,11 +57,9 @@
5857
import net.fabricmc.api.ClientModInitializer;
5958
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
6059
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
61-
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
6260
import net.fabricmc.loader.api.FabricLoader;
6361
import net.minecraft.client.resource.language.I18n;
6462
import net.minecraft.resource.Resource;
65-
import net.minecraft.resource.ResourceType;
6663
import net.minecraft.util.Identifier;
6764

6865
public class AxolotlClient implements ClientModInitializer {
@@ -79,7 +76,6 @@ public class AxolotlClient implements ClientModInitializer {
7976
public static ConfigManager configManager;
8077

8178
public static void getModules() {
82-
modules.add(SkyResourceManager.getInstance());
8379
modules.add(Zoom.getInstance());
8480
modules.add(HudManager.getInstance());
8581
modules.add(HypixelMods.getInstance());
@@ -140,7 +136,6 @@ public void onInitializeClient() {
140136
modules.forEach(Module::lateInit);
141137

142138
ClientTickEvents.END_CLIENT_TICK.register(client -> tickClient());
143-
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(SkyResourceManager.getInstance());
144139

145140
FeatureDisabler.init();
146141

1.21/src/main/java/io/github/axolotlclient/mixin/BackgroundRendererMixin.java

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

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,10 @@
2222

2323
package io.github.axolotlclient.mixin;
2424

25-
import com.llamalad7.mixinextras.sugar.Local;
26-
import com.mojang.blaze3d.systems.RenderSystem;
2725
import io.github.axolotlclient.AxolotlClient;
28-
import io.github.axolotlclient.modules.sky.SkyboxManager;
29-
import net.fabricmc.loader.api.FabricLoader;
30-
import net.minecraft.client.MinecraftClient;
31-
import net.minecraft.client.render.Camera;
3226
import net.minecraft.client.render.LightmapTextureManager;
3327
import net.minecraft.client.render.WorldRenderer;
34-
import net.minecraft.client.util.math.MatrixStack;
35-
import org.joml.Matrix4f;
36-
import org.spongepowered.asm.mixin.Final;
3728
import org.spongepowered.asm.mixin.Mixin;
38-
import org.spongepowered.asm.mixin.Shadow;
3929
import org.spongepowered.asm.mixin.injection.At;
4030
import org.spongepowered.asm.mixin.injection.Inject;
4131
import org.spongepowered.asm.mixin.injection.ModifyArgs;
@@ -52,26 +42,6 @@
5242
@Mixin(WorldRenderer.class)
5343
public abstract class WorldRendererMixin {
5444

55-
@Shadow
56-
@Final
57-
private MinecraftClient client;
58-
59-
@Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getSkyColor(Lnet/minecraft/util/math/Vec3d;F)Lnet/minecraft/util/math/Vec3d;"), cancellable = true)
60-
private void axolotlclient$renderSky(Matrix4f modelViewMatrix, Matrix4f projectionMatrix, float tickDelta,
61-
Camera preStep, boolean skipRendering, Runnable preRender, CallbackInfo ci, @Local MatrixStack stack) {
62-
preRender.run();
63-
if (AxolotlClient.CONFIG.customSky.get() && SkyboxManager.getInstance().hasSkyBoxes()
64-
&& !FabricLoader.getInstance().isModLoaded("fabricskyboxes")) {
65-
this.client.getProfiler().push("Custom Skies");
66-
67-
RenderSystem.depthMask(false);
68-
SkyboxManager.getInstance().renderSkyboxes(stack, projectionMatrix, tickDelta, preRender);
69-
RenderSystem.depthMask(true);
70-
this.client.getProfiler().pop();
71-
ci.cancel();
72-
}
73-
}
74-
7545
@ModifyArgs(method = "drawBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawShapeOutline(Lnet/minecraft/client/util/math/MatrixStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V"))
7646
private void axolotlclient$customOutlineColor(Args args) {
7747
if (AxolotlClient.CONFIG.enableCustomOutlines.get()) {

0 commit comments

Comments
 (0)