From bd385e7faec5ea2b088aec93fb4635f65c8f7d92 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sun, 19 May 2024 19:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/screens/KillMessageOverlay.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/mcreator/target/client/screens/KillMessageOverlay.java b/src/main/java/net/mcreator/target/client/screens/KillMessageOverlay.java index ee342a14e..106f9af10 100644 --- a/src/main/java/net/mcreator/target/client/screens/KillMessageOverlay.java +++ b/src/main/java/net/mcreator/target/client/screens/KillMessageOverlay.java @@ -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 - ); - } } }