Merge pull request #15 from akemin-dayo/1.18

Added an option to always show the HUD while in Controller Mode, matching the legacy behaviour of LambdaControls. Also 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.
This commit is contained in:
Martin Prokoph
2022-05-03 17:23:45 +02:00
committed by GitHub
9 changed files with 30 additions and 11 deletions

View File

@@ -35,14 +35,15 @@ 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;
@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

View File

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

View File

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

View File

@@ -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.",

View File

@@ -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.",

View File

@@ -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.",

View File

@@ -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.",

View File

@@ -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.",

View File

@@ -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若感觉即便推满摇杆也未达到最大的输入值导致在识别摇杆输入的精确值的情况下左右移动较为缓慢等问题本项可能会有所帮助。",