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

Commit a2df0bc

Browse files
committed
fix another bug
1 parent 0bfd6a6 commit a2df0bc

File tree

17 files changed

+83
-37
lines changed

17 files changed

+83
-37
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/config/AxolotlClientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.ArrayList;
2626
import java.util.List;
27+
import java.util.Objects;
2728

2829
import com.mojang.blaze3d.systems.RenderSystem;
2930
import io.github.axolotlclient.AxolotlClient;
@@ -38,7 +39,6 @@
3839
import io.github.axolotlclient.util.options.ForceableBooleanOption;
3940
import io.github.axolotlclient.util.options.GenericOption;
4041
import lombok.Getter;
41-
import net.fabricmc.loader.api.FabricLoader;
4242
import net.minecraft.client.MinecraftClient;
4343
import net.minecraft.client.texture.NativeImage;
4444
import net.minecraft.client.texture.NativeImageBackedTexture;
@@ -150,7 +150,7 @@ public void init() {
150150
general.add(CommonOptions.datetimeFormat);
151151
ConfigUI.getInstance().runWhenLoaded(() -> {
152152
general.getOptions().removeIf(o -> "configStyle".equals(o.getName()));
153-
boolean isPojavLauncher = FabricLoader.getInstance().getGameDir().toString().contains("/Android/data/net.kdt.pojavlaunch/");
153+
boolean isPojavLauncher = Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("/Android/data/net.kdt.pojavlaunch/");
154154
String[] themes = ConfigUI.getInstance().getStyleNames().stream().map(s -> "configStyle." + s)
155155
.filter(s -> !isPojavLauncher || !s.startsWith("rounded"))
156156
.toArray(String[]::new);

1.16_combat-6/src/main/java/io/github/axolotlclient/util/options/rounded/QuickToggleCategoryWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.NVGFont;
2929
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.CategoryWidget;
3030
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.PillBooleanWidget;
31+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
3132
import net.minecraft.client.MinecraftClient;
3233
import net.minecraft.client.util.math.MatrixStack;
3334

@@ -40,7 +41,10 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
4041
.filter(o -> o instanceof BooleanOption)
4142
.map(o -> (BooleanOption) o)
4243
.filter(o -> "enabled".equals(o.getName())).findFirst()
43-
.ifPresent(booleanOption -> enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption));
44+
.ifPresent(booleanOption -> {
45+
enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption);
46+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
47+
});
4448
}
4549

4650
@Override

1.16_combat-6/src/main/java/io/github/axolotlclient/util/options/vanilla/QuickToggleCategoryWidget.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.CategoryWidget;
3030
import io.github.axolotlclient.AxolotlClientConfig.impl.util.DrawUtil;
3131
import io.github.axolotlclient.util.ButtonWidgetTextures;
32+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
3233
import net.minecraft.client.MinecraftClient;
3334
import net.minecraft.client.font.TextRenderer;
3435
import net.minecraft.client.util.math.MatrixStack;
@@ -44,16 +45,19 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
4445
.filter(o -> o instanceof BooleanOption)
4546
.map(o -> (BooleanOption) o)
4647
.filter(o -> "enabled".equals(o.getName())).findFirst()
47-
.ifPresent(booleanOption -> enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption) {
48-
@Override
49-
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
50-
Identifier tex = ButtonWidgetTextures.get(!this.active ? 0 : (this.isHovered() ? 2 : 1));
51-
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
52-
io.github.axolotlclient.modules.hud.util.DrawUtil.blitSprite(tex, this.getX(), this.getY(), this.getWidth(), this.getHeight(), new io.github.axolotlclient.modules.hud.util.DrawUtil.NineSlice(200, 20, 3));
48+
.ifPresent(booleanOption -> {
49+
enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption) {
50+
@Override
51+
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
52+
Identifier tex = ButtonWidgetTextures.get(!this.active ? 0 : (this.isHovered() ? 2 : 1));
53+
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
54+
io.github.axolotlclient.modules.hud.util.DrawUtil.blitSprite(tex, this.getX(), this.getY(), this.getWidth(), this.getHeight(), new io.github.axolotlclient.modules.hud.util.DrawUtil.NineSlice(200, 20, 3));
5355

54-
int textColor = this.active ? 16777215 : 10526880;
55-
this.drawScrollableText(matrices, MinecraftClient.getInstance().textRenderer, textColor | MathHelper.ceil(this.alpha * 255.0F) << 24);
56-
}
56+
int textColor = this.active ? 16777215 : 10526880;
57+
this.drawScrollableText(matrices, MinecraftClient.getInstance().textRenderer, textColor | MathHelper.ceil(this.alpha * 255.0F) << 24);
58+
}
59+
};
60+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
5761
});
5862
}
5963

