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

Commit e1e4731

Browse files
committed
ArmorHUD protection display
1 parent 6d712a7 commit e1e4731

File tree

9 files changed

+53
-99
lines changed

9 files changed

+53
-99
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import net.minecraft.resource.pack.ResourcePack;
2424
import net.minecraft.util.Identifier;
2525
import org.quiltmc.loader.api.ModContainer;
26+
import org.quiltmc.loader.api.QuiltLoader;
2627
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
2728
import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents;
2829
import org.quiltmc.qsl.resource.loader.api.ResourceLoader;
@@ -57,9 +58,29 @@ public class AxolotlClient implements ClientModInitializer {
5758

5859
public static Integer tickTime = 0;
5960

61+
public static String badmod="";
62+
public static boolean titleDisclaimer = false;
63+
public static boolean showWarning = true;
64+
6065
@Override
6166
public void onInitializeClient(ModContainer container) {
6267

68+
if (QuiltLoader.isModLoaded("ares")){
69+
badmod = "Ares Client";
70+
} else if (QuiltLoader.isModLoaded("inertia")) {
71+
badmod = "Inertia Client";
72+
} else if (QuiltLoader.isModLoaded("meteor-client")) {
73+
badmod = "Meteor Client";
74+
} else if (QuiltLoader.isModLoaded("wurst")) {
75+
badmod = "Wurst Client";
76+
} else if (QuiltLoader.isModLoaded("baritone")) {
77+
badmod = "Baritone";
78+
} else if (QuiltLoader.isModLoaded("xaerominimap")) {
79+
badmod = "Xaero's Minimap";
80+
} else {
81+
showWarning = false;
82+
}
83+
6384
CONFIG = new AxolotlClientConfig();
6485
config.add(someNiceBackground);
6586

src/main/java/io/github/moehreag/axolotlclient/config/AxolotlclientConfig.java-

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

src/main/java/io/github/moehreag/axolotlclient/mixin/AccessorMinecraftClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
@Mixin(MinecraftClient.class)
88
public interface AccessorMinecraftClient {
99
@Accessor
10-
int getCurrentFps();
10+
static int getCurrentFps() {
11+
return 0;
12+
}
1113
}
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
package io.github.moehreag.axolotlclient.mixin;
22

3+
import io.github.moehreag.axolotlclient.AxolotlClient;
34
import net.minecraft.util.crash.CrashReport;
45
import org.spongepowered.asm.mixin.Mixin;
56
import org.spongepowered.asm.mixin.injection.At;
67
import org.spongepowered.asm.mixin.injection.Inject;
78
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
89

10+
import java.util.Objects;
11+
912
@Mixin(CrashReport.class)
1013
public class MixinCrashReport {
1114

1215
@Inject(method = "addStackTrace", at = @At(value = "TAIL"))
1316
public void addAxolotlclientInfo(StringBuilder builder, CallbackInfo ci){
14-
builder.append("\n\n");
15-
builder.append("---- Axolotlclient Information ----\n");
16-
/*if (Axolotlclient.TitleDisclaimer){
17-
builder.append("Unsupported Mods were found!\n");
18-
builder.append("Suspected mod: ").append(Axolotlclient.badmod);
19-
} else if (!Axolotlclient.features) {
20-
builder.append("The mod is being used outside of Axolotlclient!\n");
21-
builder.append("No support whatsoever will be given!");
22-
23-
} else {
24-
builder.append("No unsupported Mods found…\n");
25-
builder.append("No clear sign why his crashed…");
26-
}*/
27-
17+
builder.append("\n\n")
18+
.append("---- Axolotlclient Information ----\n");
19+
if (!Objects.equals(AxolotlClient.badmod, "")){
20+
builder.append("Unsupported Mods were found!\n")
21+
.append("Suspected mod: ")
22+
.append(AxolotlClient.badmod);
23+
}
2824
builder.append("\n\n");
2925
}
3026
}

src/main/java/io/github/moehreag/axolotlclient/mixin/MixinTitleScreen.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package io.github.moehreag.axolotlclient.mixin;
22

33

4+
import io.github.moehreag.axolotlclient.AxolotlClient;
45
import io.github.moehreag.axolotlclient.modules.hud.HudEditScreen;
56
import io.github.moehreag.axolotlclient.util.DiscordRPC;
67
import net.minecraft.SharedConstants;
78
import net.minecraft.client.MinecraftClient;
9+
import net.minecraft.client.gui.screen.ConfirmScreen;
810
import net.minecraft.client.gui.screen.Screen;
911
import net.minecraft.client.gui.screen.TitleScreen;
1012
import net.minecraft.client.gui.widget.ButtonWidget;
1113
import net.minecraft.client.util.math.MatrixStack;
1214
import net.minecraft.text.Text;
15+
import net.minecraft.util.Formatting;
1316
import org.quiltmc.loader.api.QuiltLoader;
1417
import org.spongepowered.asm.mixin.Mixin;
1518
import org.spongepowered.asm.mixin.injection.At;
@@ -19,6 +22,8 @@
1922
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2023
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
2124

25+
import java.util.Objects;
26+
2227
@Mixin(TitleScreen.class)
2328
public abstract class MixinTitleScreen extends Screen{
2429

@@ -49,32 +54,32 @@ public String setVersionText(String s){
4954
@Inject(method = "init", at = @At("HEAD"))
5055
public void showBadModsScreen(CallbackInfo ci){
5156

52-
/*if (Axolotlclient.showWarning) {
57+
if (AxolotlClient.showWarning) {
5358
MinecraftClient.getInstance().setScreen(new ConfirmScreen(
5459
(boolean confirmed) -> {
5560
if (confirmed) {
56-
Axolotlclient.showWarning = false;
57-
Axolotlclient.TitleDisclaimer = true;
61+
AxolotlClient.showWarning = false;
62+
AxolotlClient.titleDisclaimer = true;
5863
System.out.println("Proceed with Caution!");
5964
MinecraftClient.getInstance().setScreen(new TitleScreen());
6065
} else {
6166
MinecraftClient.getInstance().stop();
6267
}
6368
},
64-
new LiteralText("Axolotlclient warning").formatted(Formatting.RED),
65-
new LiteralText("The mod ").append(
66-
new LiteralText(Axolotlclient.badmod).formatted(Formatting.BOLD, Formatting.DARK_RED)).append(" is most likely prohibited to be used on many Servers!\n" +
67-
"I will not be responsible for any punishment you will get for using it. Proceed with Caution!"),
68-
new LiteralText("Proceed"), new TranslatableText("menu.quit")));
69-
}*/
69+
Text.literal("Axolotlclient warning").formatted(Formatting.RED),
70+
Text.literal("The mod ").append(
71+
Text.literal(AxolotlClient.badmod).formatted(Formatting.BOLD, Formatting.DARK_RED)).append(" is most likely prohibited to be used on many Servers!\n" +
72+
"AxolotlClient will not be responsible for any punishment you will get for using it. Proceed with Caution!"),
73+
Text.literal("Proceed"), Text.translatable("menu.quit")));
74+
}
7075
}
7176

7277
@Inject(method = "render", at = @At("TAIL"))
7378
public void addDisclaimer(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci){
74-
/*if(Axolotlclient.TitleDisclaimer){
79+
if(AxolotlClient.titleDisclaimer){
7580
TitleScreen.drawCenteredText(matrices, this.textRenderer, "You are playing at your own risk with unsupported Mods",
7681
this.width/2, 5, 0xFFCC8888);
7782
TitleScreen.drawCenteredText(matrices, this.textRenderer, "Things could break!", this.width/2, 15, 0xFFCC8888);
78-
}*/
83+
}
7984
}
8085
}

