From a16aaf981b6c4595ca2b7c9e95d1e4c1d377553a Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 23 Dec 2022 13:09:27 +0000 Subject: [PATCH] Fix disconnect screen scissoring on high-resolution displays (#2770) --- .../mixin/networking/client/DisconnectedScreenMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client/DisconnectedScreenMixin.java b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client/DisconnectedScreenMixin.java index cc770b064..ed1d07e3a 100644 --- a/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client/DisconnectedScreenMixin.java +++ b/fabric-networking-api-v1/src/client/java/net/fabricmc/fabric/mixin/networking/client/DisconnectedScreenMixin.java @@ -27,6 +27,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.font.MultilineText; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; @@ -64,8 +65,7 @@ public abstract class DisconnectedScreenMixin extends Screen { @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/MultilineText;drawCenterWithShadow(Lnet/minecraft/client/util/math/MatrixStack;II)I")) private int render(MultilineText instance, MatrixStack matrixStack, int x, int y) { - double scale = client.getWindow().getScaleFactor(); - RenderSystem.enableScissor(0, (int) (y * scale), (int) (width * scale), (int) (reasonHeight * scale)); + DrawableHelper.enableScissor(0, y, width, y + reasonHeight); instance.drawCenterWithShadow(matrixStack, x, y - scroll); RenderSystem.disableScissor();