@@ -82,10 +86,12 @@ public void renderButton(MatrixStack graphics, int mouseX, int mouseY, float del
8286
protected void drawScrollableText(MatrixStack matrices, TextRenderer textRenderer, int xOffset, int color) {
8387
int i = this.getX() + xOffset;
8488
int j = this.getX() + this.getWidth() - xOffset;
89+
int center = this.getX() + this.getWidth()/2;
8590
if (enabledButton != null) {
8691
j -= enabledButton.getWidth() + 4;
92+
center -= enabledButton.getWidth() / 2 + 2;
8793
}
88-
DrawUtil.drawScrollingText(matrices, textRenderer, this.getMessage(), this.getX() + this.getWidth() / 2, i, this.getY(), j, this.getY() + this.getHeight(), color);
94+
DrawUtil.drawScrollingText(matrices, textRenderer, this.getMessage(), center, i, this.getY(), j, this.getY() + this.getHeight(), color);
8995
}
9096

9197
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.ArrayList;
2626
import java.util.List;
27+
import java.util.Objects;
2728

2829
import com.mojang.blaze3d.systems.RenderSystem;
2930
import com.mojang.blaze3d.texture.NativeImage;
@@ -39,7 +40,6 @@
3940
import io.github.axolotlclient.util.options.ForceableBooleanOption;
4041
import io.github.axolotlclient.util.options.GenericOption;
4142
import lombok.Getter;
42-
import net.fabricmc.loader.api.FabricLoader;
4343
import net.minecraft.client.MinecraftClient;
4444
import net.minecraft.client.texture.NativeImageBackedTexture;
4545

@@ -151,7 +151,7 @@ public void init() {
151151
general.add(CommonOptions.datetimeFormat);
152152
ConfigUI.getInstance().runWhenLoaded(() -> {
153153
general.getOptions().removeIf(o -> "configStyle".equals(o.getName()));
154-
boolean isPojavLauncher = FabricLoader.getInstance().getGameDir().toString().contains("/Android/data/net.kdt.pojavlaunch/");
154+
boolean isPojavLauncher = Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("/Android/data/net.kdt.pojavlaunch/");
155155
String[] themes = ConfigUI.getInstance().getStyleNames().stream().map(s -> "configStyle." + s)
156156
.filter(s -> !isPojavLauncher || !s.startsWith("rounded"))
157157
.toArray(String[]::new);

1.20/src/main/java/io/github/axolotlclient/util/options/rounded/QuickToggleCategoryWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.NVGFont;
2929
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.CategoryWidget;
3030
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.PillBooleanWidget;
31+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
3132
import net.minecraft.client.MinecraftClient;
3233
import net.minecraft.client.gui.GuiGraphics;
3334

@@ -40,7 +41,10 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
4041
.filter(o -> o instanceof BooleanOption)
4142
.map(o -> (BooleanOption) o)
4243
.filter(o -> "enabled".equals(o.getName())).findFirst()
43-
.ifPresent(booleanOption -> enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption));
44+
.ifPresent(booleanOption -> {
45+
enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption);
46+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
47+
});
4448
}
4549

4650
@Override

1.20/src/main/java/io/github/axolotlclient/util/options/vanilla/QuickToggleCategoryWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.github.axolotlclient.AxolotlClientConfig.impl.options.OptionCategoryImpl;
2727
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.BooleanWidget;
2828
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.CategoryWidget;
29+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
2930
import net.minecraft.client.MinecraftClient;
3031
import net.minecraft.client.font.TextRenderer;
3132
import net.minecraft.client.gui.GuiGraphics;
@@ -39,7 +40,10 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
3940
.filter(o -> o instanceof BooleanOption)
4041
.map(o -> (BooleanOption) o)
4142
.filter(o -> "enabled".equals(o.getName())).findFirst()
42-
.ifPresent(booleanOption -> enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption));
43+
.ifPresent(booleanOption -> {
44+
enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption);
45+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
46+
});
4347
}
4448

4549
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.ArrayList;
2626
import java.util.List;
27+
import java.util.Objects;
2728

