change: reduce communication gui size above scale factor 3

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2024-07-18 14:04:55 +05:00
parent bdec1683c2
commit ffe591aa39
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
5 changed files with 11 additions and 9 deletions

View file

@ -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();
}

View file

@ -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) {

View file

@ -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<SoundEvent> 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;
}

View file

@ -15,7 +15,6 @@ public class KnockdownsMod {
@Mod.EventHandler
public void onFMLInit(FMLInitializationEvent event) {
LOGGER.info("Initializing");
clientProxy.onFMLInit(event);
KnockdownsCommonEventListener.onFMLInit(event);
}

View file

@ -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();
}
}