Skip to content

Commit

Permalink
Try to fix out of bounds box position
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatMG393 committed Mar 1, 2024
1 parent 8dfc083 commit d5b0e80
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/thatmg393/usefulhuds/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ public void render(DrawContext context, float tickDelta, CallbackInfo info) {
}

if (config.COORDS.visible) {
int boxPosX = context.getScaledWindowWidth() - config.COORDS.scale;
int boxPosY = context.getScaledWindowHeight() - config.COORDS.scale;
String text = "X: " + client.player.getX()
+ "Y: " + client.player.getY()
+ "Z: " + client.player.getZ();

int boxPosX = config.COORDS.offsetX - config.COORDS.scale + client.textRenderer.getWidth(text) + (config.COORDS.paddingX / 2);
int boxPosY = config.COORDS.offsetY - config.COORDS.scale;

int textPosX = boxPosX + config.COORDS.paddingX; // - client.textRenderer.getWidth(text);
int textPosY = boxPosY + config.COORDS.paddingY; // - client.textRenderer.fontHeight;

DrawUtils.drawBox(
context,
boxPosX, boxPosY,
config.COORDS.scale, config.COORDS.scale,
0xFFFFFF
);

String text = "X: " + client.player.getX()
+ "Y: " + client.player.getY()
+ "Z: " + client.player.getZ();

int textPosX = boxPosX + config.COORDS.paddingX; // - client.textRenderer.getWidth(text);
int textPosY = boxPosY + config.COORDS.paddingY; // - client.textRenderer.fontHeight;

DrawUtils.drawText(
context,
client.textRenderer,
Expand Down

0 comments on commit d5b0e80

Please sign in to comment.