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

Commit 749ef0d

Browse files
committed
add DebugCountersHud
1 parent 10c69ab commit 749ef0d

File tree

11 files changed

+701
-4
lines changed

11 files changed

+701
-4
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
@@ -118,6 +118,7 @@ public void init() {
118118
add(new ComboHud());
119119
add(new PlayerHud());
120120
add(new MouseMovementHud());
121+
add(new DebugCountersHud());
121122
entries.put(BedwarsMod.getInstance().getUpgradesOverlay().getId(), BedwarsMod.getInstance().getUpgradesOverlay());
122123

123124
entries.values().forEach(HudEntry::init);
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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.hud.gui.hud.vanilla;
24+
25+
import java.util.List;
26+
27+
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
28+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
29+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.EnumOption;
30+
import io.github.axolotlclient.modules.hud.gui.component.DynamicallyPositionable;
31+
import io.github.axolotlclient.modules.hud.gui.entry.TextHudEntry;
32+
import io.github.axolotlclient.modules.hud.gui.layout.AnchorPoint;
33+
import io.github.axolotlclient.modules.hud.util.DrawPosition;
34+
import net.minecraft.client.util.math.MatrixStack;
35+
import net.minecraft.util.Identifier;
36+
37+
public class DebugCountersHud extends TextHudEntry implements DynamicallyPositionable {
38+
public static final Identifier ID = new Identifier("axolotlclient", "debugcountershud");
39+
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
40+
AnchorPoint.TOP_LEFT);
41+
private final BooleanOption showCCount = new BooleanOption("debugcounters.ccount", true);
42+
private final BooleanOption showECount = new BooleanOption("debugcounters.ecount", false);
43+
private final BooleanOption showPCount = new BooleanOption("debugcounters.pcount", false);
44+
45+
public DebugCountersHud() {
46+
super(115, 32, true);
47+
}
48+
49+
@Override
50+
public void renderComponent(MatrixStack graphics, float delta) {
51+
if (client.world == null) {
52+
renderPlaceholderComponent(graphics, delta);
53+
}
54+
DrawPosition pos = getPos();
55+
int lineY = pos.y() + 2;
56+
int lineX = pos.x() + 1;
57+
58+
int xEnd = lineX + 50;
59+
if (showCCount.get()) {
60+
xEnd = Math.max(xEnd, drawString(graphics, client.worldRenderer.getChunksDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
61+
lineY += 10;
62+
}
63+
if (showECount.get()) {
64+
xEnd = Math.max(xEnd, drawString(graphics, client.worldRenderer.getEntitiesDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
65+
lineY += 10;
66+
}
67+
if (showPCount.get()) {
68+
xEnd = Math.max(xEnd, drawString(graphics, "P: " + client.particleManager.getDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
69+
lineY += 10;
70+
}
71+
72+
boolean boundsChanged = false;
73+
if (lineY != getHeight() + pos.y()) {
74+
boundsChanged = true;
75+
setHeight(lineY - pos.y());
76+
}
77+
if (xEnd != pos.x() + getWidth()) {
78+
boundsChanged = true;
79+
setWidth(xEnd - pos.x());
80+
}
81+
if (boundsChanged) {
82+
onBoundsUpdate();
83+
}
84+
}
85+
86+
@Override
87+
public void renderPlaceholderComponent(MatrixStack graphics, float delta) {
88+
DrawPosition pos = getPos();
89+
int lineY = pos.y() + 2;
90+
int lineX = pos.x() + 1;
91+
92+
int xEnd = lineX + 50;
93+
if (showCCount.get()) {
94+
xEnd = Math.max(xEnd, drawString(graphics, "C: 186/15000 (s) D: 10, pC: 000, pU: 00, aB: 20", lineX, lineY, textColor.get().toInt(), shadow.get()));
95+
lineY += 10;
96+
}
97+
if (showECount.get()) {
98+
xEnd = Math.max(xEnd, drawString(graphics, "E: 695/3001, SD: 12", lineX, lineY, textColor.get().toInt(), shadow.get()));
99+
lineY += 10;
100+
}
101+
if (showPCount.get()) {
102+
xEnd = Math.max(xEnd, drawString(graphics, "P: 200", lineX, lineY, textColor.get().toInt(), shadow.get()));
103+
lineY += 10;
104+
}
105+
106+
boolean boundsChanged = false;
107+
if (lineY != getHeight() + pos.y()) {
108+
boundsChanged = true;
109+
setHeight(lineY - pos.y());
110+
}
111+
if (xEnd != pos.x() + getWidth()) {
112+
boundsChanged = true;
113+
setWidth(xEnd - pos.x());
114+
}
115+
if (boundsChanged) {
116+
onBoundsUpdate();
117+
}
118+
}
119+
120+
@Override
121+
public Identifier getId() {
122+
return ID;
123+
}
124+
125+
@Override
126+
public AnchorPoint getAnchor() {
127+
return anchor.get();
128+
}
129+
130+
@Override
131+
public List<Option<?>> getConfigurationOptions() {
132+
List<Option<?>> options = super.getConfigurationOptions();
133+
options.add(anchor);
134+
options.add(showCCount);
135+
options.add(showECount);
136+
options.add(showPCount);
137+
return options;
138+
}
139+
}

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
@@ -112,6 +112,7 @@ public void init() {
112112
add(new ComboHud());
113113
add(new PlayerHud());
114114
add(new MouseMovementHud());
115+
add(new DebugCountersHud());
115116
entries.put(BedwarsMod.getInstance().getUpgradesOverlay().getId(), BedwarsMod.getInstance().getUpgradesOverlay());
116117

117118
entries.values().forEach(HudEntry::init);
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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.hud.gui.hud.vanilla;
24+
25+
import java.util.List;
26+
27+
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
28+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
29+
import io.github.axolotlclient.AxolotlClientConfig.impl.options.EnumOption;
30+
import io.github.axolotlclient.modules.hud.gui.component.DynamicallyPositionable;
31+
import io.github.axolotlclient.modules.hud.gui.entry.TextHudEntry;
32+
import io.github.axolotlclient.modules.hud.gui.layout.AnchorPoint;
33+
import io.github.axolotlclient.modules.hud.util.DrawPosition;
34+
import net.minecraft.client.gui.GuiGraphics;
35+
import net.minecraft.util.Identifier;
36+
37+
public class DebugCountersHud extends TextHudEntry implements DynamicallyPositionable {
38+
public static final Identifier ID = new Identifier("axolotlclient", "debugcountershud");
39+
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
40+
AnchorPoint.TOP_LEFT);
41+
private final BooleanOption showCCount = new BooleanOption("debugcounters.ccount", true);
42+
private final BooleanOption showECount = new BooleanOption("debugcounters.ecount", false);
43+
private final BooleanOption showPCount = new BooleanOption("debugcounters.pcount", false);
44+
45+
public DebugCountersHud() {
46+
super(115, 32, true);
47+
}
48+
49+
@Override
50+
public void renderComponent(GuiGraphics graphics, float delta) {
51+
if (client.world == null) {
52+
renderPlaceholderComponent(graphics, delta);
53+
}
54+
DrawPosition pos = getPos();
55+
int lineY = pos.y() + 2;
56+
int lineX = pos.x() + 1;
57+
58+
int xEnd = lineX + 50;
59+
if (showCCount.get()) {
60+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, client.worldRenderer.getChunksDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
61+
lineY += 10;
62+
}
63+
if (showECount.get()) {
64+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, client.worldRenderer.getEntitiesDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
65+
lineY += 10;
66+
}
67+
if (showPCount.get()) {
68+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, "P: " + client.particleManager.getDebugString(), lineX, lineY, textColor.get().toInt(), shadow.get()));
69+
lineY += 10;
70+
}
71+
72+
boolean boundsChanged = false;
73+
if (lineY != getHeight() + pos.y()) {
74+
boundsChanged = true;
75+
setHeight(lineY - pos.y());
76+
}
77+
if (xEnd != pos.x() + getWidth()) {
78+
boundsChanged = true;
79+
setWidth(xEnd - pos.x());
80+
}
81+
if (boundsChanged) {
82+
onBoundsUpdate();
83+
}
84+
}
85+
86+
@Override
87+
public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
88+
DrawPosition pos = getPos();
89+
int lineY = pos.y() + 2;
90+
int lineX = pos.x() + 1;
91+
92+
int xEnd = lineX + 50;
93+
if (showCCount.get()) {
94+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, "C: 186/15000 (s) D: 10, pC: 000, pU: 00, aB: 20", lineX, lineY, textColor.get().toInt(), shadow.get()));
95+
lineY += 10;
96+
}
97+
if (showECount.get()) {
98+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, "E: 695/3001, SD: 12", lineX, lineY, textColor.get().toInt(), shadow.get()));
99+
lineY += 10;
100+
}
101+
if (showPCount.get()) {
102+
xEnd = Math.max(xEnd, graphics.drawText(client.textRenderer, "P: 200", lineX, lineY, textColor.get().toInt(), shadow.get()));
103+
lineY += 10;
104+
}
105+
106+
boolean boundsChanged = false;
107+
if (lineY != getHeight() + pos.y()) {
108+
boundsChanged = true;
109+
setHeight(lineY - pos.y());
110+
}
111+
if (xEnd != pos.x() + getWidth()) {
112+
boundsChanged = true;
113+
setWidth(xEnd - pos.x());
114+
}
115+
if (boundsChanged) {
116+
onBoundsUpdate();
117+
}
118+
}
119+
120+
@Override
121+
public Identifier getId() {
122+
return ID;
123+
}
124+
125+
@Override
126+
public AnchorPoint getAnchor() {
127+
return anchor.get();
128+
}
129+
130+
@Override
131+
public List<Option<?>> getConfigurationOptions() {
132+
List<Option<?>> options = super.getConfigurationOptions();
133+
options.add(anchor);
134+
options.add(showCCount);
135+
options.add(showECount);
136+
options.add(showPCount);
137+
return options;
138+
}
139+
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040
import io.github.axolotlclient.modules.hud.gui.hud.item.ArrowHud;
4141
import io.github.axolotlclient.modules.hud.gui.hud.item.ItemUpdateHud;
4242
import io.github.axolotlclient.modules.hud.gui.hud.simple.*;
43-
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.ActionBarHud;
44-
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.BossBarHud;
45-
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.CrosshairHud;
46-
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.ScoreboardHud;
43+
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.*;
4744
import io.github.axolotlclient.modules.hud.util.Rectangle;
4845
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
4946
import io.github.axolotlclient.util.GsonHelper;
@@ -115,6 +112,7 @@ public void init() {
115112
add(new ComboHud()); // TODO
116113
add(new PlayerHud());
117114
add(new MouseMovementHud());
115+
add(new DebugCountersHud());
118116
entries.put(BedwarsMod.getInstance().getUpgradesOverlay().getId(), BedwarsMod.getInstance().getUpgradesOverlay());
119117

120118
entries.values().forEach(HudEntry::init);

0 commit comments

Comments
 (0)