From 3283e7da2c6a5b5e487a64b1f88d501e59f8127d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E6=82=A6=E8=A7=A3=E8=AF=B4?= Date: Sun, 9 Jun 2024 12:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Fixed=20bug=20of=20RailwaySignWa?= =?UTF-8?q?llDouble?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tjmetro/render/RenderRailwaySignTianjinDouble.java | 6 +++--- .../ziyue/tjmetro/render/RenderRailwaySignWallDouble.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignTianjinDouble.java b/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignTianjinDouble.java index a6acd44..a49342f 100644 --- a/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignTianjinDouble.java +++ b/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignTianjinDouble.java @@ -220,13 +220,13 @@ public static void drawSign(PoseStack matrices, MultiBufferSource vertexConsumer final float extraMargin = margin - margin / selectedCount; final float height = (size - extraMargin * 2) / selectedCount; for (int i = 0; i < selectedIdsSorted.size(); i++) { - final float topOffset = i * height + extraMargin; - final float bottomOffset = (i + 1) * height + extraMargin; + final float topOffset = i * height + extraMargin + y; + final float bottomOffset = (i + 1) * height + extraMargin + y; final float left = flipCustomText ? x - maxWidthLeft * size : x + margin; final float right = flipCustomText ? x + size - margin : x + (maxWidthRight + 1) * size; RenderTrains.scheduleRender(IRailwaySign.getPlatformSignResource(signId, selectedIdsSorted.get(i), flipCustomText ? HorizontalAlignment.RIGHT : HorizontalAlignment.LEFT, margin / size, (right - left) / (bottomOffset - topOffset), backgroundColor, ARGB_WHITE, backgroundColor, false), true, RenderTrains.QueuedRenderLayer.LIGHT_TRANSLUCENT, (matricesNew, vertexConsumer) -> { storedMatrixTransformations.transform(matricesNew); - IDrawing.drawTexture(matricesNew, vertexConsumer, left, topOffset + y, 0, right, bottomOffset, 0, 0, 0, 1, 1, facing, -1, MAX_LIGHT_GLOWING); + IDrawing.drawTexture(matricesNew, vertexConsumer, left, topOffset, 0, right, bottomOffset, 0, 0, 0, 1, 1, facing, -1, MAX_LIGHT_GLOWING); matricesNew.popPose(); }); } diff --git a/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignWallDouble.java b/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignWallDouble.java index 212bd6b..5ca7401 100644 --- a/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignWallDouble.java +++ b/common/src/main/java/ziyue/tjmetro/render/RenderRailwaySignWallDouble.java @@ -157,7 +157,7 @@ public static void drawSign(PoseStack matrices, MultiBufferSource vertexConsumer RenderTrains.scheduleRender(IRailwaySign.getExitSignResource(signId, selectedExit.substring(0, 1), selectedExit.substring(1), backgroundColor, true), true, RenderTrains.QueuedRenderLayer.LIGHT_TRANSLUCENT, (matricesNew, vertexConsumer) -> { storedMatrixTransformations.transform(matricesNew); - matricesNew.translate(x + margin + (flipCustomText ? signSize : 0), y + margin, 0); + matricesNew.translate(x + margin + (flipCustomText ? signSize : 0), margin, 0); matricesNew.scale(Math.min(1, maxWidth / exitWidth), 1, 1); IDrawing.drawTexture(matricesNew, vertexConsumer, offset, y, signSize, signSize, facing, MAX_LIGHT_GLOWING); matricesNew.popPose(); @@ -220,13 +220,13 @@ public static void drawSign(PoseStack matrices, MultiBufferSource vertexConsumer final float extraMargin = margin - margin / selectedCount; final float height = (size - extraMargin * 2) / selectedCount; for (int i = 0; i < selectedIdsSorted.size(); i++) { - final float topOffset = i * height + extraMargin; - final float bottomOffset = (i + 1) * height + extraMargin; + final float topOffset = i * height + extraMargin + y; + final float bottomOffset = (i + 1) * height + extraMargin + y; final float left = flipCustomText ? x - maxWidthLeft * size : x + margin; final float right = flipCustomText ? x + size - margin : x + (maxWidthRight + 1) * size; RenderTrains.scheduleRender(IRailwaySign.getPlatformSignResource(signId, selectedIdsSorted.get(i), flipCustomText ? HorizontalAlignment.RIGHT : HorizontalAlignment.LEFT, margin / size, (right - left) / (bottomOffset - topOffset), backgroundColor, ARGB_WHITE, backgroundColor, true), true, RenderTrains.QueuedRenderLayer.LIGHT_TRANSLUCENT, (matricesNew, vertexConsumer) -> { storedMatrixTransformations.transform(matricesNew); - IDrawing.drawTexture(matricesNew, vertexConsumer, left, topOffset + y, 0, right, bottomOffset, 0, 0, 0, 1, 1, facing, -1, MAX_LIGHT_GLOWING); + IDrawing.drawTexture(matricesNew, vertexConsumer, left, topOffset, 0, right, bottomOffset, 0, 0, 0, 1, 1, facing, -1, MAX_LIGHT_GLOWING); matricesNew.popPose(); }); }