From 0050b0216cafa1a1030de878866570c72c647ded Mon Sep 17 00:00:00 2001 From: LambdAurora Date: Wed, 5 Feb 2020 15:39:19 +0100 Subject: [PATCH] :bookmark: LambdaControls v1.1.1: Add more precision in the fly drifting tooltips. --- .../lambdacontrols/LambdaControlsFeature.java | 8 +-- .../client/LambdaControlsConfig.java | 61 +++++++++++-------- fabric/src/main/resources/config.toml | 4 +- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/core/src/main/java/me/lambdaurora/lambdacontrols/LambdaControlsFeature.java b/core/src/main/java/me/lambdaurora/lambdacontrols/LambdaControlsFeature.java index 8cf02ae..e4cd381 100644 --- a/core/src/main/java/me/lambdaurora/lambdacontrols/LambdaControlsFeature.java +++ b/core/src/main/java/me/lambdaurora/lambdacontrols/LambdaControlsFeature.java @@ -26,9 +26,9 @@ import java.util.Optional; */ public class LambdaControlsFeature implements Nameable { - private static final List FEATURES = new ArrayList<>(); - public static final LambdaControlsFeature FRONT_BLOCK_PLACING = new LambdaControlsFeature("front_block_placing", true, false); - public static final LambdaControlsFeature FAST_BLOCK_PLACEMENT = new LambdaControlsFeature("fast_block_placement", true, true); + private static final List FEATURES = new ArrayList<>(); + public static final LambdaControlsFeature FRONT_BLOCK_PLACING = new LambdaControlsFeature("front_block_placing", true, false); + public static final LambdaControlsFeature FAST_BLOCK_INTERACTION = new LambdaControlsFeature("fast_block_interaction", true, true); private final String key; private final boolean defaultAllowed; @@ -156,6 +156,6 @@ public class LambdaControlsFeature implements Nameable static { FEATURES.add(FRONT_BLOCK_PLACING); - FEATURES.add(FAST_BLOCK_PLACEMENT); + FEATURES.add(FAST_BLOCK_INTERACTION); } } diff --git a/fabric/src/main/java/me/lambdaurora/lambdacontrols/client/LambdaControlsConfig.java b/fabric/src/main/java/me/lambdaurora/lambdacontrols/client/LambdaControlsConfig.java index 6d687d7..2c61f18 100644 --- a/fabric/src/main/java/me/lambdaurora/lambdacontrols/client/LambdaControlsConfig.java +++ b/fabric/src/main/java/me/lambdaurora/lambdacontrols/client/LambdaControlsConfig.java @@ -34,22 +34,22 @@ import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y; public class LambdaControlsConfig { // General - private static final ControlsMode DEFAULT_CONTROLS_MODE = ControlsMode.DEFAULT; - private static final boolean DEFAULT_AUTO_SWITCH_MODE = false; + private static final ControlsMode DEFAULT_CONTROLS_MODE = ControlsMode.DEFAULT; + private static final boolean DEFAULT_AUTO_SWITCH_MODE = false; // HUD - private static final boolean DEFAULT_HUD_ENABLE = true; - private static final HudSide DEFAULT_HUD_SIDE = HudSide.LEFT; + private static final boolean DEFAULT_HUD_ENABLE = true; + private static final HudSide DEFAULT_HUD_SIDE = HudSide.LEFT; // Gameplay - private static final boolean DEFAULT_FRONT_BLOCK_PLACING = false; - private static final boolean DEFAULT_FAST_BLOCK_INTERACT = true; - private static final boolean DEFAULT_FLY_DRIFTING = false; - private static final boolean DEFAULT_FLY_VERTICAL_DRIFTING = true; + private static final boolean DEFAULT_FRONT_BLOCK_PLACING = false; + private static final boolean DEFAULT_FAST_BLOCK_INTERACTION = true; + private static final boolean DEFAULT_FLY_DRIFTING = false; + private static final boolean DEFAULT_FLY_VERTICAL_DRIFTING = true; // Controller - private static final ControllerType DEFAULT_CONTROLLER_TYPE = ControllerType.DEFAULT; - private static final double DEFAULT_DEAD_ZONE = 0.25; - private static final double DEFAULT_ROTATION_SPEED = 40.0; - private static final double DEFAULT_MOUSE_SPEED = 25.0; - private static final boolean DEFAULT_UNFOCUSED_INPUT = false; + private static final ControllerType DEFAULT_CONTROLLER_TYPE = ControllerType.DEFAULT; + private static final double DEFAULT_DEAD_ZONE = 0.25; + private static final double DEFAULT_ROTATION_SPEED = 40.0; + private static final double DEFAULT_MOUSE_SPEED = 25.0; + private static final boolean DEFAULT_UNFOCUSED_INPUT = false; private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?"); @@ -85,7 +85,7 @@ public class LambdaControlsConfig this.hudSide = HudSide.byId(this.config.getOrElse("hud.side", DEFAULT_HUD_SIDE.getName())).orElse(DEFAULT_HUD_SIDE); // Gameplay LambdaControlsFeature.FRONT_BLOCK_PLACING.setEnabled(this.config.getOrElse("gameplay.front_block_placing", DEFAULT_FRONT_BLOCK_PLACING)); - LambdaControlsFeature.FAST_BLOCK_INTERACT.setEnabled(this.config.getOrElse("gameplay.fast_block_interact", DEFAULT_FAST_BLOCK_INTERACT)); + LambdaControlsFeature.FAST_BLOCK_INTERACTION.setEnabled(this.config.getOrElse("gameplay.fast_block_interaction", DEFAULT_FAST_BLOCK_INTERACTION)); // Controller settings. this.controllerType = ControllerType.byId(this.config.getOrElse("controller.type", DEFAULT_CONTROLLER_TYPE.getName())).orElse(DEFAULT_CONTROLLER_TYPE); this.deadZone = this.config.getOrElse("controller.dead_zone", DEFAULT_DEAD_ZONE); @@ -134,7 +134,7 @@ public class LambdaControlsConfig this.setHudSide(DEFAULT_HUD_SIDE); // Gameplay this.setFrontBlockPlacing(DEFAULT_FRONT_BLOCK_PLACING); - this.setFastBlockInteract(DEFAULT_FAST_BLOCK_INTERACT); + this.setFastBlockInteraction(DEFAULT_FAST_BLOCK_INTERACTION); this.setFlyDrifting(DEFAULT_FLY_DRIFTING); this.setFlyVerticalDrifting(DEFAULT_FLY_VERTICAL_DRIFTING); // Controller @@ -239,6 +239,27 @@ public class LambdaControlsConfig Gameplay settings */ + /** + * Gets whether fast block interaction is enabled or not. + * + * @return True if fast block interaction is enabled, else false. + */ + public boolean hasFastBlockInteraction() + { + return LambdaControlsFeature.FAST_BLOCK_INTERACTION.isEnabled(); + } + + /** + * Sets whether fast block interaction is enabled or not. + * + * @param enable True if fast block interaction is enabled, else false. + */ + public void setFastBlockInteraction(boolean enable) + { + LambdaControlsFeature.FAST_BLOCK_INTERACTION.setEnabled(enable); + this.config.set("gameplay.fast_block_interaction", enable); + } + /** * Returns whether front block placing is enabled or not. * @@ -260,16 +281,6 @@ public class LambdaControlsConfig this.config.set("gameplay.front_block_placing", enable); } - /** - * Gets whether fast block interaction is enabled or not. - * - * @return True if fast block interaction is enabled, else false. - */ - public boolean hasFastBlockPlacement() - { - return LambdaControlsFeature.FAST_BLOCK_PLACEMENT.isEnabled(); - } - /** * Returns whether fly drifting is enabled or not. * diff --git a/fabric/src/main/resources/config.toml b/fabric/src/main/resources/config.toml index 8885fea..0413f59 100644 --- a/fabric/src/main/resources/config.toml +++ b/fabric/src/main/resources/config.toml @@ -13,10 +13,10 @@ auto_switch_mode = false # Gameplay settings [gameplay] + # Enables fast block interaction like in Bedrock Edition. + fast_block_interaction = true # Enables front block placing like in Bedrock Edition. front_block_placing = false - # Enables fast block interaction like in Bedrock Edition. - fast_block_interact = true # Fly behaviors [gameplay.fly] # Enables fly drifting.