From 1a0030a6801bfcaf33db8988b254a326928a36bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen/=E3=81=82=E3=81=91=E3=81=BF?= Date: Tue, 3 May 2022 04:53:45 -0700 Subject: [PATCH 1/3] Added an option to always show the HUD while in Controller Mode, matching the legacy behaviour of LambdaControls. This option is enabled by default so that users migrating from LambdaControls will have a consistent experience. --- .../client/MidnightControlsConfig.java | 1 + .../client/gui/MidnightControlsHud.java | 14 ++++++++------ .../client/gui/MidnightControlsSettingsScreen.java | 4 ++++ .../assets/midnightcontrols/lang/en_us.json | 2 ++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java index b823509..3b7b83b 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java @@ -35,6 +35,7 @@ public class MidnightControlsConfig extends MidnightConfig { @Entry public static boolean debug = false; // HUD @Entry public static boolean hudEnable = true; + @Entry public static boolean hudAlwaysShow = true; // Enabled by default so that users migrating from LambdaControls will have a consistent experience. @Entry public static HudSide hudSide = HudSide.LEFT; // Gameplay @Entry public static boolean analogMovement = true; diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java index 1153ee2..a596c3b 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java @@ -78,12 +78,14 @@ public class MidnightControlsHud extends Hud { */ @Override public void render(MatrixStack matrices, float tickDelta) { - if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null && MidnightControlsConfig.getController().isConnected() && MidnightControlsConfig.getController().isGamepad()) { - int y = bottom(2); - this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y); - this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y); - this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y); - this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y); + if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) { + if (MidnightControlsConfig.hudAlwaysShow || (MidnightControlsConfig.getController().isConnected() && MidnightControlsConfig.getController().isGamepad())) { + int y = bottom(2); + this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y); + this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y); + this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y); + this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y); + } } if (this.mod.reacharound.isLastReacharoundVertical()) { diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java index 4e3ab21..7fff583 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java @@ -72,6 +72,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen { private final SpruceOption controllerTypeOption; private final SpruceOption virtualMouseSkinOption; private final SpruceOption hudEnableOption; + private final SpruceOption hudAlwaysShowOption; private final SpruceOption hudSideOption; // Controller options private final SpruceOption controllerOption = @@ -212,6 +213,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen { null); this.hudEnableOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_enable", () -> MidnightControlsConfig.hudEnable, this.mod::setHudEnabled, new TranslatableText("midnightcontrols.tooltip.hud_enable")); + this.hudAlwaysShowOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_always_show", () -> MidnightControlsConfig.hudAlwaysShow, + value -> MidnightControlsConfig.hudAlwaysShow = value, new TranslatableText("midnightcontrols.tooltip.hud_always_show")); this.hudSideOption = new SpruceCyclingOption("midnightcontrols.menu.hud_side", amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(), option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()), @@ -320,6 +323,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen { list.addSingleOptionEntry(this.virtualMouseSkinOption); list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null)); list.addSingleOptionEntry(this.hudEnableOption); + list.addSingleOptionEntry(this.hudAlwaysShowOption); list.addSingleOptionEntry(this.hudSideOption); return list; } diff --git a/src/main/resources/assets/midnightcontrols/lang/en_us.json b/src/main/resources/assets/midnightcontrols/lang/en_us.json index 5ccbb06..dba1ccb 100644 --- a/src/main/resources/assets/midnightcontrols/lang/en_us.json +++ b/src/main/resources/assets/midnightcontrols/lang/en_us.json @@ -96,6 +96,7 @@ "midnightcontrols.menu.fly_drifting": "Fly Drifting", "midnightcontrols.menu.fly_drifting_vertical": "Vertical Fly Drifting", "midnightcontrols.menu.hud_enable": "Enable HUD", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "HUD Side", "midnightcontrols.menu.invert_right_x_axis": "Invert Right X", "midnightcontrols.menu.invert_right_y_axis": "Invert Right Y", @@ -136,6 +137,7 @@ "midnightcontrols.tooltip.fly_drifting": "While flying, enables Vanilla drifting/inertia.", "midnightcontrols.tooltip.fly_drifting_vertical": "While flying, enables Vanilla vertical drifting/intertia.", "midnightcontrols.tooltip.hud_enable": "Toggles the on-screen controller button indicator.", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "The position of the HUD.", "midnightcontrols.tooltip.left_dead_zone": "The dead zone for the controller's left analogue stick.", "midnightcontrols.tooltip.max_left_x_value": "Changes what the mod considers the highest value for the left X axis. Useful if your axis does not use the full range and seems slow.", From b6563af2b16159c0bad57f7eebd05df905be89f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen/=E3=81=82=E3=81=91=E3=81=BF?= Date: Tue, 3 May 2022 04:54:07 -0700 Subject: [PATCH 2/3] hud_always_show: Add untranslated strings to es_mx, fr_ca, fr_ft, tr_tr, and zh_cn. --- src/main/resources/assets/midnightcontrols/lang/es_mx.json | 2 ++ src/main/resources/assets/midnightcontrols/lang/fr_ca.json | 2 ++ src/main/resources/assets/midnightcontrols/lang/fr_fr.json | 2 ++ src/main/resources/assets/midnightcontrols/lang/tr_tr.json | 2 ++ src/main/resources/assets/midnightcontrols/lang/zh_cn.json | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/main/resources/assets/midnightcontrols/lang/es_mx.json b/src/main/resources/assets/midnightcontrols/lang/es_mx.json index f61731a..c799cf0 100644 --- a/src/main/resources/assets/midnightcontrols/lang/es_mx.json +++ b/src/main/resources/assets/midnightcontrols/lang/es_mx.json @@ -89,6 +89,7 @@ "midnightcontrols.menu.fly_drifting": "Volar a la deriva", "midnightcontrols.menu.fly_drifting_vertical": "Volar a la deriva vertical", "midnightcontrols.menu.hud_enable": "Habilitar HUD", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "Lado de HUD", "midnightcontrols.menu.invert_right_x_axis": "Invertir derecha X", "midnightcontrols.menu.invert_right_y_axis": "Invertir derecha Y", @@ -129,6 +130,7 @@ "midnightcontrols.tooltip.fly_drifting": "Mientras vuela, habilita la deriva/inercia de vainilla.", "midnightcontrols.tooltip.fly_drifting_vertical": "Mientras vuela, habilita la deriva/inercia vertical de vainilla.", "midnightcontrols.tooltip.hud_enable": "Alterna el indicador del botón del controlador en pantalla.", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "La posición del HUD.", "midnightcontrols.tooltip.left_dead_zone": "La zona muerta de la palanca analógica izquierda del controlador.", "midnightcontrols.tooltip.max_left_x_value": "Cambia lo que el mod considera el valor más alto para el eje X izquierdo. Útil si su eje no usa el rango completo y parece lento.", diff --git a/src/main/resources/assets/midnightcontrols/lang/fr_ca.json b/src/main/resources/assets/midnightcontrols/lang/fr_ca.json index d8129ad..18d1e5f 100644 --- a/src/main/resources/assets/midnightcontrols/lang/fr_ca.json +++ b/src/main/resources/assets/midnightcontrols/lang/fr_ca.json @@ -89,6 +89,7 @@ "midnightcontrols.menu.fly_drifting": "Inertie de vol", "midnightcontrols.menu.fly_drifting_vertical": "Inertie verticale de vol", "midnightcontrols.menu.hud_enable": "Activer le HUD", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "Côté du HUD", "midnightcontrols.menu.invert_right_x_axis": "Inverser le stick droit (X)", "midnightcontrols.menu.invert_right_y_axis": "Inverser le stick droit (Y)", @@ -129,6 +130,7 @@ "midnightcontrols.tooltip.fly_drifting": "Pendant que le joueur vole, active le glissement Vanilla.", "midnightcontrols.tooltip.fly_drifting_vertical": "Pendant que le joueur vole, active le glissement vertical Vanilla.", "midnightcontrols.tooltip.hud_enable": "Détermine si l'indicateur des buttons de la manette doit être affiché ou non.", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "Change la position du HUD.", "midnightcontrols.tooltip.left_dead_zone": "Zone morte de l'axe gauche de la manette.", "midnightcontrols.tooltip.max_left_x_value": "Change ce que le mod considère comme valeur maximale pour l'axe X gauche. Utile si votre axe n'utilise pas l'entièreté de l'ensemble des valeurs et paraît lent.", diff --git a/src/main/resources/assets/midnightcontrols/lang/fr_fr.json b/src/main/resources/assets/midnightcontrols/lang/fr_fr.json index d8129ad..18d1e5f 100644 --- a/src/main/resources/assets/midnightcontrols/lang/fr_fr.json +++ b/src/main/resources/assets/midnightcontrols/lang/fr_fr.json @@ -89,6 +89,7 @@ "midnightcontrols.menu.fly_drifting": "Inertie de vol", "midnightcontrols.menu.fly_drifting_vertical": "Inertie verticale de vol", "midnightcontrols.menu.hud_enable": "Activer le HUD", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "Côté du HUD", "midnightcontrols.menu.invert_right_x_axis": "Inverser le stick droit (X)", "midnightcontrols.menu.invert_right_y_axis": "Inverser le stick droit (Y)", @@ -129,6 +130,7 @@ "midnightcontrols.tooltip.fly_drifting": "Pendant que le joueur vole, active le glissement Vanilla.", "midnightcontrols.tooltip.fly_drifting_vertical": "Pendant que le joueur vole, active le glissement vertical Vanilla.", "midnightcontrols.tooltip.hud_enable": "Détermine si l'indicateur des buttons de la manette doit être affiché ou non.", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "Change la position du HUD.", "midnightcontrols.tooltip.left_dead_zone": "Zone morte de l'axe gauche de la manette.", "midnightcontrols.tooltip.max_left_x_value": "Change ce que le mod considère comme valeur maximale pour l'axe X gauche. Utile si votre axe n'utilise pas l'entièreté de l'ensemble des valeurs et paraît lent.", diff --git a/src/main/resources/assets/midnightcontrols/lang/tr_tr.json b/src/main/resources/assets/midnightcontrols/lang/tr_tr.json index 0a7c2cc..f433df6 100644 --- a/src/main/resources/assets/midnightcontrols/lang/tr_tr.json +++ b/src/main/resources/assets/midnightcontrols/lang/tr_tr.json @@ -89,6 +89,7 @@ "midnightcontrols.menu.fly_drifting": "Kayarak Uç", "midnightcontrols.menu.fly_drifting_vertical": "Dikey uçuşta kayaaak git", "midnightcontrols.menu.hud_enable": "HUD'u Etkinleştir", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "HUD Yanı", "midnightcontrols.menu.invert_right_x_axis": "Sağ X'i Terse Çevir", "midnightcontrols.menu.invert_right_y_axis": "Sağ Y'i Terse Çevir.", @@ -120,6 +121,7 @@ "midnightcontrols.tooltip.fly_drifting": "Uçarken, Vanilla'daki gibi ani duruşlarda kayma efektini etkinleştirir.", "midnightcontrols.tooltip.fly_drifting_vertical": "Yukarı/aşağı uçarken, Vanilla'daki gibi ani duruşlarda kayma efektini etkinleştirir.", "midnightcontrols.tooltip.hud_enable": "Ekranın üstünde oyun kolu tuşu göstergesini açar/kapatır.", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "HUD'un konumu", "midnightcontrols.tooltip.mouse_speed": "Oyun kolunun taklit edilen fare hızı.", "midnightcontrols.tooltip.reacharound.horizontal": "Hızlı blok koymayı etkinleştirir. §cBazı sunucular bunun hile olduğunu düşünebilir.§r.", diff --git a/src/main/resources/assets/midnightcontrols/lang/zh_cn.json b/src/main/resources/assets/midnightcontrols/lang/zh_cn.json index c04a639..b62556c 100644 --- a/src/main/resources/assets/midnightcontrols/lang/zh_cn.json +++ b/src/main/resources/assets/midnightcontrols/lang/zh_cn.json @@ -89,6 +89,7 @@ "midnightcontrols.menu.fly_drifting": "水平方向飞行惯性", "midnightcontrols.menu.fly_drifting_vertical": "垂直方向飞行惯性", "midnightcontrols.menu.hud_enable": "启用HUD", + "midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode", "midnightcontrols.menu.hud_side": "HUD位置", "midnightcontrols.menu.invert_right_x_axis": "反转右摇杆X轴", "midnightcontrols.menu.invert_right_y_axis": "反转右摇杆Y轴", @@ -129,6 +130,7 @@ "midnightcontrols.tooltip.fly_drifting": "处于飞行状态时,启用原版的水平方向飞行惯性(缓停滑行)。", "midnightcontrols.tooltip.fly_drifting_vertical": "处于飞行状态时,启用原版的垂直方向飞行惯性(缓停滑行)。", "midnightcontrols.tooltip.hud_enable": "显示手柄按键操作提示。", + "midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.", "midnightcontrols.tooltip.hud_side": "HUD的位置位于画面的哪一侧。", "midnightcontrols.tooltip.left_dead_zone": "左摇杆配置的死区。\n死区决定摇杆要偏离中心位置多远才能让摇杆的输入有效。", "midnightcontrols.tooltip.max_left_x_value": "更改左摇杆X轴最大值的识别范围。\n若感觉即便推满摇杆也未达到最大的输入值,导致在识别摇杆输入的精确值的情况下,左右移动较为缓慢等问题,本项可能会有所帮助。", From c31fb76215e8c7aff42889f66a479ee37a770cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen/=E3=81=82=E3=81=91=E3=81=BF?= Date: Tue, 3 May 2022 05:02:23 -0700 Subject: [PATCH 3/3] MidnightControlsConfig: Changed some default settings to be "safe" in the sense that the features that can be considered "cheating" in multiplayer servers are now disabled by default. --- .../client/MidnightControlsConfig.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java index 3b7b83b..bd68566 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java @@ -39,11 +39,11 @@ public class MidnightControlsConfig extends MidnightConfig { @Entry public static HudSide hudSide = HudSide.LEFT; // Gameplay @Entry public static boolean analogMovement = true; - @Entry public static boolean fastBlockPlacing = true; - @Entry public static boolean flyDrifting = false; - @Entry public static boolean verticalFlyDrifting = true; - @Entry public static boolean horizontalReacharound = false; - @Entry public static boolean verticalReacharound = false; + @Entry public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers. + @Entry public static boolean flyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. It can also conflict with some other mods. + @Entry public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. + @Entry public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers. + @Entry public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers. @Entry public static boolean shouldRenderReacharoundOutline = true; @Entry public static int[] reacharoundOutlineColor = new int[]{255, 255, 255, 102}; // Controller