修改提示渲染类

This commit is contained in:
17146 2024-05-19 19:09:14 +08:00
parent 739e622465
commit bd385e7fae

View file

@ -50,10 +50,12 @@ public class KillMessageOverlay {
int attackerNameWidth = font.width(attackerName);
int targetNameWidth = font.width(targetName);
int nameW = record.headshot ? w - targetNameWidth - 68 - attackerNameWidth : w - targetNameWidth - 50 - attackerNameWidth;
event.getGuiGraphics().drawString(
Minecraft.getInstance().font,
attackerName,
w - targetNameWidth - 50 - attackerNameWidth,
nameW,
h,
record.attacker.getTeamColor(),
false
@ -62,8 +64,10 @@ public class KillMessageOverlay {
if (record.stack.getItem() instanceof GunItem gunItem) {
ResourceLocation resourceLocation = gunItem.getGunIcon();
int gunIconW = record.headshot ? w - targetNameWidth - 64 : w - targetNameWidth - 46;
event.getGuiGraphics().blit(resourceLocation,
w - targetNameWidth - 46,
gunIconW,
h,
0,
0,
@ -74,6 +78,19 @@ public class KillMessageOverlay {
);
}
if (record.headshot) {
event.getGuiGraphics().blit(HEADSHOT,
w - targetNameWidth - 28,
h - 2,
0,
0,
12,
12,
12,
12
);
}
event.getGuiGraphics().drawString(
Minecraft.getInstance().font,
targetName,
@ -82,18 +99,5 @@ public class KillMessageOverlay {
record.target.getTeamColor(),
false
);
if (record.headshot) {
event.getGuiGraphics().blit(HEADSHOT,
w - targetNameWidth - 65 - attackerNameWidth,
h - 2,
0,
0,
12,
12,
12,
12
);
}
}
}