2829
import com.mojang.blaze3d.platform.NativeImage;
2930
import com.mojang.blaze3d.systems.RenderSystem;
@@ -39,7 +40,6 @@
3940
import io.github.axolotlclient.util.options.ForceableBooleanOption;
4041
import io.github.axolotlclient.util.options.GenericOption;
4142
import lombok.Getter;
42-
import net.fabricmc.loader.api.FabricLoader;
4343
import net.minecraft.client.Minecraft;
4444
import net.minecraft.client.renderer.texture.DynamicTexture;
4545

@@ -145,7 +145,7 @@ public void init() {
145145
general.add(CommonOptions.datetimeFormat);
146146
ConfigUI.getInstance().runWhenLoaded(() -> {
147147
general.getOptions().removeIf(o -> "configStyle".equals(o.getName()));
148-
boolean isPojavLauncher = FabricLoader.getInstance().getGameDir().toString().contains("/Android/data/net.kdt.pojavlaunch/");
148+
boolean isPojavLauncher = Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("/Android/data/net.kdt.pojavlaunch/");
149149
String[] themes = ConfigUI.getInstance().getStyleNames().stream().map(s -> "configStyle." + s)
150150
.filter(s -> !isPojavLauncher || !s.startsWith("rounded"))
151151
.toArray(String[]::new);

1.21.4/src/main/java/io/github/axolotlclient/util/options/rounded/QuickToggleCategoryWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.NVGFont;
2929
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.CategoryWidget;
3030
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.rounded.widgets.PillBooleanWidget;
31+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
3132
import net.minecraft.client.Minecraft;
3233
import net.minecraft.client.gui.GuiGraphics;
3334

@@ -40,7 +41,10 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
4041
.filter(o -> o instanceof BooleanOption)
4142
.map(o -> (BooleanOption) o)
4243
.filter(o -> "enabled".equals(o.getName())).findFirst()
43-
.ifPresent(booleanOption -> enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption));
44+
.ifPresent(booleanOption -> {
45+
enabledButton = new PillBooleanWidget(x + (width - 43), y + 3, 40, height - 5, booleanOption);
46+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
47+
});
4448
}
4549

4650
@Override

1.21.4/src/main/java/io/github/axolotlclient/util/options/vanilla/QuickToggleCategoryWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.github.axolotlclient.AxolotlClientConfig.impl.options.OptionCategoryImpl;
2727
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.BooleanWidget;
2828
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.CategoryWidget;
29+
import io.github.axolotlclient.util.options.ForceableBooleanOption;
2930
import net.minecraft.client.Minecraft;
3031
import net.minecraft.client.gui.Font;
3132
import net.minecraft.client.gui.GuiGraphics;
@@ -39,7 +40,10 @@ public QuickToggleCategoryWidget(int x, int y, int width, int height, OptionCate
3940
.filter(o -> o instanceof BooleanOption)
4041
.map(o -> (BooleanOption) o)
4142
.filter(o -> "enabled".equals(o.getName())).findFirst()
42-
.ifPresent(booleanOption -> enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption));
43+
.ifPresent(booleanOption -> {
44+
enabledButton = new BooleanWidget(x + (width - 33), y + 3, 30, height - 5, booleanOption);
45+
enabledButton.active = !(booleanOption instanceof ForceableBooleanOption o && o.isForceOff());
46+
});
4347
}
4448

4549
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.ArrayList;
2626
import java.util.List;
27+
import java.util.Objects;
2728

2829
import com.mojang.blaze3d.systems.RenderSystem;
2930
import com.mojang.blaze3d.texture.NativeImage;
@@ -39,7 +40,6 @@
3940
import io.github.axolotlclient.util.options.ForceableBooleanOption;
4041
import io.github.axolotlclient.util.options.GenericOption;
4142
import lombok.Getter;
42-
import net.fabricmc.loader.api.FabricLoader;
4343
import net.minecraft.client.MinecraftClient;
4444
import net.minecraft.client.texture.NativeImageBackedTexture;
4545

@@ -151,7 +151,7 @@ public void init() {
151151
general.add(CommonOptions.datetimeFormat);
152152
ConfigUI.getInstance().runWhenLoaded(() -> {
153153
general.getOptions().removeIf(o -> "configStyle".equals(o.getName()));
154-
boolean isPojavLauncher = FabricLoader.getInstance().getGameDir().toString().contains("/Android/data/net.kdt.pojavlaunch/");
154+
boolean isPojavLauncher = Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("/Android/data/net.kdt.pojavlaunch/");
155155
String[] themes = ConfigUI.getInstance().getStyleNames().stream().map(s -> "configStyle." + s)
156156
.filter(s -> !isPojavLauncher || !s.startsWith("rounded"))
157157
.toArray(String[]::new);

0 commit comments

Comments
 (0)