Skip to content
This repository was archived by the owner on Jul 9, 2026. It is now read-only.

Commit 8d273dc

Browse files
committed
fix bugs + finish up 1.7 player list at last
1 parent 49288bf commit 8d273dc

4 files changed

Lines changed: 85 additions & 21 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
33
org.gradle.parallel=true
44

55
# Mod Properties
6-
version=1.0.0-beta.4
6+
version=1.0.0-beta.5
77

88
maven_group=io.github.axolotlclient.oldanimations
99
archives_base_name=AxolotlClient-OldAnimations

src/main/java/io/github/axolotlclient/oldanimations/config/OldAnimationsConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public class OldAnimationsConfig {
129129
public final BooleanOption hideScoreboardHearts = new BooleanOption("hideScoreboardHearts", false);
130130
public final BooleanOption oldObjectivesPosition = new BooleanOption("oldObjectivesPosition", false);
131131
public final BooleanOption miningProgressResetLogic = new BooleanOption("miningProgressResetLogic", true);
132+
public final BooleanOption rowBasedEntryOrder = new BooleanOption("rowBasedEntryOrder", false);
132133

133134
private final Supplier<Boolean>[] suppliers = new Supplier[] {
134135
enabled::get,
@@ -237,6 +238,7 @@ public void initConfig() {
237238
disableTabFooter,
238239
hideScoreboardHearts,
239240
dontSortTabEntries,
241+
rowBasedEntryOrder,
240242
oldObjectivesPosition
241243
);
242244
category.add(categoryEnchantmentGlint);

src/main/java/io/github/axolotlclient/oldanimations/mixin/PlayerTabOverlayMixin.java

Lines changed: 79 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,81 @@
4343
import org.spongepowered.asm.mixin.injection.Slice;
4444

4545
import java.util.ArrayList;
46-
import java.util.Collections;
4746
import java.util.List;
4847

49-
@Mixin(value = PlayerTabOverlay.class)
48+
@Mixin(PlayerTabOverlay.class /* unmapped name is C_4052762 */)
5049
public abstract class PlayerTabOverlayMixin extends GuiElement {
5150

5251
@Shadow
5352
@Final
5453
private Minecraft minecraft;
5554

56-
//TODO: Player list entries are left adjacent in 1.8... we need to made them centered instead
55+
//TODO: i should audit the code and ensure it's all consistent and good. using shares so often is not a good sign lol
56+
// the bedwars module in axolotlclient may or may not conflict... im not sure...
57+
58+
@ModifyVariable(method = "render", at = @At("STORE"), index = 9)
59+
private int axolotlclient$captureLocalN(int original, @Share("localRefN") LocalIntRef localRefN) {
60+
/* honestly this could be written better, but, because of the modifications below, */
61+
/* the value of n changes. we need it to be the original value later on, so we should */
62+
/* store it for that usage */
63+
localRefN.set(original);
64+
return original;
65+
}
66+
67+
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 2), index = 9)
68+
private int axolotlclient$leftToRightEntryPopulation(int original, @Local(index = 10) int l) {
69+
/* this local represents the rows per column */
70+
/* in 1.7, the value used here is the number of columns however */
71+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rowBasedEntryOrder.get()) {
72+
return l;
73+
}
74+
return original;
75+
}
76+
77+
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 3), index = 9)
78+
private int axolotlclient$leftToRightEntryPopulation2(int original, @Local(index = 10) int l) {
79+
/* ditto */
80+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rowBasedEntryOrder.get()) {
81+
return l;
82+
}
83+
return original;
84+
}
85+
86+
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 4), index = 9)
87+
private int axolotlclient$useRightLocal(int original, @Share("localRefN") LocalIntRef localRefN) {
88+
/* bro istg. the above modifications kinda mess up the local n. silly mixins */
89+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rowBasedEntryOrder.get()) {
90+
return localRefN.get();
91+
}
92+
return original;
93+
}
94+
95+
@ModifyVariable(method = "render", at = @At("STORE"), index = 20)
96+
private int axolotlclient$captureLocalV(int original, @Share("localRefV") LocalIntRef localRefV) {
97+
/* not again... */
98+
localRefV.set(original);
99+
return original;
100+
}
101+
102+
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 0), index = 20)
103+
private int axolotlclient$swapLocals(int original, @Local(index = 21) int t) {
104+
/* this local represents the column index */
105+
/* in 1.7, the local called here is the row index local */
106+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rowBasedEntryOrder.get()) {
107+
return t;
108+
}
109+
return original;
110+
}
111+
112+
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 1), index = 21)
113+
private int axolotlclient$swapLocals2(int original, @Share("localRefV") LocalIntRef localRefV) {
114+
/* this local represents the row index */
115+
/* in 1.7, the local called here is the column index local */
116+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rowBasedEntryOrder.get()) {
117+
return localRefV.get();
118+
}
119+
return original;
120+
}
57121

