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

Commit 8fb9d99

Browse files
committed
add bedwars resources hud
1 parent e015b17 commit 8fb9d99

File tree

27 files changed

+534
-21
lines changed

27 files changed

+534
-21
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/HudManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void init() {
121121
add(new MouseMovementHud());
122122
add(new DebugCountersHud());
123123
entries.put(BedwarsMod.getInstance().getUpgradesOverlay().getId(), BedwarsMod.getInstance().getUpgradesOverlay());
124+
entries.put(BedwarsMod.getInstance().getResourceOverlay().getId(), BedwarsMod.getInstance().getResourceOverlay());
124125

125126
entries.values().forEach(HudEntry::init);
126127

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsMod.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public class BedwarsMod implements AbstractHypixelMod {
6666
BedwarsLevelHeadMode.GAME_KILLS_GAME_DEATHS);
6767
@Getter
6868
protected final TeamUpgradesOverlay upgradesOverlay;
69+
@Getter
70+
protected final ResourceOverlay resourceOverlay;
6971
protected final BooleanOption removeAnnoyingMessages = new BooleanOption(getTranslationKey("removeAnnoyingMessages"), true);
7072
protected final BooleanOption overrideMessages = new BooleanOption(getTranslationKey("overrideMessages"), true);
7173
@Getter
@@ -80,6 +82,7 @@ public class BedwarsMod implements AbstractHypixelMod {
8082

8183
public BedwarsMod() {
8284
upgradesOverlay = new TeamUpgradesOverlay(this);
85+
resourceOverlay = new ResourceOverlay(this);
8386
}
8487

8588

@@ -88,6 +91,7 @@ public void init() {
8891
category.add(enabled, hardcoreHearts, showHunger, displayArmor, bedwarsLevelHead, bedwarsLevelHeadMode,
8992
removeAnnoyingMessages, tabRenderLatencyIcon, showChatTime, overrideMessages);
9093
category.add(upgradesOverlay.getAllOptions());
94+
category.add(resourceOverlay.getAllOptions());
9195
category.add(BedwarsDeathType.getOptions());
9296

9397
instance = this;
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*
2+
* Copyright © 2025 moehreag <[email protected]> & Contributors
3+
*
4+
* This file is part of AxolotlClient.
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*
20+
* For more information, see the LICENSE file.
21+
*/
22+
23+
package io.github.axolotlclient.modules.hypixel.bedwars;
24+
25+
import java.util.List;
26+
import java.util.Map;
27+
import java.util.function.Function;
28+
29+
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
30+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
31+
import io.github.axolotlclient.modules.hud.gui.entry.BoxHudEntry;
32+
import io.github.axolotlclient.modules.hud.util.ItemUtil;
33+
import net.minecraft.client.util.math.MatrixStack;
34+
import net.minecraft.item.Item;
35+
import net.minecraft.item.ItemStack;
36+
import net.minecraft.item.Items;
37+
import net.minecraft.util.Identifier;
38+
39+
public class ResourceOverlay extends BoxHudEntry {
40+
41+
public final static Identifier ID = new Identifier("axolotlclient", "bedwars_resources");
42+
private final BooleanOption renderWhenRelevant = new BooleanOption(ID.getPath() + ".renderWhenRelevant", true);
43+
private static final List<Item> RESOURCES = List.of(Items.IRON_INGOT, Items.GOLD_INGOT, Items.DIAMOND, Items.EMERALD);
44+
private static final Map<Item, Integer> PLACEHOLDER = Map.of(
45+
Items.IRON_INGOT, 3,
46+
Items.GOLD_INGOT, 43,
47+
Items.DIAMOND, 5,
48+
Items.EMERALD, 13
49+
);
50+
private final BedwarsMod mod;
51+
52+
public ResourceOverlay(BedwarsMod mod) {
53+
super(4 * 18 + 1, 18 + 1, true);
54+
this.mod = mod;
55+
}
56+
57+
@Override
58+
public void render(MatrixStack graphics, float delta) {
59+
if (!renderWhenRelevant.get() || mod.inGame()) {
60+
super.render(graphics, delta);
61+
}
62+
}
63+
64+
@Override
65+
public void renderComponent(MatrixStack graphics, float delta) {
66+
draw(graphics, s -> ItemUtil.getTotal(client, s));
67+
}
68+
69+
private void draw(MatrixStack graphics, Function<ItemStack, Integer> countFunction) {
70+
var pos = getPos();
71+
int x = pos.x() + 1;
72+
int y = pos.y() + 1;
73+
for (Item item : RESOURCES) {
74+
var stack = item.getDefaultStack();
75+
int amount = countFunction.apply(stack);
76+
if (amount > 0) {
77+
ItemUtil.renderGuiItemModel(getScale(), stack, x, y);
78+
ItemUtil.renderGuiItemOverlay(graphics, client.textRenderer, stack, x, y, String.valueOf(amount), -1, true);
79+
x += 18;
80+
}
81+
}
82+
}
83+
84+
@Override
85+
public void renderPlaceholderComponent(MatrixStack graphics, float delta) {
86+
draw(graphics, s -> PLACEHOLDER.get(s.getItem()));
87+
}
88+
89+
@Override
90+
public Identifier getId() {
91+
return ID;
92+
}
93+
94+
@Override
95+
public List<Option<?>> getConfigurationOptions() {
96+
List<Option<?>> options = super.getConfigurationOptions();
97+
options.add(renderWhenRelevant);
98+
return options;
99+
}
100+
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/TeamUpgradesOverlay.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.BedwarsTeamUpgrades;
3333
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.TeamUpgrade;
3434
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.TrapUpgrade;
35-
import net.minecraft.client.MinecraftClient;
3635
import net.minecraft.client.util.math.MatrixStack;
3736
import net.minecraft.util.Identifier;
3837

@@ -46,13 +45,11 @@ public class TeamUpgradesOverlay extends BoxHudEntry {
4645
private final static TrapUpgrade.TrapType[] trapEdit = {TrapUpgrade.TrapType.MINER_FATIGUE, TrapUpgrade.TrapType.ITS_A_TRAP};
4746
private final BooleanOption renderWhenRelevant = new BooleanOption(ID.getPath() + ".renderWhenRelevant", true);
4847
private final BedwarsMod mod;
49-
private final MinecraftClient mc;
5048
private BedwarsTeamUpgrades upgrades = null;
5149

5250
public TeamUpgradesOverlay(BedwarsMod mod) {
5351
super(60, 40, true);
5452
this.mod = mod;
55-
this.mc = MinecraftClient.getInstance();
5653
}
5754

5855
public void onStart(BedwarsTeamUpgrades newUpgrades) {

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hypixel/levelhead/LevelHead.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class LevelHead implements AbstractHypixelMod {
3333

3434
private static final LevelHead Instance = new LevelHead();
35-
public final BooleanOption enabled = new BooleanOption("enabled", false);
35+
public final BooleanOption enabled = new BooleanOption("enabled", "levelhead.enabled.tooltip", false);
3636
public final BooleanOption background = new BooleanOption("background", false);
3737
public final ColorOption textColor = new ColorOption("textColor", ClientColors.GOLD);
3838
public final EnumOption<LevelHeadMode> mode = new EnumOption<>("levelHeadMode", LevelHeadMode.class, LevelHeadMode.NETWORK);

1.20/src/main/java/io/github/axolotlclient/modules/hud/HudManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public void init() {
114114
add(new MouseMovementHud());
115115
add(new DebugCountersHud());
116116
entries.put(BedwarsMod.getInstance().getUpgradesOverlay().getId(), BedwarsMod.getInstance().getUpgradesOverlay());
117+
entries.put(BedwarsMod.getInstance().getResourceOverlay().getId(), BedwarsMod.getInstance().getResourceOverlay());
117118

118119
entries.values().forEach(HudEntry::init);
119120

1.20/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsMod.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public class BedwarsMod implements AbstractHypixelMod {
6565
BedwarsLevelHeadMode.GAME_KILLS_GAME_DEATHS);
6666
@Getter
6767
protected final TeamUpgradesOverlay upgradesOverlay;
68+
@Getter
69+
protected final ResourceOverlay resourceOverlay;
6870
protected final BooleanOption removeAnnoyingMessages = new BooleanOption(getTranslationKey("removeAnnoyingMessages"), true);
6971
protected final BooleanOption overrideMessages = new BooleanOption(getTranslationKey("overrideMessages"), true);
7072
@Getter
@@ -79,6 +81,7 @@ public class BedwarsMod implements AbstractHypixelMod {
7981

8082
public BedwarsMod() {
8183
upgradesOverlay = new TeamUpgradesOverlay(this);
84+
resourceOverlay = new ResourceOverlay(this);
8285
}
8386

8487

@@ -87,6 +90,7 @@ public void init() {
8790
category.add(enabled, hardcoreHearts, showHunger, displayArmor, bedwarsLevelHead, bedwarsLevelHeadMode,
8891
removeAnnoyingMessages, tabRenderLatencyIcon, showChatTime, overrideMessages);
8992
category.add(upgradesOverlay.getAllOptions());
93+
category.add(resourceOverlay.getAllOptions());
9094
category.add(BedwarsDeathType.getOptions());
9195

9296
instance = this;
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*
2+
* Copyright © 2025 moehreag <[email protected]> & Contributors
3+
*
4+
* This file is part of AxolotlClient.
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*
20+
* For more information, see the LICENSE file.
21+
*/
22+
23+
package io.github.axolotlclient.modules.hypixel.bedwars;
24+
25+
import java.util.List;
26+
import java.util.Map;
27+
import java.util.function.Function;
28+
29+
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
30+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
31+
import io.github.axolotlclient.modules.hud.gui.entry.BoxHudEntry;
32+
import io.github.axolotlclient.modules.hud.util.ItemUtil;
33+
import net.minecraft.client.gui.GuiGraphics;
34+
import net.minecraft.item.Item;
35+
import net.minecraft.item.ItemStack;
36+
import net.minecraft.item.Items;
37+
import net.minecraft.util.Identifier;
38+
39+
public class ResourceOverlay extends BoxHudEntry {
40+
41+
public final static Identifier ID = new Identifier("axolotlclient", "bedwars_resources");
42+
private final BooleanOption renderWhenRelevant = new BooleanOption(ID.getPath() + ".renderWhenRelevant", true);
43+
private static final List<Item> RESOURCES = List.of(Items.IRON_INGOT, Items.GOLD_INGOT, Items.DIAMOND, Items.EMERALD);
44+
private static final Map<Item, Integer> PLACEHOLDER = Map.of(
45+
Items.IRON_INGOT, 3,
46+
Items.GOLD_INGOT, 43,
47+
Items.DIAMOND, 5,
48+
Items.EMERALD, 13
49+
);
50+
private final BedwarsMod mod;
51+
52+
public ResourceOverlay(BedwarsMod mod) {
53+
super(4 * 18 + 1, 18 + 1, true);
54+
this.mod = mod;
55+
}
56+
57+
@Override
58+
public void render(GuiGraphics graphics, float delta) {
59+
if (!renderWhenRelevant.get() || mod.inGame()) {
60+
super.render(graphics, delta);
61+
}
62+
}
63+
64+
@Override
65+
public void renderComponent(GuiGraphics graphics, float delta) {
66+
draw(graphics, s -> ItemUtil.getTotal(client, s));
67+
}
68+
69+
private void draw(GuiGraphics graphics, Function<ItemStack, Integer> countFunction) {
70+
var pos = getPos();
71+
int x = pos.x()+1;
72+
int y = pos.y()+1;
73+
for (Item item : RESOURCES) {
74+
var stack = item.getDefaultStack();
75+
int amount = countFunction.apply(stack);
76+
if (amount > 0) {
77+
graphics.drawItem(stack, x, y);
78+
graphics.drawItemInSlot(client.textRenderer, stack, x, y, String.valueOf(amount));
79+
x += 18;
80+
}
81+
}
82+
}
83+
84+
@Override
85+
public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
86+
draw(graphics, s -> PLACEHOLDER.get(s.getItem()));
87+
}
88+
89+
@Override
90+
public Identifier getId() {
91+
return ID;
92+
}
93+
94+
@Override
95+
public List<Option<?>> getConfigurationOptions() {
96+
List<Option<?>> options = super.getConfigurationOptions();
97+
options.add(renderWhenRelevant);
98+
return options;
99+
}
100+
}

1.20/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/TeamUpgradesOverlay.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.BedwarsTeamUpgrades;
3333
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.TeamUpgrade;
3434
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.TrapUpgrade;
35-
import net.minecraft.client.MinecraftClient;
3635
import net.minecraft.client.gui.GuiGraphics;
3736
import net.minecraft.util.Identifier;
3837

@@ -46,13 +45,11 @@ public class TeamUpgradesOverlay extends BoxHudEntry {
4645
private final static TrapUpgrade.TrapType[] trapEdit = {TrapUpgrade.TrapType.MINER_FATIGUE, TrapUpgrade.TrapType.ITS_A_TRAP};
4746
private final BooleanOption renderWhenRelevant = new BooleanOption(ID.getPath() + ".renderWhenRelevant", true);
4847
private final BedwarsMod mod;
49-
private final MinecraftClient mc;
5048
private BedwarsTeamUpgrades upgrades = null;
5149

5250
public TeamUpgradesOverlay(BedwarsMod mod) {
5351
super(60, 40, true);
5452
this.mod = mod;
55-
this.mc = MinecraftClient.getInstance();
5653
}
5754

5855
public void onStart(BedwarsTeamUpgrades newUpgrades) {

1.20/src/main/java/io/github/axolotlclient/modules/hypixel/levelhead/LevelHead.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class LevelHead implements AbstractHypixelMod {
3333

3434
private static final LevelHead Instance = new LevelHead();
35-
public final BooleanOption enabled = new BooleanOption("enabled", false);
35+
public final BooleanOption enabled = new BooleanOption("enabled", "levelhead.enabled.tooltip", false);
3636
public final BooleanOption background = new BooleanOption("background", false);
3737
public final ColorOption textColor = new ColorOption("textColor", ClientColors.GOLD);
3838
public final EnumOption<LevelHeadMode> mode = new EnumOption<>("levelHeadMode", LevelHeadMode.class, LevelHeadMode.NETWORK);

0 commit comments

Comments
 (0)