From dee1e8a1ad0b73e4c8ccc70218fa1e99c7e4373c Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Mon, 5 May 2025 16:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BB=8E=E4=B8=8B=E8=87=B3?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/overlay/KillMessageOverlay.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java index afb293bfc..cfd4cb9bd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java @@ -78,8 +78,8 @@ public class KillMessageOverlay implements LayeredDraw.Layer { var pos = KillMessageConfig.KILL_MESSAGE_POSITION.get(); int posX = screenWidth; float posY = KillMessageConfig.KILL_MESSAGE_MARGIN_Y.get(); - int count = KillMessageConfig.KILL_MESSAGE_COUNT.get(); boolean left = false; + boolean bottom = false; switch (pos) { case LEFT_TOP -> { @@ -93,12 +93,14 @@ public class KillMessageOverlay implements LayeredDraw.Layer { } case LEFT_BOTTOM -> { posX = KillMessageConfig.KILL_MESSAGE_MARGIN_X.get(); - posY = screenHeight - KillMessageConfig.KILL_MESSAGE_MARGIN_Y.get() - count * 10; + posY = screenHeight - KillMessageConfig.KILL_MESSAGE_MARGIN_Y.get() - 10; left = true; + bottom = true; } case RIGHT_BOTTOM -> { posX = screenWidth - KillMessageConfig.KILL_MESSAGE_MARGIN_X.get(); - posY = screenHeight - KillMessageConfig.KILL_MESSAGE_MARGIN_Y.get() - count * 10; + posY = screenHeight - KillMessageConfig.KILL_MESSAGE_MARGIN_Y.get() - 10; + bottom = true; } } @@ -122,11 +124,11 @@ public class KillMessageOverlay implements LayeredDraw.Layer { } for (PlayerKillRecord r : KillMessageHandler.QUEUE) { - posY = renderKillMessages(r, guiGraphics, deltaTracker.getGameTimeDeltaPartialTick(true), posX, posY, left); + posY = renderKillMessages(r, guiGraphics, deltaTracker.getGameTimeDeltaPartialTick(true), posX, posY, left, bottom); } } - private static float renderKillMessages(PlayerKillRecord record, GuiGraphics guiGraphics, float partialTick, int width, float baseTop, boolean left) { + private static float renderKillMessages(PlayerKillRecord record, GuiGraphics guiGraphics, float partialTick, int width, float baseTop, boolean left, boolean bottom) { float top = baseTop; Font font = Minecraft.getInstance().font; @@ -155,9 +157,9 @@ public class KillMessageOverlay implements LayeredDraw.Layer { float rate = (float) Math.pow((record.tick + partialTick - 80) / animationTickCount, 5); guiGraphics.pose().translate(rate * 100 * (left ? -1 : 1), 0, 0); guiGraphics.setColor(1, 1, 1, 1 - rate); - baseTop += 10 * (1 - rate); + baseTop += 10 * (1 - rate) * (bottom ? -1 : 1); } else { - baseTop += 10; + baseTop += 10 * (bottom ? -1 : 1); } // 击杀提示默认是右对齐的,这里从右向左渲染