58122
@ModifyVariable(method = "render", at = @At("STORE"))
59123
private List<PlayerInfo> axolotlclient$doNotSortList(List<PlayerInfo> original, @Local ClientPlayNetworkHandler clientPlayNetworkHandler) {
@@ -64,17 +128,8 @@ public abstract class PlayerTabOverlayMixin extends GuiElement {
64128
return original;
65129
}
66130

67-
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 0), index = 5)
68-
private List<PlayerInfo> axolotlclient$useOldObjectivesPositionLogic(List<PlayerInfo> original) {
69-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldObjectivesPosition.get()) {
70-
/* because we're porting the 1.7 logic over below, we can just skip this for loop completely */
71-
return Collections.EMPTY_LIST;
72-
}
73-
return original;
74-
}
75-
76131
@ModifyVariable(method = "render", at = @At("LOAD"), index = 6, ordinal = 1)
77-
private int axolotlclient$useOldObjectivesPositionLogic2(int original, @Local(index = 25) String string2) {
132+
private int axolotlclient$useOldObjectivesPositionLogic(int original, @Local(index = 25) String string2) {
78133
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldObjectivesPosition.get()) {
79134
/* taken from 1.7 */
80135
return minecraft.textRenderer.getWidth(string2) + 4;
@@ -83,7 +138,7 @@ public abstract class PlayerTabOverlayMixin extends GuiElement {
83138
}
84139

85140
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 0), index = 27)
86-
private int axolotlclient$useOldObjectivesPositionLogic3(int original, @Local(index = 22) int w, @Share("localRefAc") LocalIntRef localRefAc) {
141+
private int axolotlclient$useOldObjectivesPositionLogic2(int original, @Local(index = 22) int w, @Share("localRefAc") LocalIntRef localRefAc) {
87142
/* storing the original value for later use */
88143
localRefAc.set(original);
89144
/* we need to solely use the player name/head position to determine the placement of the objective number like 1.7 */
@@ -97,7 +152,7 @@ public abstract class PlayerTabOverlayMixin extends GuiElement {
97152
}
98153

99154
@ModifyVariable(method = "render", at = @At(value = "LOAD", ordinal = 1), index = 12)
100-
private int axolotlclient$useOldObjectivesPositionLogic4(int original, @Local(index = 13) int p) {
155+
private int axolotlclient$useOldObjectivesPositionLogic3(int original, @Local(index = 13) int p) {
101156
/* rahh */
102157
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldObjectivesPosition.get() ? p - 17 : original;
103158
}
@@ -125,6 +180,12 @@ public abstract class PlayerTabOverlayMixin extends GuiElement {
125180
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.tabDimensions.get() ? minecraft.getNetworkHandler().maxPlayerCount : original.call(instance);
126181
}
127182

183+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/List;subList(II)Ljava/util/List;"))
184+
private <E extends PlayerInfo> List<E> axolotlclient$dontModifyPlayerList(List<E> list, int fromIndex, int toIndex, Operation<List<E>> original) {
185+
/* don't modify the list just like 1.7 */
186+
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.tabDimensions.get() ? list : original.call(list, fromIndex, toIndex);
187+
}
188+
128189
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(II)I", ordinal = 1))
129190
private int axolotlclient$staticSlotWidth(int a, int b, Operation<Integer> original) {
130191
/* makes the slot width static just like 1.7 */
@@ -176,10 +237,9 @@ public abstract class PlayerTabOverlayMixin extends GuiElement {
176237
return par1 - (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.tabDimensions.get() ? 1 : 0);
177238
}
178239

179-
//TODO: This can be a better injection
180-
@ModifyExpressionValue(method = "renderPing", at = @At(value = "CONSTANT", args = "intValue=11"))
181-
private int axolotlclient$movePingElement(int original) {
240+
@ModifyArg(method = "renderPing", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/PlayerTabOverlay;drawTexture(IIIIII)V"), index = 1)
241+
private int axolotlclient$movePingElement(int par1) {
182242
/* move the ping element */
183-
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.tabDimensions.get() ? 12 : original;
243+
return par1 - (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.tabDimensions.get() ? 1 : 0);
184244
}
185245
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,7 @@
170170
"oldObjectivesPosition": "Old Objectives Position",
171171
"oldObjectivesPosition.tooltip": "Positions player list objectives to be in the same position as they are in 1.7. They are aligned with the entity's name rather than with the end of the entry slot.",
172172
"miningProgressResetLogic": "Mining Progress Reset Logic",
173-
"miningProgressResetLogic.tooltip": "Without prejudice, mining progress WILL be reset when the player stops holding down their left mouse button just like in 1.7."
173+
"miningProgressResetLogic.tooltip": "Without prejudice, mining progress WILL be reset when the player stops holding down their left mouse button just like in 1.7.",
174+
"rowBasedEntryOrder": "Row Based Entry Order",
175+
"rowBasedEntryOrder.tooltip": "In 1.7, the player list entries are arranged across rows rather than down columns."
174176
}

0 commit comments

Comments
 (0)