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

Commit d5acde9

Browse files
committed
address suggestions from DarkKronicle
1 parent a5b6cd6 commit d5acde9

File tree

30 files changed

+257
-580
lines changed

30 files changed

+257
-580
lines changed

1.16.5/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -225,33 +225,10 @@ public abstract class PlayerListHudMixin {
225225
if (game == null) {
226226
return;
227227
}
228-
BedwarsPlayer bedwarsPlayer = game.getPlayer(playerEntry.getProfile().getName()).orElse(null);
229-
if (bedwarsPlayer == null) {
230-
return;
231-
}
228+
229+
game.renderCustomScoreboardObjective(matrices, playerEntry.getProfile().getName(), objective, y, endX);
232230
ci.cancel();
233-
String render;
234-
int color;
235-
if (!bedwarsPlayer.isAlive()) {
236-
if (bedwarsPlayer.isDisconnected()) {
237-
return;
238-
}
239-
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - this.client.inGameHud.getTicks());
240-
float secondsTillLive = tickTillLive / 20f;
241-
render = String.format("%.1f", secondsTillLive) + "s";
242-
color = new Color(200, 200, 200).getAsInt();
243-
} else {
244-
int health = objective.getScoreboard().getPlayerScore(player, objective).getScore();
245-
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
246-
render = String.valueOf(health);
247-
}
248-
// Health
249-
this.client.textRenderer.drawWithShadow(matrices,
250-
render,
251-
(float) (endX - this.client.textRenderer.getWidth(render)),
252-
(float) y,
253-
color
254-
);
231+
255232

256233
}
257234

1.16.5/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsGame.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@
2626
import java.util.regex.Matcher;
2727
import java.util.stream.Collectors;
2828

29+
import io.github.axolotlclient.AxolotlClientConfig.Color;
2930
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.BedwarsTeamUpgrades;
3031
import io.github.axolotlclient.util.events.impl.ReceiveChatMessageEvent;
3132
import io.github.axolotlclient.util.events.impl.ScoreboardRenderEvent;
3233
import lombok.Getter;
3334
import net.minecraft.client.MinecraftClient;
3435
import net.minecraft.client.network.AbstractClientPlayerEntity;
3536
import net.minecraft.client.network.PlayerListEntry;
37+
import net.minecraft.client.util.math.MatrixStack;
3638
import net.minecraft.scoreboard.Scoreboard;
39+
import net.minecraft.scoreboard.ScoreboardObjective;
3740
import net.minecraft.scoreboard.ScoreboardPlayerScore;
3841
import net.minecraft.scoreboard.Team;
3942
import net.minecraft.text.LiteralText;
@@ -439,4 +442,32 @@ public String getLevelHead(AbstractClientPlayerEntity entity) {
439442
return mode.apply(stats);
440443
}
441444