src/main/java/io/github/moehreag/axolotlclient/modules/hud/gui/hud/ArmorHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void render(MatrixStack matrices) {
5050
lastY = lastY - 20;
5151
for (int i = 0; i <= 3; i++) {
5252
ItemStack item = client.player.getInventory().armor.get(i);
53-
renderItem(matrices, item, pos.x + 2, lastY + pos.y);
53+
renderItem(matrices, item.copy(), pos.x + 2, lastY + pos.y);
5454
lastY = lastY - 20;
5555
}
5656
matrices.pop();

src/main/java/io/github/moehreag/axolotlclient/modules/hud/gui/hud/FPSHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Identifier getId() {
2525

2626
@Override
2727
public String getValue() {
28-
return ((AccessorMinecraftClient)MinecraftClient.getInstance()).getCurrentFps() + " FPS";
28+
return AccessorMinecraftClient.getCurrentFps() + " FPS";
2929
}
3030

3131
@Override

src/main/java/io/github/moehreag/axolotlclient/modules/hud/util/ItemUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import net.minecraft.client.render.VertexConsumerProvider;
1616
import net.minecraft.client.render.model.BakedModel;
1717
import net.minecraft.client.render.model.json.ModelTransformation;
18-
import net.minecraft.client.texture.SpriteAtlasTexture;
1918
import net.minecraft.client.util.math.MatrixStack;
2019
import net.minecraft.item.ItemStack;
2120
import net.minecraft.screen.PlayerScreenHandler;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"rightcps": "Show Rightclick Cps",
9191
"fpshud": "FPS HUD",
9292
"armorhud": "Armor HUD",
93+
"showProtectionLevel": "Show Protection Level",
9394
"potionshud": "Potion HUD",
9495
"keystrokehud": "Keystrokes",
9596
"speedhud": "Speed HUD",

0 commit comments

Comments
 (0)