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

Commit bac9c98

Browse files
committed
Add option to show the main hand item above the armor
1 parent 7326a15 commit bac9c98

File tree

7 files changed

+53
-12
lines changed
  • .github/workflows
  • 1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item
  • 1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item
  • 1.21.4/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item
  • 1.21/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item
  • 1.8.9/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item
  • common/src/main/resources/assets/axolotlclient/lang

7 files changed

+53
-12
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: ./gradlew build collectBuilds
3535

3636
- name: Release
37-
uses: Kir-Antipov/mc-publish@v3.3
37+
uses: Kira-NT/mc-publish@v3.3
3838
with:
3939
github-token: "${{ secrets.GITHUB_TOKEN }}"
4040
changelog-file: "CHANGELOG.md"

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/item/ArmorHud.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class ArmorHud extends TextHudEntry implements DynamicallyPositionable {
5959
new ItemStack(Items.IRON_SWORD)};
6060
private final BooleanOption showDurabilityNumber = new BooleanOption("show_durability_num", false);
6161
private final BooleanOption showMaxDurabilityNumber = new BooleanOption("show_max_durability_num", false);
62+
private final BooleanOption mainHandItemOnTop = new BooleanOption("armorhud.main_hand_item_top", false);
6263

6364
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
6465
AnchorPoint.TOP_RIGHT);
@@ -82,8 +83,11 @@ public void renderComponent(MatrixStack matrices, float delta) {
8283
}
8384
DrawPosition pos = getPos();
8485
int lastY = 2 + (4 * 20);
85-
renderMainItem(matrices, client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
86-
lastY = lastY - 20;
86+
boolean mainHandItemTop = mainHandItemOnTop.get();
87+
if (!mainHandItemTop) {
88+
renderMainItem(matrices, client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
89+
lastY = lastY - 20;
90+
}
8791
for (int i = 0; i <= 3; i++) {
8892
ItemStack stack = client.player.inventory.getArmorStack(i).copy();
8993
if (showProtLvl.get() && stack.hasEnchantments()) {
@@ -101,6 +105,9 @@ public void renderComponent(MatrixStack matrices, float delta) {
101105
renderItem(matrices, stack, pos.x() + 2, lastY + pos.y(), labelWidth);
102106
lastY = lastY - 20;
103107
}
108+
if (mainHandItemTop) {
109+
renderMainItem(matrices, client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
110+
}
104111
}
105112

106113
public void renderMainItem(MatrixStack matrices, ItemStack stack, int x, int y, int offset) {
@@ -174,6 +181,7 @@ public List<Option<?>> getConfigurationOptions() {
174181
options.add(showDurabilityNumber);
175182
options.add(showMaxDurabilityNumber);
176183
options.add(anchor);
184+
options.add(mainHandItemOnTop);
177185
return options;
178186
}
179187

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class ArmorHud extends TextHudEntry implements DynamicallyPositionable {
5858
new ItemStack(Items.IRON_SWORD)};
5959
private final BooleanOption showDurabilityNumber = new BooleanOption("show_durability_num", false);
6060
private final BooleanOption showMaxDurabilityNumber = new BooleanOption("show_max_durability_num", false);
61+
private final BooleanOption mainHandItemOnTop = new BooleanOption("armorhud.main_hand_item_top", false);
6162

6263
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
6364
AnchorPoint.TOP_RIGHT);
@@ -81,8 +82,11 @@ public void renderComponent(GuiGraphics graphics, float delta) {
8182
}
8283
DrawPosition pos = getPos();
8384
int lastY = 2 + (4 * 20);
84-
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
85-
lastY = lastY - 20;
85+
boolean mainHandItemTop = mainHandItemOnTop.get();
86+
if (!mainHandItemTop) {
87+
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
88+
lastY = lastY - 20;
89+
}
8690
for (int i = 0; i <= 3; i++) {
8791
ItemStack stack = client.player.getInventory().getArmorStack(i).copy();
8892
if (showProtLvl.get() && stack.hasEnchantments()) {
@@ -100,6 +104,9 @@ public void renderComponent(GuiGraphics graphics, float delta) {
100104
renderItem(graphics, stack, pos.x() + 2, lastY + pos.y(), labelWidth);
101105
lastY = lastY - 20;
102106
}
107+
if (mainHandItemTop) {
108+
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
109+
}
103110
}
104111

105112
public void renderMainItem(GuiGraphics graphics, ItemStack stack, int x, int y, int offset) {
@@ -167,6 +174,7 @@ public List<Option<?>> getConfigurationOptions() {
167174
options.add(showDurabilityNumber);
168175
options.add(showMaxDurabilityNumber);
169176
options.add(anchor);
177+
options.add(mainHandItemOnTop);
170178
return options;
171179
}
172180

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class ArmorHud extends TextHudEntry implements DynamicallyPositionable {
5959
new ItemStack(Items.IRON_CHESTPLATE), new ItemStack(Items.IRON_HELMET), new ItemStack(Items.IRON_SWORD)};
6060
private final BooleanOption showDurabilityNumber = new BooleanOption("show_durability_num", false);
6161
private final BooleanOption showMaxDurabilityNumber = new BooleanOption("show_max_durability_num", false);
62+
private final BooleanOption mainHandItemOnTop = new BooleanOption("armorhud.main_hand_item_top", false);
6263

6364
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
6465
AnchorPoint.TOP_RIGHT);
@@ -82,8 +83,11 @@ public void renderComponent(GuiGraphics graphics, float delta) {
8283
}
8384
DrawPosition pos = getPos();
8485
int lastY = 2 + (4 * 20);
85-
renderMainItem(graphics, client.player.getInventory().getSelected(), pos.x() + 2, pos.y() + lastY, labelWidth);
86-
lastY = lastY - 20;
86+
boolean mainHandItemTop = mainHandItemOnTop.get();
87+
if (!mainHandItemTop) {
88+
renderMainItem(graphics, client.player.getInventory().getSelected(), pos.x() + 2, pos.y() + lastY, labelWidth);
89+
lastY = lastY - 20;
90+
}
8791
for (int i = 0; i <= 3; i++) {
8892
ItemStack stack = client.player.getInventory().getArmor(i).copy();
8993
if (showProtLvl.get() && stack.isEnchanted()) {
@@ -94,6 +98,9 @@ public void renderComponent(GuiGraphics graphics, float delta) {
9498
renderItem(graphics, stack, pos.x() + 2, lastY + pos.y(), labelWidth);
9599
lastY = lastY - 20;
96100
}
101+
if (mainHandItemTop) {
102+
renderMainItem(graphics, client.player.getInventory().getSelected(), pos.x() + 2, pos.y() + lastY, labelWidth);
103+
}
97104
}
98105

99106
public void renderMainItem(GuiGraphics graphics, ItemStack stack, int x, int y, int offset) {
@@ -162,6 +169,7 @@ public List<Option<?>> getConfigurationOptions() {
162169
options.add(showDurabilityNumber);
163170
options.add(showMaxDurabilityNumber);
164171
options.add(anchor);
172+
options.add(mainHandItemOnTop);
165173
return options;
166174
}
167175

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class ArmorHud extends TextHudEntry implements DynamicallyPositionable {
6060
new ItemStack(Items.IRON_SWORD)};
6161
private final BooleanOption showDurabilityNumber = new BooleanOption("show_durability_num", false);
6262
private final BooleanOption showMaxDurabilityNumber = new BooleanOption("show_max_durability_num", false);
63+
private final BooleanOption mainHandItemOnTop = new BooleanOption("armorhud.main_hand_item_top", false);
6364

6465
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
6566
AnchorPoint.TOP_RIGHT);
@@ -83,8 +84,11 @@ public void renderComponent(GuiGraphics graphics, float delta) {
8384
}
8485
DrawPosition pos = getPos();
8586
int lastY = 2 + (4 * 20);
86-
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
87-
lastY = lastY - 20;
87+
boolean mainHandItemTop = mainHandItemOnTop.get();
88+
if (!mainHandItemTop) {
89+
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
90+
lastY = lastY - 20;
91+
}
8892
for (int i = 0; i <= 3; i++) {
8993
ItemStack stack = client.player.getInventory().getArmorStack(i).copy();
9094
if (showProtLvl.get() && stack.hasEnchantments()) {
@@ -99,6 +103,9 @@ public void renderComponent(GuiGraphics graphics, float delta) {
99103
renderItem(graphics, stack, pos.x() + 2, lastY + pos.y(), labelWidth);
100104
lastY = lastY - 20;
101105
}
106+
if (!mainHandItemTop) {
107+
renderMainItem(graphics, client.player.getInventory().getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
108+
}
102109
}
103110

104111
public void renderMainItem(GuiGraphics graphics, ItemStack stack, int x, int y, int offset) {
@@ -166,6 +173,7 @@ public List<Option<?>> getConfigurationOptions() {
166173
options.add(showDurabilityNumber);
167174
options.add(showMaxDurabilityNumber);
168175
options.add(anchor);
176+
options.add(mainHandItemOnTop);
169177
return options;
170178
}
171179

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class ArmorHud extends TextHudEntry implements DynamicallyPositionable {
5858
new ItemStack(Items.IRON_SWORD)};
5959
private final BooleanOption showDurabilityNumber = new BooleanOption("show_durability_num", false);
6060
private final BooleanOption showMaxDurabilityNumber = new BooleanOption("show_max_durability_num", false);
61+
private final BooleanOption mainHandItemOnTop = new BooleanOption("armorhud.main_hand_item_top", false);
6162

6263
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
6364
AnchorPoint.TOP_RIGHT);
@@ -82,8 +83,11 @@ public void renderComponent(float delta) {
8283
}
8384
DrawPosition pos = getPos();
8485
int lastY = 2 + (4 * 20);
85-
renderMainItem(client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
86-
lastY = lastY - 20;
86+
boolean mainHandItemTop = mainHandItemOnTop.get();
87+
if (!mainHandItemTop) {
88+
renderMainItem(client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
89+
lastY = lastY - 20;
90+
}
8791
for (int i = 0; i <= 3; i++) {
8892
if (client.player.inventory.armorSlots[i] != null) {
8993
ItemStack stack = client.player.inventory.armorSlots[i].copy();
@@ -104,6 +108,9 @@ public void renderComponent(float delta) {
104108

105109
lastY = lastY - 20;
106110
}
111+
if (mainHandItemTop) {
112+
renderMainItem(client.player.inventory.getMainHandStack(), pos.x() + 2, pos.y() + lastY, labelWidth);
113+
}
107114
}
108115

109116
public void renderMainItem(ItemStack stack, int x, int y, int offset) {
@@ -176,6 +183,7 @@ public List<Option<?>> getConfigurationOptions() {
176183
options.add(showDurabilityNumber);
177184
options.add(showMaxDurabilityNumber);
178185
options.add(anchor);
186+
options.add(mainHandItemOnTop);
179187
return options;
180188
}
181189

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,5 +735,6 @@
735735
"playerstats.duels.uhc_doubles": "UHC (Doubles)",
736736
"playerstats.duels.uhc_duel": "UHC (Duel)",
737737
"playerstats.duels.uhc_four": "UHC (Fours)",
738-
"playerstats.duels.mode_title": "Stats in %s:"
738+
"playerstats.duels.mode_title": "Stats in %s:",
739+
"armorhud.main_hand_item_top": "Main Hand Item above Armor"
739740
}

0 commit comments

Comments
 (0)