445+
public void renderCustomScoreboardObjective(MatrixStack matrices, String playerName, ScoreboardObjective objective, int y, int endX){
446+
BedwarsPlayer bedwarsPlayer = getPlayer(playerName).orElse(null);
447+
if (bedwarsPlayer == null) {
448+
return;
449+
}
450+
String render;
451+
int color;
452+
if (!bedwarsPlayer.isAlive()) {
453+
if (bedwarsPlayer.isDisconnected()) {
454+
return;
455+
}
456+
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - mc.inGameHud.getTicks());
457+
float secondsTillLive = tickTillLive / 20f;
458+
render = String.format("%.1f", secondsTillLive) + "s";
459+
color = new Color(200, 200, 200).getAsInt();
460+
} else {
461+
int health = objective.getScoreboard().getPlayerScore(playerName, objective).getScore();
462+
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
463+
render = String.valueOf(health);
464+
}
465+
// Health
466+
mc.textRenderer.drawWithShadow(matrices,
467+
render,
468+
(float) (endX - mc.textRenderer.getWidth(render)),
469+
(float) y,
470+
color
471+
);
472+
}
442473
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public class BedwarsMod implements AbstractHypixelMod {
5353

5454
private final static Pattern[] GAME_START = {
5555
Pattern.compile("^\\s*?Protect your bed and destroy the enemy beds\\.\\s*?$"),
56-
Pattern.compile("^\\s*?Bed Wars Lucky Blocks\\s*?$"),
57-
Pattern.compile("^\\s*?Bed Wars Swappage\\s*?$")
56+
Pattern.compile("^\\s*?Bed Wars Lucky Blocks\\s*?$")
5857
};
5958

6059
@Getter

1.16.5/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/stats/LobbyStatsHud.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

1.16_combat-6/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -228,34 +228,10 @@ public abstract class PlayerListHudMixin {
228228
if (game == null) {
229229
return;
230230
}
231-
BedwarsPlayer bedwarsPlayer = game.getPlayer(playerEntry.getProfile().getName()).orElse(null);
232-
if (bedwarsPlayer == null) {
233-
return;
234-
}
235-
ci.cancel();
236-
String render;
237-
int color;
238-
if (!bedwarsPlayer.isAlive()) {
239-
if (bedwarsPlayer.isDisconnected()) {
240-
return;
241-
}
242-
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - this.client.inGameHud.getTicks());
243-
float secondsTillLive = tickTillLive / 20f;
244-
render = String.format("%.1f", secondsTillLive) + "s";
245-
color = new Color(200, 200, 200).getAsInt();
246-
} else {
247-
int health = objective.getScoreboard().getPlayerScore(player, objective).getScore();
248-
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
249-
render = String.valueOf(health);
250-
}
251-
// Health
252-
this.client.textRenderer.drawWithShadow(matrices,
253-
render,
254-
(float) (endX - this.client.textRenderer.getWidth(render)),
255-
(float) y,
256-
color
257-
);
258231

232+
game.renderCustomScoreboardObjective(matrices, playerEntry.getProfile().getName(), objective, y, endX);
233+
234+
ci.cancel();
259235
}
260236

261237
@ModifyVariable(

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@
2626
import java.util.regex.Matcher;
2727
import java.util.stream.Collectors;
2828

29+
import io.github.axolotlclient.AxolotlClientConfig.Color;
2930
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.BedwarsTeamUpgrades;
3031
import io.github.axolotlclient.util.events.impl.ReceiveChatMessageEvent;
3132
import io.github.axolotlclient.util.events.impl.ScoreboardRenderEvent;
3233
import lombok.Getter;
3334
import net.minecraft.client.MinecraftClient;
3435
import net.minecraft.client.network.AbstractClientPlayerEntity;
3536
import net.minecraft.client.network.PlayerListEntry;
37+
import net.minecraft.client.util.math.MatrixStack;
3638
import net.minecraft.scoreboard.Scoreboard;
39+
import net.minecraft.scoreboard.ScoreboardObjective;
3740
import net.minecraft.scoreboard.ScoreboardPlayerScore;
3841
import net.minecraft.scoreboard.Team;
3942
import net.minecraft.text.LiteralText;
@@ -439,4 +442,32 @@ public String getLevelHead(AbstractClientPlayerEntity entity) {
439442
return mode.apply(stats);
440443
}
441444

445+
public void renderCustomScoreboardObjective(MatrixStack matrices, String playerName, ScoreboardObjective objective, int y, int endX){
446+
BedwarsPlayer bedwarsPlayer = getPlayer(playerName).orElse(null);
447+
if (bedwarsPlayer == null) {
448+
return;
449+
}
450+
String render;
451+
int color;
452+
if (!bedwarsPlayer.isAlive()) {
453+
if (bedwarsPlayer.isDisconnected()) {
454+
return;
455+
}
456+
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - mc.inGameHud.getTicks());
457+
float secondsTillLive = tickTillLive / 20f;
458+
render = String.format("%.1f", secondsTillLive) + "s";
459+
color = new Color(200, 200, 200).getAsInt();
460+
} else {
461+
int health = objective.getScoreboard().getPlayerScore(playerName, objective).getScore();
462+
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
463+
render = String.valueOf(health);
464+
}
465+
// Health
466+
mc.textRenderer.drawWithShadow(matrices,
467+
render,
468+
(float) (endX - mc.textRenderer.getWidth(render)),
469+
(float) y,
470+
color
471+
);
472+
}
442473
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public class BedwarsMod implements AbstractHypixelMod {
5353

5454
private final static Pattern[] GAME_START = {
5555
Pattern.compile("^\\s*?Protect your bed and destroy the enemy beds\\.\\s*?$"),
56-
Pattern.compile("^\\s*?Bed Wars Lucky Blocks\\s*?$"),
57-
Pattern.compile("^\\s*?Bed Wars Swappage\\s*?$")
56+
Pattern.compile("^\\s*?Bed Wars Lucky Blocks\\s*?$")
5857
};
5958

6059
@Getter

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

Lines changed: 0 additions & 53 deletions
This file was deleted.

1.19.2/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -222,34 +222,10 @@ public abstract class PlayerListHudMixin {
222222
if (game == null) {
223223
return;
224224
}
225-
BedwarsPlayer bedwarsPlayer = game.getPlayer(playerEntry.getProfile().getName()).orElse(null);
226-
if (bedwarsPlayer == null) {
227-
return;
228-
}
229-
ci.cancel();
230-
String render;
231-
int color;
232-
if (!bedwarsPlayer.isAlive()) {
233-
if (bedwarsPlayer.isDisconnected()) {
234-
return;
235-
}
236-
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - this.client.inGameHud.getTicks());
237-
float secondsTillLive = tickTillLive / 20f;
238-
render = String.format("%.1f", secondsTillLive) + "s";
239-
color = new Color(200, 200, 200).getAsInt();
240-
} else {
241-
int health = objective.getScoreboard().getPlayerScore(player, objective).getScore();
242-
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
243-
render = String.valueOf(health);
244-
}
245-
// Health
246-
this.client.textRenderer.drawWithShadow(matrices,
247-
render,
248-
(float) (endX - this.client.textRenderer.getWidth(render)),
249-
(float) y,
250-
color
251-
);
252225

226+
game.renderCustomScoreboardObjective(matrices, playerEntry.getProfile().getName(), objective, y, endX);
227+
228+
ci.cancel();
253229
}
254230

