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

Commit d565794

Browse files
committed
correct CoordsHud padding
- run RPC actions off-thread
1 parent bac9c98 commit d565794

File tree

7 files changed

+75
-67
lines changed

7 files changed

+75
-67
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ public void renderComponent(MatrixStack matrices, float delta) {
134134
int dir = getDirection(yaw);
135135
String direction = getWordedDirection(dir);
136136
int width, height;
137+
int xStart = pos.x() + 2;
137138
if (minimal.get()) {
138-
int currPos = pos.x() + 1;
139+
int currPos = xStart;
139140
String separator = this.separator.get();
140141
currPos = drawString(matrices, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
141142
currPos = drawString(matrices, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -151,18 +152,18 @@ public void renderComponent(MatrixStack matrices, float delta) {
151152
} else {
152153
int xEnd;
153154
int yEnd = pos.y() + 2;
154-
drawString(matrices, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
155+
drawString(matrices, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
155156
xEnd = drawString(matrices, df.format(x), pos.x() + 11, yEnd,
156157
secondColor.get().toInt(), shadow.get());
157158
yEnd += 10;
158159

159-
drawString(matrices, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
160+
drawString(matrices, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
160161
xEnd = Math.max(xEnd, drawString(matrices, df.format(y), pos.x() + 11, yEnd,
161162
secondColor.get().toInt(), shadow.get()));
162163

163164
yEnd += 10;
164165

165-
drawString(matrices, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
166+
drawString(matrices, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
166167

167168
xEnd = Math.max(xEnd, drawString(matrices, df.format(z), pos.x() + 11, yEnd,
168169
secondColor.get().toInt(), shadow.get()));
@@ -178,13 +179,13 @@ public void renderComponent(MatrixStack matrices, float delta) {
178179
shadow.get());
179180
drawString(matrices, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
180181
shadow.get());
181-
xEnd += 19;
182+
xEnd += 14;
182183
width = xEnd - pos.x();
183184
height = yEnd + 1 - pos.y();
184185
}
185186
if (biome.get() && y >= 0 && y < 256) {
186187
BlockPos b = new BlockPos(x, y, z);
187-
int bX = drawString(matrices, I18n.translate("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
188+
int bX = drawString(matrices, I18n.translate("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
188189
bX += 5;
189190
width = Math.max(width + pos.x() - 1, drawString(matrices, getBiomeName(this.client.world.getRegistryManager().get(Registry.BIOME_KEY).getId(this.client.world.getBiome(b))), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
190191
height += 10;
@@ -263,8 +264,9 @@ public void renderPlaceholderComponent(MatrixStack matrices, float delta) {
263264
int dir = getDirection(yaw);
264265
String direction = getWordedDirection(dir);
265266
int width, height;
267+
int xStart = pos.x() + 2;
266268
if (minimal.get()) {
267-
int currPos = pos.x() + 1;
269+
int currPos = xStart;
268270
String separator = this.separator.get();
269271
currPos = drawString(matrices, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
270272
currPos = drawString(matrices, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -280,18 +282,18 @@ public void renderPlaceholderComponent(MatrixStack matrices, float delta) {
280282
} else {
281283
int xEnd;
282284
int yEnd = pos.y() + 2;
283-
drawString(matrices, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
285+
drawString(matrices, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
284286
xEnd = drawString(matrices, df.format(x), pos.x() + 11, yEnd,
285287
secondColor.get().toInt(), shadow.get());
286288
yEnd += 10;
287289

288-
drawString(matrices, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
290+
drawString(matrices, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
289291
xEnd = Math.max(xEnd, drawString(matrices, df.format(y), pos.x() + 11, yEnd,
290292
secondColor.get().toInt(), shadow.get()));
291293

292294
yEnd += 10;
293295

294-
drawString(matrices, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
296+
drawString(matrices, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
295297

296298
xEnd = Math.max(xEnd, drawString(matrices, df.format(z), pos.x() + 11, yEnd,
297299
secondColor.get().toInt(), shadow.get()));
@@ -307,12 +309,12 @@ public void renderPlaceholderComponent(MatrixStack matrices, float delta) {
307309
shadow.get());
308310
drawString(matrices, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
309311
shadow.get());
310-
xEnd += 19;
312+
xEnd += 14;
311313
width = xEnd - pos.x();
312314
height = yEnd + 1 - pos.y();
313315
}
314316
if (biome.get()) {
315-
int bX = drawString(matrices, I18n.translate("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
317+
int bX = drawString(matrices, I18n.translate("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
316318
bX += 5;
317319
width = Math.max(width + pos.x() - 1, drawString(matrices, getBiomeName(BiomeKeys.PLAINS.getValue()), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
318320
height += 10;

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ public void renderComponent(GuiGraphics graphics, float delta) {
138138
String direction = getWordedDirection(dir);
139139
TextRenderer textRenderer = client.textRenderer;
140140
int width, height;
141+
int xStart = pos.x() + 2;
141142
if (minimal.get()) {
142-
int currPos = pos.x() + 1;
143+
int currPos = xStart;
143144
String separator = this.separator.get();
144145
currPos = graphics.drawText(textRenderer, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
145146
currPos = graphics.drawText(textRenderer, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -155,18 +156,18 @@ public void renderComponent(GuiGraphics graphics, float delta) {
155156
} else {
156157
int xEnd;
157158
int yEnd = pos.y() + 2;
158-
graphics.drawText(textRenderer, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
159+
graphics.drawText(textRenderer, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
159160
xEnd = graphics.drawText(textRenderer, df.format(x), pos.x() + 11, yEnd,
160161
secondColor.get().toInt(), shadow.get());
161162
yEnd += 10;
162163

163-
graphics.drawText(textRenderer, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
164+
graphics.drawText(textRenderer, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
164165
xEnd = Math.max(xEnd, graphics.drawText(textRenderer, df.format(y), pos.x() + 11, yEnd,
165166
secondColor.get().toInt(), shadow.get()));
166167

167168
yEnd += 10;
168169

169-
graphics.drawText(textRenderer, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
170+
graphics.drawText(textRenderer, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
170171

171172
xEnd = Math.max(xEnd, graphics.drawText(textRenderer, df.format(z), pos.x() + 11, yEnd,
172173
secondColor.get().toInt(), shadow.get()));
@@ -182,13 +183,13 @@ public void renderComponent(GuiGraphics graphics, float delta) {
182183
shadow.get());
183184
graphics.drawText(textRenderer, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
184185
shadow.get());
185-
xEnd += 19;
186+
xEnd += 14;
186187
width = xEnd - pos.x();
187188
height = yEnd + 1 - pos.y();
188189
}
189190
if (biome.get() && y >= client.world.getBottomY() && y < client.world.getTopY()) {
190191
BlockPos b = new BlockPos(MathHelper.floor(x), MathHelper.floor(y), MathHelper.floor(z));
191-
int bX = graphics.drawText(textRenderer, I18n.translate("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
192+
int bX = graphics.drawText(textRenderer, I18n.translate("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
192193
bX += 5;
193194
width = Math.max(width + pos.x() - 1, graphics.drawText(textRenderer, getBiomeName(this.client.world.getBiome(b).unwrap().left().orElse(null)), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
194195
height += 10;
@@ -268,8 +269,9 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
268269
String direction = getWordedDirection(dir);
269270
TextRenderer textRenderer = client.textRenderer;
270271
int width, height;
272+
int xStart = pos.x() + 2;
271273
if (minimal.get()) {
272-
int currPos = pos.x() + 1;
274+
int currPos = xStart;
273275
String separator = this.separator.get();
274276
currPos = graphics.drawText(textRenderer, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
275277
currPos = graphics.drawText(textRenderer, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -285,18 +287,18 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
285287
} else {
286288
int xEnd;
287289
int yEnd = pos.y() + 2;
288-
graphics.drawText(textRenderer, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
290+
graphics.drawText(textRenderer, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
289291
xEnd = graphics.drawText(textRenderer, df.format(x), pos.x() + 11, yEnd,
290292
secondColor.get().toInt(), shadow.get());
291293
yEnd += 10;
292294

293-
graphics.drawText(textRenderer, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
295+
graphics.drawText(textRenderer, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
294296
xEnd = Math.max(xEnd, graphics.drawText(textRenderer, df.format(y), pos.x() + 11, yEnd,
295297
secondColor.get().toInt(), shadow.get()));
296298

297299
yEnd += 10;
298300

299-
graphics.drawText(textRenderer, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
301+
graphics.drawText(textRenderer, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
300302

301303
xEnd = Math.max(xEnd, graphics.drawText(textRenderer, df.format(z), pos.x() + 11, yEnd,
302304
secondColor.get().toInt(), shadow.get()));
@@ -312,12 +314,12 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
312314
shadow.get());
313315
graphics.drawText(textRenderer, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
314316
shadow.get());
315-
xEnd += 19;
317+
xEnd += 14;
316318
width = xEnd - pos.x();
317319
height = yEnd + 1 - pos.y();
318320
}
319321
if (biome.get()) {
320-
int bX = graphics.drawText(textRenderer, I18n.translate("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
322+
int bX = graphics.drawText(textRenderer, I18n.translate("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
321323
bX += 5;
322324
width = Math.max(width + pos.x() - 1, graphics.drawText(textRenderer, getBiomeName(Biomes.PLAINS), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
323325
height += 10;

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ public void renderComponent(GuiGraphics graphics, float delta) {
139139
String direction = getWordedDirection(dir);
140140
Font textRenderer = client.font;
141141
int width, height;
142+
int xStart = pos.x() + 2;
142143
if (minimal.get()) {
143-
int currPos = pos.x() + 1;
144+
int currPos = xStart;
144145
String separator = this.separator.get();
145146
currPos = graphics.drawString(textRenderer, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
146147
currPos = graphics.drawString(textRenderer, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -156,18 +157,18 @@ public void renderComponent(GuiGraphics graphics, float delta) {
156157
} else {
157158
int xEnd;
158159
int yEnd = pos.y() + 2;
159-
graphics.drawString(textRenderer, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
160+
graphics.drawString(textRenderer, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
160161
xEnd = graphics.drawString(textRenderer, df.format(x), pos.x() + 11, yEnd,
161162
secondColor.get().toInt(), shadow.get());
162163
yEnd += 10;
163164

164-
graphics.drawString(textRenderer, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
165+
graphics.drawString(textRenderer, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
165166
xEnd = Math.max(xEnd, graphics.drawString(textRenderer, df.format(y), pos.x() + 11, yEnd,
166167
secondColor.get().toInt(), shadow.get()));
167168

168169
yEnd += 10;
169170

170-
graphics.drawString(textRenderer, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
171+
graphics.drawString(textRenderer, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
171172

172173
xEnd = Math.max(xEnd, graphics.drawString(textRenderer, df.format(z), pos.x() + 11, yEnd,
173174
secondColor.get().toInt(), shadow.get()));
@@ -183,13 +184,13 @@ public void renderComponent(GuiGraphics graphics, float delta) {
183184
shadow.get());
184185
graphics.drawString(textRenderer, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
185186
shadow.get());
186-
xEnd += 19;
187+
xEnd += 14;
187188
width = xEnd - pos.x();
188189
height = yEnd + 1 - pos.y();
189190
}
190191
if (biome.get() && y >= client.level.getMinY() && y < client.level.getMaxY()) {
191192
BlockPos b = new BlockPos(Mth.floor(x), Mth.floor(y), Mth.floor(z));
192-
int bX = graphics.drawString(textRenderer, I18n.get("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
193+
int bX = graphics.drawString(textRenderer, I18n.get("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
193194
bX += 5;
194195
width = Math.max(width + pos.x() - 1, graphics.drawString(textRenderer, getBiomeName(this.client.level.getBiome(b).unwrap().left().orElse(null)), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
195196
height += 10;
@@ -269,8 +270,9 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
269270
String direction = getWordedDirection(dir);
270271
Font textRenderer = client.font;
271272
int width, height;
273+
int xStart = pos.x() + 2;
272274
if (minimal.get()) {
273-
int currPos = pos.x() + 1;
275+
int currPos = xStart;
274276
String separator = this.separator.get();
275277
currPos = graphics.drawString(textRenderer, "XYZ" + delimiter.get(), currPos, pos.y() + 2, firstColor.get().toInt(), shadow.get());
276278
currPos = graphics.drawString(textRenderer, df.format(x), currPos, pos.y() + 2, secondColor.get().toInt(),
@@ -286,18 +288,18 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
286288
} else {
287289
int xEnd;
288290
int yEnd = pos.y() + 2;
289-
graphics.drawString(textRenderer, "X", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
291+
graphics.drawString(textRenderer, "X", xStart, yEnd, firstColor.get().toInt(), shadow.get());
290292
xEnd = graphics.drawString(textRenderer, df.format(x), pos.x() + 11, yEnd,
291293
secondColor.get().toInt(), shadow.get());
292294
yEnd += 10;
293295

294-
graphics.drawString(textRenderer, "Y", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
296+
graphics.drawString(textRenderer, "Y", xStart, yEnd, firstColor.get().toInt(), shadow.get());
295297
xEnd = Math.max(xEnd, graphics.drawString(textRenderer, df.format(y), pos.x() + 11, yEnd,
296298
secondColor.get().toInt(), shadow.get()));
297299

298300
yEnd += 10;
299301

300-
graphics.drawString(textRenderer, "Z", pos.x() + 1, yEnd, firstColor.get().toInt(), shadow.get());
302+
graphics.drawString(textRenderer, "Z", xStart, yEnd, firstColor.get().toInt(), shadow.get());
301303

302304
xEnd = Math.max(xEnd, graphics.drawString(textRenderer, df.format(z), pos.x() + 11, yEnd,
303305
secondColor.get().toInt(), shadow.get()));
@@ -313,12 +315,12 @@ public void renderPlaceholderComponent(GuiGraphics graphics, float delta) {
313315
shadow.get());
314316
graphics.drawString(textRenderer, getZDir(dir), xEnd, pos.y() + 22, secondColor.get().toInt(),
315317
shadow.get());
316-
xEnd += 19;
318+
xEnd += 14;
317319
width = xEnd - pos.x();
318320
height = yEnd + 1 - pos.y();
319321
}
320322
if (biome.get()) {
321-
int bX = graphics.drawString(textRenderer, I18n.get("coordshud.biome"), pos.x() + 1, height + pos.y(), firstColor.get().toInt(), shadow.get());
323+
int bX = graphics.drawString(textRenderer, I18n.get("coordshud.biome"), xStart, height + pos.y(), firstColor.get().toInt(), shadow.get());
322324
bX += 5;
323325
width = Math.max(width + pos.x() - 1, graphics.drawString(textRenderer, getBiomeName(Biomes.PLAINS), bX, height + pos.y(), secondColor.get().toInt(), shadow.get())) - pos.x() + 1;
324326
height += 10;

0 commit comments

Comments
 (0)