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

Commit 6d712a7

Browse files
committed
more parity features to 1.8.9
1 parent 9ad1582 commit 6d712a7

File tree

11 files changed

+66
-100
lines changed

11 files changed

+66
-100
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.github.moehreag.axolotlclient.mixin;
2+
3+
import net.minecraft.client.MinecraftClient;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.gen.Accessor;
6+
7+
@Mixin(MinecraftClient.class)
8+
public interface AccessorMinecraftClient {
9+
@Accessor
10+
int getCurrentFps();
11+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public abstract class MixinMouse {
1212

1313
@Inject(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBind;setKeyPressed(Lcom/mojang/blaze3d/platform/InputUtil$Key;Z)V"))
1414
private void onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
15-
System.out.println(action);
1615
if (action == 1) {
1716
Hooks.MOUSE_INPUT.invoker().onMouseButton(window, button, action, mods);
1817
}

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
package io.github.moehreag.axolotlclient.modules.hud.gui.hud;
22

3-
import com.mojang.blaze3d.platform.GlStateManager;
4-
import com.mojang.blaze3d.systems.RenderSystem;
5-
import io.github.moehreag.axolotlclient.config.Color;
63
import io.github.moehreag.axolotlclient.config.options.BooleanOption;
74
import io.github.moehreag.axolotlclient.config.options.Option;
85
import io.github.moehreag.axolotlclient.modules.hud.gui.AbstractHudEntry;
96
import io.github.moehreag.axolotlclient.modules.hud.util.DrawPosition;
107
import io.github.moehreag.axolotlclient.modules.hud.util.ItemUtil;
118
import net.minecraft.client.util.math.MatrixStack;
12-
import net.minecraft.enchantment.Enchantment;
139
import net.minecraft.enchantment.EnchantmentHelper;
1410
import net.minecraft.enchantment.Enchantments;
1511
import net.minecraft.item.ItemStack;
1612
import net.minecraft.item.Items;
1713
import net.minecraft.nbt.NbtCompound;
18-
import net.minecraft.nbt.NbtList;
1914
import net.minecraft.util.Identifier;
2015
import net.minecraft.util.registry.Registry;
2116

2217
import java.util.List;
2318
import java.util.Objects;
19+
import java.util.concurrent.atomic.AtomicInteger;
2420

2521
/**
2622
* This implementation of Hud modules is based on KronHUD.
@@ -42,10 +38,12 @@ public void render(MatrixStack matrices) {
4238
matrices.push();
4339
scale(matrices);
4440
DrawPosition pos = getPos();
41+
4542
if (background.get()) {
4643
fillRect(matrices, getBounds(),
4744
backgroundColor.get());
4845
}
46+
if(outline.get()) outlineRect(matrices, getBounds(), outlineColor.get());
4947
int lastY = 2 + (4 * 20);
5048
assert client.player != null;
5149
renderMainItem(matrices, client.player.getInventory().getMainHandStack(), pos.x + 2, pos.y + lastY);
@@ -59,34 +57,22 @@ public void render(MatrixStack matrices) {
5957
}
6058

6159
public void renderItem(MatrixStack matrices, ItemStack stack, int x, int y) {
62-
//MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(stack, x, y);e
63-
64-
ItemUtil.renderGuiItemModel(matrices, stack, x, y);
65-
//client.getItemRenderer().
66-
ItemUtil.renderGuiItemOverlay(matrices, client.textRenderer, stack, x, y, null, textColor.get().getAsInt(),
67-
shadow.get());
6860

69-
matrices.push();
70-
matrices.translate(0, 0, client.getItemRenderer().zOffset + 200F);
71-
RenderSystem.disableDepthTest();
72-
if(showProtLvl.get() && stack.hasEnchantments()){
73-
NbtList nbtList = stack.getEnchantments();
74-
for(int i = 0; i < stack.getEnchantments().size(); ++i) {
61+
if(showProtLvl.get() && stack.hasEnchantments()) {
62+
for (int i = 0; i < stack.getEnchantments().size(); ++i) {
7563
NbtCompound nbtCompound = stack.getEnchantments().getCompound(i);
7664
Registry.ENCHANTMENT
7765
.getOrEmpty(EnchantmentHelper.getIdFromNbt(nbtCompound))
7866
.ifPresent(e -> {
79-
if(Objects.equals(e.getTranslationKey(), Enchantments.PROTECTION.getTranslationKey())) {
80-
drawCenteredString(matrices,
81-
client.textRenderer,
82-
String.valueOf(EnchantmentHelper.getLevelFromNbt(nbtCompound)),
83-
new DrawPosition(x + width / 2, y + 4), textColor.get(), shadow.get());
67+
if (Objects.equals(e.getTranslationKey(), Enchantments.PROTECTION.getTranslationKey())) {
68+
stack.setCount(EnchantmentHelper.getLevelFromNbt(nbtCompound));
8469
}
8570
});
8671
}
8772
}
88-
RenderSystem.enableDepthTest();
89-
matrices.pop();
73+
ItemUtil.renderGuiItemModel(matrices, stack, x, y);
74+
ItemUtil.renderGuiItemOverlay(matrices, client.textRenderer, stack, x, y, null, textColor.get().getAsInt(),
75+
shadow.get());
9076
}
9177

9278
public void renderMainItem(MatrixStack matrices, ItemStack stack, int x, int y) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void render(MatrixStack matrices) {
4949
if (background.get()) {
5050
fillRect(matrices, getBounds(), backgroundColor.get());
5151
}
52+
if(outline.get()) outlineRect(matrices, getBounds(), outlineColor.get());
5253
drawCenteredString(matrices, client.textRenderer, String.valueOf(arrows), new DrawPosition(pos.x + width / 2,
5354
pos.y + height - 10), textColor.get(), shadow.get());
5455
ItemUtil.renderGuiItemModel(matrices, currentArrow, pos.x + 2, pos.y + 2);

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import io.github.moehreag.axolotlclient.config.options.Option;
55
import io.github.moehreag.axolotlclient.util.Hooks;
66
import net.minecraft.util.Identifier;
7-
import org.lwjgl.glfw.GLFWMouseButtonCallback;
8-
import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents;
9-
import org.quiltmc.qsl.screen.api.client.ScreenMouseEvents;
7+
import net.minecraft.util.Util;
108

119
import java.util.ArrayList;
1210
import java.util.List;
@@ -23,9 +21,6 @@ public class CPSHud extends CleanHudEntry {
2321
private final BooleanOption fromKeybindings = new BooleanOption("cpskeybind", false);
2422
private final BooleanOption rmb = new BooleanOption("rightcps", false);
2523

26-
boolean rc;
27-
boolean lc;
28-
2924
public CPSHud() {
3025
super();
3126
Hooks.MOUSE_INPUT.register((window, button, action, mods) -> {
@@ -100,11 +95,11 @@ public ClickList() {
10095
}
10196

10297
public void update() {
103-
//clicks.removeIf((click) -> MinecraftClient.getTime() - click > 1000);
98+
clicks.removeIf((click) -> Util.getMeasuringTimeMs() - click > 1000);
10499
}
105100

106101
public void click() {
107-
//clicks.add(MinecraftClient.getTime());
102+
clicks.add(Util.getMeasuringTimeMs());
108103
}
109104

110105
public int clicks() {

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

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,23 @@ public CoordsHud() {
3333
}
3434

3535
public static String getZDir(int dir) {
36-
switch (dir) {
37-
case 5:
38-
return "++";
39-
case 4:
40-
case 6:
41-
return "+";
42-
case 8:
43-
case 2:
44-
return "-";
45-
case 1:
46-
return "--";
47-
}
48-
return "";
36+
return switch (dir) {
37+
case 5 -> "++";
38+
case 4, 6 -> "+";
39+
case 8, 2 -> "-";
40+
case 1 -> "--";
41+
default -> "";
42+
};
4943
}
5044

5145
public static String getXDir(int dir) {
52-
switch (dir) {
53-
case 3:
54-
return "++";
55-
case 2:
56-
case 4:
57-
return "+";
58-
case 6:
59-
case 8:
60-
return "-";
61-
case 7:
62-
return "--";
63-
}
64-
return "";
46+
return switch (dir) {
47+
case 3 -> "++";
48+
case 2, 4 -> "+";
49+
case 6, 8 -> "-";
50+
case 7 -> "--";
51+
default -> "";
52+
};
6553
}
6654

6755
/**
@@ -107,6 +95,9 @@ public void render(MatrixStack matrices) {
10795
if (background.get()) {
10896
fillRect(matrices, getBounds(), backgroundColor.get());
10997
}
98+
if(outline.get()) {
99+
outlineRect(matrices, getBounds(), outlineColor.get());
100+
}
110101
StringBuilder format = new StringBuilder("#");
111102
if (decimalPlaces.get() > 0) {
112103
format.append(".");
@@ -189,37 +180,18 @@ public void renderPlaceholder(MatrixStack matrices) {
189180
}
190181

191182
public String getWordedDirection(int dir) {
192-
String direction = "";
193-
switch (dir) {
194-
case 1:
195-
direction = "N";
196-
break;
197-
case 2:
198-
direction = "NE";
199-
break;
200-
case 3:
201-
direction = "E";
202-
break;
203-
case 4:
204-
direction = "SE";
205-
break;
206-
case 5:
207-
direction = "S";
208-
break;
209-
case 6:
210-
direction = "SW";
211-
break;
212-
case 7:
213-
direction = "W";
214-
break;
215-
case 8:
216-
direction = "NW";
217-
break;
218-
case 0:
219-
direction = "?";
220-
break;
221-
}
222-
return direction;
183+
return switch (dir) {
184+
case 1 -> "N";
185+
case 2 -> "NE";
186+
case 3 -> "E";
187+
case 4 -> "SE";
188+
case 5 -> "S";
189+
case 6 -> "SW";
190+
case 7 -> "W";
191+
case 8 -> "NW";
192+
case 0 -> "?";
193+
default -> "";
194+
};
223195
}
224196

225197
@Override

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.moehreag.axolotlclient.modules.hud.gui.hud;
22

3+
import io.github.moehreag.axolotlclient.mixin.AccessorMinecraftClient;
34
import net.minecraft.client.MinecraftClient;
45
import net.minecraft.util.Identifier;
56

@@ -24,7 +25,7 @@ public Identifier getId() {
2425

2526
@Override
2627
public String getValue() {
27-
return "095";//MinecraftClient.getCurrentFps() + " FPS";
28+
return ((AccessorMinecraftClient)MinecraftClient.getInstance()).getCurrentFps() + " FPS";
2829
}
2930

3031
@Override

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ private void renderScoreboardSidebar(MatrixStack matrices, ScoreboardObjective o
169169
fillRect(matrices, new Rectangle(scoreX - 2, relativeY - 1, maxWidth, 1),
170170
backgroundColor.get());
171171
}
172+
172173
float title = (float) (scoreX + maxWidth / 2 - displayNameWidth / 2 - 1);
173174
if (shadow.get()) {
174175
client.textRenderer.drawWithShadow(matrices, text, title, (float) (relativeY - 9), -1);
@@ -178,6 +179,7 @@ private void renderScoreboardSidebar(MatrixStack matrices, ScoreboardObjective o
178179
}
179180
}
180181
}
182+
if(outline.get()) outlineRect(matrices, new Rectangle(textOffset, calculated.y-2, maxWidth, calculated.height+2), outlineColor.get());
181183
}
182184

183185
@Override

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import net.minecraft.client.texture.SpriteAtlasTexture;
1919
import net.minecraft.client.util.math.MatrixStack;
2020
import net.minecraft.item.ItemStack;
21+
import net.minecraft.screen.PlayerScreenHandler;
2122
import net.minecraft.util.Util;
2223
import net.minecraft.util.math.MathHelper;
2324

@@ -137,12 +138,11 @@ public static List<ItemStorage> compare(List<ItemStorage> list1, List<ItemStorag
137138
return list;
138139
}
139140

140-
@SuppressWarnings("deprecated")
141141
public static void renderGuiItemModel(MatrixStack matrices, ItemStack stack, float x, float y) {
142142
MinecraftClient client = MinecraftClient.getInstance();
143143
BakedModel model = client.getItemRenderer().getHeldItemModel(stack, null, client.player, (int) (x * y));
144-
client.getTextureManager().getTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
145-
RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
144+
client.getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
145+
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
146146
RenderSystem.enableBlend();
147147
RenderSystem.blendFunc(GlStateManager.class_4535.SRC_ALPHA, GlStateManager.class_4534.ONE_MINUS_SRC_ALPHA);
148148
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

src/main/java/io/github/moehreag/axolotlclient/util/Hooks.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package io.github.moehreag.axolotlclient.util;
22

3-
import net.fabricmc.fabric.api.event.EventFactory;
4-
import net.fabricmc.fabric.api.event.Event;
5-
//import org.quiltmc.qsl.base.api.event.Event;
3+
import org.quiltmc.qsl.base.api.event.Event;
64

75
/**
86
* This implementation of Hud modules is based on KronHUD.
@@ -12,19 +10,19 @@
1210

1311
public class Hooks {
1412

15-
public static final Event<MouseInputCallback> MOUSE_INPUT = EventFactory.createArrayBacked(MouseInputCallback.class, listeners -> ((window, button, action, mods) -> {
13+
public static final Event<MouseInputCallback> MOUSE_INPUT = Event.create(MouseInputCallback.class, listeners -> ((window, button, action, mods) -> {
1614
for (MouseInputCallback listener : listeners) {
1715
listener.onMouseButton(window, button, action, mods);
1816
}
1917
}));
2018

21-
public static final Event<KeyBindingCallback.ChangeBind> KEYBIND_CHANGE = EventFactory.createArrayBacked(KeyBindingCallback.ChangeBind.class, listeners -> ((key) -> {
19+
public static final Event<KeyBindingCallback.ChangeBind> KEYBIND_CHANGE = Event.create(KeyBindingCallback.ChangeBind.class, listeners -> ((key) -> {
2220
for (KeyBindingCallback.ChangeBind listener : listeners) {
2321
listener.setBoundKey(key);
2422
}
2523
}));
2624

27-
public static final Event<KeyBindingCallback.OnPress> KEYBIND_PRESS = EventFactory.createArrayBacked(KeyBindingCallback.OnPress.class, listeners -> ((key) -> {
25+
public static final Event<KeyBindingCallback.OnPress> KEYBIND_PRESS = Event.create(KeyBindingCallback.OnPress.class, listeners -> ((key) -> {
2826
for (KeyBindingCallback.OnPress listener : listeners) {
2927
listener.onPress(key);
3028
}

0 commit comments

Comments
 (0)