255231
@ModifyVariable(

1.19.2/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsGame.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@
2626
import java.util.regex.Matcher;
2727
import java.util.stream.Collectors;
2828

29+
import io.github.axolotlclient.AxolotlClientConfig.Color;
2930
import io.github.axolotlclient.modules.hypixel.bedwars.upgrades.BedwarsTeamUpgrades;
3031
import io.github.axolotlclient.util.events.impl.ReceiveChatMessageEvent;
3132
import io.github.axolotlclient.util.events.impl.ScoreboardRenderEvent;
3233
import lombok.Getter;
3334
import net.minecraft.client.MinecraftClient;
3435
import net.minecraft.client.network.AbstractClientPlayerEntity;
3536
import net.minecraft.client.network.PlayerListEntry;
37+
import net.minecraft.client.util.math.MatrixStack;
3638
import net.minecraft.scoreboard.Scoreboard;
39+
import net.minecraft.scoreboard.ScoreboardObjective;
3740
import net.minecraft.scoreboard.ScoreboardPlayerScore;
3841
import net.minecraft.scoreboard.Team;
3942
import net.minecraft.text.Text;
@@ -439,4 +442,32 @@ public String getLevelHead(AbstractClientPlayerEntity entity) {
439442
return mode.apply(stats);
440443
}
441444

445+
public void renderCustomScoreboardObjective(MatrixStack matrices, String playerName, ScoreboardObjective objective, int y, int endX) {
446+
BedwarsPlayer bedwarsPlayer = getPlayer(playerName).orElse(null);
447+
if (bedwarsPlayer == null) {
448+
return;
449+
}
450+
String render;
451+
int color;
452+
if (!bedwarsPlayer.isAlive()) {
453+
if (bedwarsPlayer.isDisconnected()) {
454+
return;
455+
}
456+
int tickTillLive = Math.max(0, bedwarsPlayer.getTickAlive() - mc.inGameHud.getTicks());
457+
float secondsTillLive = tickTillLive / 20f;
458+
render = String.format("%.1f", secondsTillLive) + "s";
459+
color = new Color(200, 200, 200).getAsInt();
460+
} else {
461+
int health = objective.getScoreboard().getPlayerScore(playerName, objective).getScore();
462+
color = Color.blend(new Color(255, 255, 255), new Color(215, 0, 64), (int) (1 - (health / 20f) * 100)).getAsInt();
463+
render = String.valueOf(health);
464+
}
465+
// Health
466+
mc.textRenderer.drawWithShadow(matrices,
467+
render,
468+
(float) (endX - mc.textRenderer.getWidth(render)),
469+
(float) y,
470+
color
471+
);
472+
}
442473
}

0 commit comments

Comments
 (0)