From ffe591aa39921b5b2279c042ec0f6f9a18983560 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Thu, 18 Jul 2024 14:04:55 +0500 Subject: [PATCH] change: reduce communication gui size above scale factor 3 Signed-off-by: Octol1ttle --- .../ru/octol1ttle/knockdowns/client/ClientProxy.java | 2 -- .../knockdowns/client/gui/CommunicationGui.java | 10 +++++++++- .../common/KnockdownsCommonEventListener.java | 4 +--- .../ru/octol1ttle/knockdowns/common/KnockdownsMod.java | 1 - .../octol1ttle/knockdowns/common/KnockdownsUtils.java | 3 +-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/ru/octol1ttle/knockdowns/client/ClientProxy.java b/src/main/java/ru/octol1ttle/knockdowns/client/ClientProxy.java index 80a6603..bd63ce1 100644 --- a/src/main/java/ru/octol1ttle/knockdowns/client/ClientProxy.java +++ b/src/main/java/ru/octol1ttle/knockdowns/client/ClientProxy.java @@ -11,7 +11,6 @@ import ru.octol1ttle.knockdowns.client.communication.KnockedNotificationManager; import ru.octol1ttle.knockdowns.client.event.KnockdownsKeyListener; import ru.octol1ttle.knockdowns.client.util.DirectionalCallSound; import ru.octol1ttle.knockdowns.common.IClientProxy; -import ru.octol1ttle.knockdowns.common.KnockdownsMod; import ru.octol1ttle.knockdowns.common.data.IKnockdownsPlayerData; import ru.octol1ttle.knockdowns.common.network.packets.s2c.PlayerCalloutS2CPacket; import ru.octol1ttle.knockdowns.common.network.packets.s2c.PlayerKnockedDownS2CPacket; @@ -27,7 +26,6 @@ public class ClientProxy implements IClientProxy { @Override public void onFMLInit(FMLInitializationEvent event) { - KnockdownsMod.LOGGER.info("Registering key bindings"); KnockdownsKeyListener.registerKeyBindings(); } diff --git a/src/main/java/ru/octol1ttle/knockdowns/client/gui/CommunicationGui.java b/src/main/java/ru/octol1ttle/knockdowns/client/gui/CommunicationGui.java index ac1920c..f3e71c5 100644 --- a/src/main/java/ru/octol1ttle/knockdowns/client/gui/CommunicationGui.java +++ b/src/main/java/ru/octol1ttle/knockdowns/client/gui/CommunicationGui.java @@ -34,10 +34,16 @@ public class CommunicationGui extends KnockdownsBaseGui { @Override public void render(float partialTicks, ScaledResolution resolution) { + GlStateManager.pushMatrix(); + float scale = 1.0f; + if (resolution.getScaleFactor() > 3) { + scale = (float) 3 / resolution.getScaleFactor(); + GlStateManager.scale(scale, scale, 1.0f); + } FontRenderer font = client.fontRenderer; int x = SCREEN_EDGE_MARGIN; - int y = resolution.getScaledHeight() - SCREEN_EDGE_MARGIN - font.FONT_HEIGHT; + int y = (int) (resolution.getScaledHeight() / scale - SCREEN_EDGE_MARGIN - font.FONT_HEIGHT); KeyBinding[] sortedBindings = new KeyBinding[4]; for (KeyBinding binding : KnockdownsKeyListener.calloutBindings.keySet()) @@ -135,6 +141,8 @@ public class CommunicationGui extends KnockdownsBaseGui { KEY_SIZE ); } + + GlStateManager.popMatrix(); } public void renderCallouts(float partialTicks) { diff --git a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsCommonEventListener.java b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsCommonEventListener.java index 30ad689..d2ec8d0 100644 --- a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsCommonEventListener.java +++ b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsCommonEventListener.java @@ -45,15 +45,14 @@ import static ru.octol1ttle.knockdowns.common.KnockdownsUtils.resetKnockedState; @Mod.EventBusSubscriber(modid = Tags.MOD_ID) public class KnockdownsCommonEventListener { public static void onFMLInit(FMLInitializationEvent event) { - KnockdownsMod.LOGGER.info("Registering network packets"); KnockdownsNetwork.registerPackets(); - KnockdownsMod.LOGGER.info("Registering capability"); KnockdownsCapability.register(); } @SubscribeEvent public static void onSoundsRegister(RegistryEvent.Register event) { event.getRegistry().register(KnockdownsSoundEvents.CALLOUT); + event.getRegistry().register(KnockdownsSoundEvents.KNOCKED_DOWN); } @SubscribeEvent @@ -131,7 +130,6 @@ public class KnockdownsCommonEventListener { } if (data.isKnockedDown() || allPlayersKnocked(player.getServer(), player)) { - data.getRevivers().clear(); return; } diff --git a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsMod.java b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsMod.java index 49e365c..d9e27c0 100644 --- a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsMod.java +++ b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsMod.java @@ -15,7 +15,6 @@ public class KnockdownsMod { @Mod.EventHandler public void onFMLInit(FMLInitializationEvent event) { - LOGGER.info("Initializing"); clientProxy.onFMLInit(event); KnockdownsCommonEventListener.onFMLInit(event); } diff --git a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsUtils.java b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsUtils.java index 4b577f2..65c8d54 100644 --- a/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsUtils.java +++ b/src/main/java/ru/octol1ttle/knockdowns/common/KnockdownsUtils.java @@ -32,12 +32,11 @@ public class KnockdownsUtils { data.setKnockedDown(false); data.setReviveTimeLeft(INITIAL_REVIVE_TIME_LEFT); data.setTicksKnocked(0); + data.getRevivers().clear(); KnockdownsNetwork.sendToTrackingAndSelf( new SynchronizePlayerDataS2CPacket.KnockedDown(player.getEntityId(), data.isKnockedDown()), player ); - - data.getRevivers().clear(); } }