mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
More WIP GUI rework!
This commit is contained in:
@@ -15,5 +15,5 @@ archives_base_name = lambdacontrols
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.32.0+1.16
|
fabric_version=0.32.0+1.16
|
||||||
spruceui_version=2.1.3-1.16
|
spruceui_version=2.1.4-1.16
|
||||||
modmenu_version=1.16.8
|
modmenu_version=1.16.8
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class LambdaControlsConfig {
|
|||||||
private static final boolean DEFAULT_HUD_ENABLE = true;
|
private static final boolean DEFAULT_HUD_ENABLE = true;
|
||||||
private static final HudSide DEFAULT_HUD_SIDE = HudSide.LEFT;
|
private static final HudSide DEFAULT_HUD_SIDE = HudSide.LEFT;
|
||||||
// Gameplay
|
// Gameplay
|
||||||
|
private static final boolean DEFAULT_ANALOG_MOVEMENT = true;
|
||||||
private static final boolean DEFAULT_FAST_BLOCK_INTERACTION = true;
|
private static final boolean DEFAULT_FAST_BLOCK_INTERACTION = true;
|
||||||
private static final boolean DEFAULT_FLY_DRIFTING = false;
|
private static final boolean DEFAULT_FLY_DRIFTING = false;
|
||||||
private static final boolean DEFAULT_FLY_VERTICAL_DRIFTING = true;
|
private static final boolean DEFAULT_FLY_VERTICAL_DRIFTING = true;
|
||||||
@@ -63,6 +64,7 @@ public class LambdaControlsConfig {
|
|||||||
private ControlsMode controlsMode;
|
private ControlsMode controlsMode;
|
||||||
private ControllerType controllerType;
|
private ControllerType controllerType;
|
||||||
// Gameplay.
|
// Gameplay.
|
||||||
|
private boolean analogMovement;
|
||||||
private boolean shouldRenderReacharoundOutline;
|
private boolean shouldRenderReacharoundOutline;
|
||||||
private int[] reacharoundOutlineColor;
|
private int[] reacharoundOutlineColor;
|
||||||
// Controller settings
|
// Controller settings
|
||||||
@@ -92,6 +94,7 @@ public class LambdaControlsConfig {
|
|||||||
this.hudEnable = this.config.getOrElse("hud.enable", DEFAULT_HUD_ENABLE);
|
this.hudEnable = this.config.getOrElse("hud.enable", DEFAULT_HUD_ENABLE);
|
||||||
this.hudSide = HudSide.byId(this.config.getOrElse("hud.side", DEFAULT_HUD_SIDE.getName())).orElse(DEFAULT_HUD_SIDE);
|
this.hudSide = HudSide.byId(this.config.getOrElse("hud.side", DEFAULT_HUD_SIDE.getName())).orElse(DEFAULT_HUD_SIDE);
|
||||||
// Gameplay
|
// Gameplay
|
||||||
|
this.analogMovement = this.config.getOrElse("gameplay.analog_movement", DEFAULT_ANALOG_MOVEMENT);
|
||||||
LambdaControlsFeature.FAST_BLOCK_PLACING.setEnabled(this.config.getOrElse("gameplay.fast_block_placing", DEFAULT_FAST_BLOCK_INTERACTION));
|
LambdaControlsFeature.FAST_BLOCK_PLACING.setEnabled(this.config.getOrElse("gameplay.fast_block_placing", DEFAULT_FAST_BLOCK_INTERACTION));
|
||||||
LambdaControlsFeature.HORIZONTAL_REACHAROUND.setEnabled(this.config.getOrElse("gameplay.reacharound.horizontal", DEFAULT_HORIZONTAL_REACHAROUND));
|
LambdaControlsFeature.HORIZONTAL_REACHAROUND.setEnabled(this.config.getOrElse("gameplay.reacharound.horizontal", DEFAULT_HORIZONTAL_REACHAROUND));
|
||||||
LambdaControlsFeature.VERTICAL_REACHAROUND.setEnabled(this.config.getOrElse("gameplay.reacharound.vertical", DEFAULT_VERTICAL_REACHAROUND));
|
LambdaControlsFeature.VERTICAL_REACHAROUND.setEnabled(this.config.getOrElse("gameplay.reacharound.vertical", DEFAULT_VERTICAL_REACHAROUND));
|
||||||
@@ -170,6 +173,7 @@ public class LambdaControlsConfig {
|
|||||||
this.setAutoSwitchMode(DEFAULT_AUTO_SWITCH_MODE);
|
this.setAutoSwitchMode(DEFAULT_AUTO_SWITCH_MODE);
|
||||||
this.setDebug(DEFAULT_DEBUG);
|
this.setDebug(DEFAULT_DEBUG);
|
||||||
// Gameplay
|
// Gameplay
|
||||||
|
this.setAnalogMovement(DEFAULT_ANALOG_MOVEMENT);
|
||||||
this.setFastBlockPlacing(DEFAULT_FAST_BLOCK_INTERACTION);
|
this.setFastBlockPlacing(DEFAULT_FAST_BLOCK_INTERACTION);
|
||||||
this.setFlyDrifting(DEFAULT_FLY_DRIFTING);
|
this.setFlyDrifting(DEFAULT_FLY_DRIFTING);
|
||||||
this.setFlyVerticalDrifting(DEFAULT_FLY_VERTICAL_DRIFTING);
|
this.setFlyVerticalDrifting(DEFAULT_FLY_VERTICAL_DRIFTING);
|
||||||
@@ -293,6 +297,22 @@ public class LambdaControlsConfig {
|
|||||||
Gameplay settings
|
Gameplay settings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether analog movement is enabled.
|
||||||
|
* @return {@code true} if analog movement is enabled, else {@code false}
|
||||||
|
*/
|
||||||
|
public boolean hasAnalogMovement() {
|
||||||
|
return this.analogMovement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether analog movement is enabled.
|
||||||
|
* @param analogMovement {@code true} if analog movement is enabled, else {@code false}
|
||||||
|
*/
|
||||||
|
public void setAnalogMovement(boolean analogMovement) {
|
||||||
|
this.config.set("gameplay.analog_movement", this.analogMovement = analogMovement);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether fast block placing is enabled or not.
|
* Gets whether fast block placing is enabled or not.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ import static org.lwjgl.glfw.GLFW.*;
|
|||||||
* Represents the LambdaControls' input handler.
|
* Represents the LambdaControls' input handler.
|
||||||
*
|
*
|
||||||
* @author LambdAurora
|
* @author LambdAurora
|
||||||
* @version 1.4.3
|
* @version 1.6.0
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public class LambdaInput {
|
public class LambdaInput {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
package dev.lambdaurora.lambdacontrols.client.controller;
|
package dev.lambdaurora.lambdacontrols.client.controller;
|
||||||
|
|
||||||
import dev.lambdaurora.lambdacontrols.client.ButtonState;
|
import dev.lambdaurora.lambdacontrols.client.ButtonState;
|
||||||
|
import dev.lambdaurora.lambdacontrols.client.LambdaControlsClient;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -18,7 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* Represents the movement handler.
|
* Represents the movement handler.
|
||||||
*
|
*
|
||||||
* @author LambdAurora
|
* @author LambdAurora
|
||||||
* @version 1.4.0
|
* @version 1.6.0
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
*/
|
*/
|
||||||
public final class MovementHandler implements PressAction {
|
public final class MovementHandler implements PressAction {
|
||||||
@@ -67,7 +68,9 @@ public final class MovementHandler implements PressAction {
|
|||||||
|
|
||||||
this.shouldOverrideMovement = direction != 0;
|
this.shouldOverrideMovement = direction != 0;
|
||||||
|
|
||||||
value = (float) Math.pow(value, 2);
|
if (LambdaControlsClient.get().config.hasAnalogMovement()) {
|
||||||
|
value = (float) Math.pow(value, 2);
|
||||||
|
} else value = 1.f;
|
||||||
|
|
||||||
if (button == ButtonBinding.FORWARD || button == ButtonBinding.BACK) {
|
if (button == ButtonBinding.FORWARD || button == ButtonBinding.BACK) {
|
||||||
// Handle forward movement.
|
// Handle forward movement.
|
||||||
|
|||||||
@@ -52,25 +52,26 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
private final SpruceOption mouseSpeedOption;
|
private final SpruceOption mouseSpeedOption;
|
||||||
private final SpruceOption resetOption;
|
private final SpruceOption resetOption;
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
|
private final SpruceOption analogMovementOption;
|
||||||
private final SpruceOption autoJumpOption;
|
private final SpruceOption autoJumpOption;
|
||||||
private final SpruceOption fastBlockPlacingOption;
|
private final SpruceOption fastBlockPlacingOption;
|
||||||
private final SpruceOption frontBlockPlacingOption;
|
private final SpruceOption frontBlockPlacingOption;
|
||||||
private final SpruceOption verticalReacharoundOption;
|
private final SpruceOption verticalReacharoundOption;
|
||||||
private final SpruceOption flyDriftingOption;
|
private final SpruceOption flyDriftingOption;
|
||||||
private final SpruceOption flyVerticalDriftingOption;
|
private final SpruceOption flyVerticalDriftingOption;
|
||||||
|
// Appearance options
|
||||||
|
private final SpruceOption controllerTypeOption;
|
||||||
|
private final SpruceOption virtualMouseSkinOption;
|
||||||
|
private final SpruceOption hudEnableOption;
|
||||||
|
private final SpruceOption hudSideOption;
|
||||||
// Controller options
|
// Controller options
|
||||||
private final SpruceOption controllerOption;
|
private final SpruceOption controllerOption;
|
||||||
private final SpruceOption secondControllerOption;
|
private final SpruceOption secondControllerOption;
|
||||||
private final SpruceOption controllerTypeOption;
|
|
||||||
private final SpruceOption deadZoneOption;
|
private final SpruceOption deadZoneOption;
|
||||||
private final SpruceOption invertsRightXAxis;
|
private final SpruceOption invertsRightXAxis;
|
||||||
private final SpruceOption invertsRightYAxis;
|
private final SpruceOption invertsRightYAxis;
|
||||||
private final SpruceOption unfocusedInputOption;
|
private final SpruceOption unfocusedInputOption;
|
||||||
private final SpruceOption virtualMouseOption;
|
private final SpruceOption virtualMouseOption;
|
||||||
private final SpruceOption virtualMouseSkinOption;
|
|
||||||
// Hud options
|
|
||||||
private final SpruceOption hudEnableOption;
|
|
||||||
private final SpruceOption hudSideOption;
|
|
||||||
private final MutableText controllerMappingsUrlText = new LiteralText("(")
|
private final MutableText controllerMappingsUrlText = new LiteralText("(")
|
||||||
.append(new LiteralText(GAMEPAD_TOOL_URL).formatted(Formatting.GOLD))
|
.append(new LiteralText(GAMEPAD_TOOL_URL).formatted(Formatting.GOLD))
|
||||||
.append("),");
|
.append("),");
|
||||||
@@ -91,8 +92,8 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
}
|
}
|
||||||
}, option -> option.getDisplayText(new TranslatableText(this.mod.config.getControlsMode().getTranslationKey())),
|
}, option -> option.getDisplayText(new TranslatableText(this.mod.config.getControlsMode().getTranslationKey())),
|
||||||
new TranslatableText("lambdacontrols.tooltip.controls_mode"));
|
new TranslatableText("lambdacontrols.tooltip.controls_mode"));
|
||||||
this.autoSwitchModeOption = new SpruceBooleanOption("lambdacontrols.menu.auto_switch_mode", this.mod.config::hasAutoSwitchMode,
|
this.autoSwitchModeOption = new SpruceToggleBooleanOption("lambdacontrols.menu.auto_switch_mode", this.mod.config::hasAutoSwitchMode,
|
||||||
this.mod.config::setAutoSwitchMode, new TranslatableText("lambdacontrols.tooltip.auto_switch_mode"), true);
|
this.mod.config::setAutoSwitchMode, new TranslatableText("lambdacontrols.tooltip.auto_switch_mode"));
|
||||||
this.rotationSpeedOption = new SpruceDoubleOption("lambdacontrols.menu.rotation_speed", 0.0, 100.0, 0.5F, this.mod.config::getRotationSpeed,
|
this.rotationSpeedOption = new SpruceDoubleOption("lambdacontrols.menu.rotation_speed", 0.0, 100.0, 0.5F, this.mod.config::getRotationSpeed,
|
||||||
newValue -> {
|
newValue -> {
|
||||||
synchronized (this.mod.config) {
|
synchronized (this.mod.config) {
|
||||||
@@ -113,6 +114,9 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
});
|
});
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
|
this.analogMovementOption = new SpruceToggleBooleanOption("lambdacontrols.menu.analog_movement",
|
||||||
|
this.mod.config::hasAnalogMovement, this.mod.config::setAnalogMovement,
|
||||||
|
new TranslatableText("lambdacontrols.tooltip.analog_movement"));
|
||||||
this.autoJumpOption = new SpruceToggleBooleanOption("options.autoJump",
|
this.autoJumpOption = new SpruceToggleBooleanOption("options.autoJump",
|
||||||
() -> this.client.options.autoJump,
|
() -> this.client.options.autoJump,
|
||||||
newValue -> this.client.options.autoJump = newValue,
|
newValue -> this.client.options.autoJump = newValue,
|
||||||
@@ -127,6 +131,21 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
this.mod.config::setFlyDrifting, new TranslatableText("lambdacontrols.tooltip.fly_drifting"));
|
this.mod.config::setFlyDrifting, new TranslatableText("lambdacontrols.tooltip.fly_drifting"));
|
||||||
this.flyVerticalDriftingOption = new SpruceToggleBooleanOption("lambdacontrols.menu.fly_drifting_vertical", this.mod.config::hasFlyVerticalDrifting,
|
this.flyVerticalDriftingOption = new SpruceToggleBooleanOption("lambdacontrols.menu.fly_drifting_vertical", this.mod.config::hasFlyVerticalDrifting,
|
||||||
this.mod.config::setFlyVerticalDrifting, new TranslatableText("lambdacontrols.tooltip.fly_drifting_vertical"));
|
this.mod.config::setFlyVerticalDrifting, new TranslatableText("lambdacontrols.tooltip.fly_drifting_vertical"));
|
||||||
|
// Appearance options
|
||||||
|
this.controllerTypeOption = new SpruceCyclingOption("lambdacontrols.menu.controller_type",
|
||||||
|
amount -> this.mod.config.setControllerType(this.mod.config.getControllerType().next()),
|
||||||
|
option -> option.getDisplayText(this.mod.config.getControllerType().getTranslatedText()),
|
||||||
|
new TranslatableText("lambdacontrols.tooltip.controller_type"));
|
||||||
|
this.virtualMouseSkinOption = new SpruceCyclingOption("lambdacontrols.menu.virtual_mouse.skin",
|
||||||
|
amount -> this.mod.config.setVirtualMouseSkin(this.mod.config.getVirtualMouseSkin().next()),
|
||||||
|
option -> option.getDisplayText(this.mod.config.getVirtualMouseSkin().getTranslatedText()),
|
||||||
|
null);
|
||||||
|
this.hudEnableOption = new SpruceToggleBooleanOption("lambdacontrols.menu.hud_enable", this.mod.config::isHudEnabled,
|
||||||
|
this.mod::setHudEnabled, new TranslatableText("lambdacontrols.tooltip.hud_enable"));
|
||||||
|
this.hudSideOption = new SpruceCyclingOption("lambdacontrols.menu.hud_side",
|
||||||
|
amount -> this.mod.config.setHudSide(this.mod.config.getHudSide().next()),
|
||||||
|
option -> option.getDisplayText(this.mod.config.getHudSide().getTranslatedText()),
|
||||||
|
new TranslatableText("lambdacontrols.tooltip.hud_side"));
|
||||||
// Controller options
|
// Controller options
|
||||||
this.controllerOption = new SpruceCyclingOption("lambdacontrols.menu.controller", amount -> {
|
this.controllerOption = new SpruceCyclingOption("lambdacontrols.menu.controller", amount -> {
|
||||||
int id = this.mod.config.getController().getId();
|
int id = this.mod.config.getController().getId();
|
||||||
@@ -160,10 +179,6 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
return option.getDisplayText(new LiteralText(controllerName));
|
return option.getDisplayText(new LiteralText(controllerName));
|
||||||
}).orElse(option.getDisplayText(SpruceTexts.OPTIONS_OFF.shallowCopy().formatted(Formatting.RED))),
|
}).orElse(option.getDisplayText(SpruceTexts.OPTIONS_OFF.shallowCopy().formatted(Formatting.RED))),
|
||||||
new TranslatableText("lambdacontrols.tooltip.controller2"));
|
new TranslatableText("lambdacontrols.tooltip.controller2"));
|
||||||
this.controllerTypeOption = new SpruceCyclingOption("lambdacontrols.menu.controller_type",
|
|
||||||
amount -> this.mod.config.setControllerType(this.mod.config.getControllerType().next()),
|
|
||||||
option -> option.getDisplayText(this.mod.config.getControllerType().getTranslatedText()),
|
|
||||||
new TranslatableText("lambdacontrols.tooltip.controller_type"));
|
|
||||||
this.deadZoneOption = new SpruceDoubleOption("lambdacontrols.menu.dead_zone", 0.05, 1.0, 0.05F, this.mod.config::getDeadZone,
|
this.deadZoneOption = new SpruceDoubleOption("lambdacontrols.menu.dead_zone", 0.05, 1.0, 0.05F, this.mod.config::getDeadZone,
|
||||||
newValue -> {
|
newValue -> {
|
||||||
synchronized (this.mod.config) {
|
synchronized (this.mod.config) {
|
||||||
@@ -173,33 +188,22 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
String value = String.valueOf(option.get());
|
String value = String.valueOf(option.get());
|
||||||
return option.getDisplayText(new LiteralText(value.substring(0, Math.min(value.length(), 5))));
|
return option.getDisplayText(new LiteralText(value.substring(0, Math.min(value.length(), 5))));
|
||||||
}, new TranslatableText("lambdacontrols.tooltip.dead_zone"));
|
}, new TranslatableText("lambdacontrols.tooltip.dead_zone"));
|
||||||
this.invertsRightXAxis = new SpruceBooleanOption("lambdacontrols.menu.invert_right_x_axis", this.mod.config::doesInvertRightXAxis,
|
this.invertsRightXAxis = new SpruceToggleBooleanOption("lambdacontrols.menu.invert_right_x_axis", this.mod.config::doesInvertRightXAxis,
|
||||||
newValue -> {
|
newValue -> {
|
||||||
synchronized (this.mod.config) {
|
synchronized (this.mod.config) {
|
||||||
this.mod.config.setInvertRightXAxis(newValue);
|
this.mod.config.setInvertRightXAxis(newValue);
|
||||||
}
|
}
|
||||||
}, null, true);
|
}, null);
|
||||||
this.invertsRightYAxis = new SpruceBooleanOption("lambdacontrols.menu.invert_right_y_axis", this.mod.config::doesInvertRightYAxis,
|
this.invertsRightYAxis = new SpruceToggleBooleanOption("lambdacontrols.menu.invert_right_y_axis", this.mod.config::doesInvertRightYAxis,
|
||||||
newValue -> {
|
newValue -> {
|
||||||
synchronized (this.mod.config) {
|
synchronized (this.mod.config) {
|
||||||
this.mod.config.setInvertRightYAxis(newValue);
|
this.mod.config.setInvertRightYAxis(newValue);
|
||||||
}
|
}
|
||||||
}, null, true);
|
}, null);
|
||||||
this.unfocusedInputOption = new SpruceBooleanOption("lambdacontrols.menu.unfocused_input", this.mod.config::hasUnfocusedInput,
|
this.unfocusedInputOption = new SpruceToggleBooleanOption("lambdacontrols.menu.unfocused_input", this.mod.config::hasUnfocusedInput,
|
||||||
this.mod.config::setUnfocusedInput, new TranslatableText("lambdacontrols.tooltip.unfocused_input"), true);
|
this.mod.config::setUnfocusedInput, new TranslatableText("lambdacontrols.tooltip.unfocused_input"));
|
||||||
this.virtualMouseOption = new SpruceBooleanOption("lambdacontrols.menu.virtual_mouse", this.mod.config::hasVirtualMouse,
|
this.virtualMouseOption = new SpruceToggleBooleanOption("lambdacontrols.menu.virtual_mouse", this.mod.config::hasVirtualMouse,
|
||||||
this.mod.config::setVirtualMouse, new TranslatableText("lambdacontrols.tooltip.virtual_mouse"), true);
|
this.mod.config::setVirtualMouse, new TranslatableText("lambdacontrols.tooltip.virtual_mouse"));
|
||||||
this.virtualMouseSkinOption = new SpruceCyclingOption("lambdacontrols.menu.virtual_mouse.skin",
|
|
||||||
amount -> this.mod.config.setVirtualMouseSkin(this.mod.config.getVirtualMouseSkin().next()),
|
|
||||||
option -> option.getDisplayText(this.mod.config.getVirtualMouseSkin().getTranslatedText()),
|
|
||||||
null);
|
|
||||||
// HUD options
|
|
||||||
this.hudEnableOption = new SpruceBooleanOption("lambdacontrols.menu.hud_enable", this.mod.config::isHudEnabled,
|
|
||||||
this.mod::setHudEnabled, new TranslatableText("lambdacontrols.tooltip.hud_enable"), true);
|
|
||||||
this.hudSideOption = new SpruceCyclingOption("lambdacontrols.menu.hud_side",
|
|
||||||
amount -> this.mod.config.setHudSide(this.mod.config.getHudSide().next()),
|
|
||||||
option -> option.getDisplayText(this.mod.config.getHudSide().getTranslatedText()),
|
|
||||||
new TranslatableText("lambdacontrols.tooltip.hud_side"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -221,57 +225,6 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
/*int buttonHeight = 20;
|
|
||||||
SpruceButtonWidget controlsModeBtn = new SpruceButtonWidget(Position.of(this.width / 2 - 155, 18), this.hideControls ? 310 : 150, buttonHeight,
|
|
||||||
new TranslatableText("lambdacontrols.menu.controls_mode").append(": ").append(new TranslatableText(this.mod.config.getControlsMode().getTranslationKey())),
|
|
||||||
btn -> {
|
|
||||||
ControlsMode next = this.mod.config.getControlsMode().next();
|
|
||||||
btn.setMessage(new TranslatableText("lambdacontrols.menu.controls_mode").append(": ").append(new TranslatableText(next.getTranslationKey())));
|
|
||||||
this.mod.config.setControlsMode(next);
|
|
||||||
this.mod.config.save();
|
|
||||||
|
|
||||||
if (this.client.player != null) {
|
|
||||||
ClientSidePacketRegistry.INSTANCE.sendToServer(LambdaControls.CONTROLS_MODE_CHANNEL, this.mod.makeControlsModeBuffer(next));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
controlsModeBtn.setTooltip(new TranslatableText("lambdacontrols.tooltip.controls_mode"));
|
|
||||||
this.addChild(controlsModeBtn);
|
|
||||||
if (!this.hideControls)
|
|
||||||
this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, 18, 150, buttonHeight, new TranslatableText("options.controls"),
|
|
||||||
btn -> {
|
|
||||||
if (this.mod.config.getControlsMode() == ControlsMode.CONTROLLER)
|
|
||||||
this.client.openScreen(new ControllerControlsScreen(this, true));
|
|
||||||
else
|
|
||||||
this.client.openScreen(new ControlsOptionsScreen(this, this.client.options));
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.list = new SpruceOptionListWidget(Position.of(this, 0, 43), this.width, this.height - 29 - this.getTextHeight() - 43);
|
|
||||||
// General options
|
|
||||||
this.list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.general", true, null));
|
|
||||||
this.list.addOptionEntry(this.rotationSpeedOption, this.mouseSpeedOption);
|
|
||||||
this.list.addSingleOptionEntry(this.autoSwitchModeOption);
|
|
||||||
// Gameplay options
|
|
||||||
this.list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.gameplay", true, null));
|
|
||||||
//this.list.addOptionEntry(this.autoJumpOption, this.fastBlockPlacingOption);
|
|
||||||
this.list.addOptionEntry(this.frontBlockPlacingOption, this.verticalReacharoundOption);
|
|
||||||
this.list.addSingleOptionEntry(this.flyDriftingOption);
|
|
||||||
this.list.addSingleOptionEntry(this.flyVerticalDriftingOption);
|
|
||||||
//this.list.addOptionEntry(Option.SNEAK_TOGGLED, Option.SPRINT_TOGGLED);
|
|
||||||
// Controller options
|
|
||||||
this.list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.controller", true, null));
|
|
||||||
this.list.addSingleOptionEntry(this.controllerOption);
|
|
||||||
this.list.addSingleOptionEntry(this.secondControllerOption);
|
|
||||||
this.list.addOptionEntry(this.controllerTypeOption, this.deadZoneOption);
|
|
||||||
this.list.addOptionEntry(this.invertsRightXAxis, this.invertsRightYAxis);
|
|
||||||
this.list.addOptionEntry(this.unfocusedInputOption, this.virtualMouseOption);
|
|
||||||
this.list.addSingleOptionEntry(this.virtualMouseSkinOption);
|
|
||||||
this.list.addSingleOptionEntry(ReloadControllerMappingsOption.newOption(null));
|
|
||||||
this.list.addSingleOptionEntry(SpruceSimpleActionOption.of("lambdacontrols.menu.mappings.open_input_str",
|
|
||||||
btn -> this.client.openScreen(new MappingsStringInputScreen(this))));
|
|
||||||
// HUD options
|
|
||||||
this.list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.hud", true, null));
|
|
||||||
this.list.addOptionEntry(this.hudEnableOption, this.hudSideOption);
|
|
||||||
this.addChild(this.list);*/
|
|
||||||
|
|
||||||
this.buildTabs();
|
this.buildTabs();
|
||||||
|
|
||||||
@@ -309,11 +262,15 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
list.addSingleOptionEntry(this.inputModeOption);
|
list.addSingleOptionEntry(this.inputModeOption);
|
||||||
list.addSingleOptionEntry(this.autoSwitchModeOption);
|
list.addSingleOptionEntry(this.autoSwitchModeOption);
|
||||||
|
list.addSingleOptionEntry(this.rotationSpeedOption);
|
||||||
|
list.addSingleOptionEntry(this.mouseSpeedOption);
|
||||||
|
list.addSingleOptionEntry(this.virtualMouseOption);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpruceOptionListWidget buildGameplayTab(int width, int height) {
|
public SpruceOptionListWidget buildGameplayTab(int width, int height) {
|
||||||
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
|
list.addSingleOptionEntry(this.analogMovementOption);
|
||||||
list.addSingleOptionEntry(this.fastBlockPlacingOption);
|
list.addSingleOptionEntry(this.fastBlockPlacingOption);
|
||||||
list.addSingleOptionEntry(this.frontBlockPlacingOption);
|
list.addSingleOptionEntry(this.frontBlockPlacingOption);
|
||||||
list.addSingleOptionEntry(this.verticalReacharoundOption);
|
list.addSingleOptionEntry(this.verticalReacharoundOption);
|
||||||
@@ -326,6 +283,7 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
public SpruceOptionListWidget buildVisualTab(int width, int height) {
|
public SpruceOptionListWidget buildVisualTab(int width, int height) {
|
||||||
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
list.addSingleOptionEntry(this.controllerTypeOption);
|
list.addSingleOptionEntry(this.controllerTypeOption);
|
||||||
|
list.addSingleOptionEntry(this.virtualMouseSkinOption);
|
||||||
list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.hud", true, null));
|
list.addSingleOptionEntry(new SpruceSeparatorOption("lambdacontrols.menu.title.hud", true, null));
|
||||||
list.addSingleOptionEntry(this.hudEnableOption);
|
list.addSingleOptionEntry(this.hudEnableOption);
|
||||||
list.addSingleOptionEntry(this.hudSideOption);
|
list.addSingleOptionEntry(this.hudSideOption);
|
||||||
@@ -364,6 +322,7 @@ public class LambdaControlsSettingsScreen extends SpruceScreen {
|
|||||||
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, listHeight);
|
SpruceOptionListWidget list = new SpruceOptionListWidget(Position.origin(), width, listHeight);
|
||||||
list.addSingleOptionEntry(this.controllerOption);
|
list.addSingleOptionEntry(this.controllerOption);
|
||||||
list.addSingleOptionEntry(this.secondControllerOption);
|
list.addSingleOptionEntry(this.secondControllerOption);
|
||||||
|
list.addSingleOptionEntry(this.unfocusedInputOption);
|
||||||
|
|
||||||
root.addChild(list);
|
root.addChild(list);
|
||||||
root.addChild(labels);
|
root.addChild(labels);
|
||||||
|
|||||||
@@ -223,55 +223,6 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
|
||||||
public void render(MatrixStack matrices, int index, int y, int x, int width, int height, int mouseX, int mouseY, boolean hovering, float delta)
|
|
||||||
{
|
|
||||||
220+32
|
|
||||||
boolean focused = gui.focusedBinding == this.binding;
|
|
||||||
TextRenderer textRenderer = ControlsListWidget.this.client.textRenderer;
|
|
||||||
String bindingName = this.bindingName;
|
|
||||||
float var10002 = (float) (x + 70 - ControlsListWidget.this.field_2733);
|
|
||||||
int var10003 = y + height / 2;
|
|
||||||
textRenderer.draw(matrices, bindingName, var10002, (float) (var10003 - 9 / 2), 16777215);
|
|
||||||
this.resetButton.x = this.unboundButton.x = x + 190;
|
|
||||||
this.resetButton.y = this.unboundButton.y = y;
|
|
||||||
this.resetButton.active = !this.binding.isDefault();
|
|
||||||
if (focused)
|
|
||||||
this.unboundButton.render(matrices, mouseX, mouseY, delta);
|
|
||||||
else
|
|
||||||
this.resetButton.render(matrices, mouseX, mouseY, delta);
|
|
||||||
this.editButton.x = x + 75;
|
|
||||||
this.editButton.y = y;
|
|
||||||
this.editButton.update();
|
|
||||||
|
|
||||||
if (focused) {
|
|
||||||
MutableText text = new LiteralText("> ").formatted(Formatting.WHITE);
|
|
||||||
text.append(this.editButton.getMessage().copy().formatted(Formatting.YELLOW));
|
|
||||||
this.editButton.setMessage(text.append(new LiteralText(" <").formatted(Formatting.WHITE)));
|
|
||||||
} else if (!this.binding.isNotBound() && InputManager.hasDuplicatedBindings(this.binding)) {
|
|
||||||
MutableText text = this.editButton.getMessage().copy();
|
|
||||||
this.editButton.setMessage(text.formatted(Formatting.RED));
|
|
||||||
} else if (this.binding.isNotBound()) {
|
|
||||||
MutableText text = this.editButton.getMessage().copy();
|
|
||||||
this.editButton.setMessage(text.formatted(Formatting.GOLD));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.editButton.render(matrices, mouseX, mouseY, delta);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
|
||||||
boolean focused = gui.focusedBinding == this.binding;
|
|
||||||
if (this.editButton.mouseClicked(mouseX, mouseY, button))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return focused ? this.unboundButton.mouseClicked(mouseX, mouseY, button) : this.resetButton.mouseClicked(mouseX, mouseY, button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
|
||||||
return this.editButton.mouseReleased(mouseX, mouseY, button) || this.resetButton.mouseReleased(mouseX, mouseY, button)
|
|
||||||
|| this.unboundButton.mouseReleased(mouseX, mouseY, button);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* Rendering */
|
/* Rendering */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -311,10 +262,11 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
|
|
||||||
protected CategoryEntry(ControlsListWidget parent, ButtonCategory category) {
|
protected CategoryEntry(ControlsListWidget parent, ButtonCategory category) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.separatorWidget = new SpruceSeparatorWidget(Position.of(this, 0, 0), this.getWidth(), new LiteralText(category.getTranslatedName())) {
|
this.separatorWidget = new SpruceSeparatorWidget(Position.of(this, 2, 0), this.getWidth() - 4,
|
||||||
|
new LiteralText(category.getTranslatedName())) {
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return CategoryEntry.this.getWidth();
|
return CategoryEntry.this.getWidth() - 4;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -362,7 +314,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return this.parent.getRowWidth();
|
return this.parent.getInnerWidth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
"lambdacontrols.controls_mode.touchscreen": "Touchscreen",
|
"lambdacontrols.controls_mode.touchscreen": "Touchscreen",
|
||||||
"lambdacontrols.hud_side.left": "left",
|
"lambdacontrols.hud_side.left": "left",
|
||||||
"lambdacontrols.hud_side.right": "right",
|
"lambdacontrols.hud_side.right": "right",
|
||||||
|
"lambdacontrols.menu.analog_movement": "Analog Movement",
|
||||||
"lambdacontrols.menu.auto_switch_mode": "Auto Switch Mode",
|
"lambdacontrols.menu.auto_switch_mode": "Auto Switch Mode",
|
||||||
"lambdacontrols.menu.controller": "Controller",
|
"lambdacontrols.menu.controller": "Controller",
|
||||||
"lambdacontrols.menu.controller2": "Second Controller",
|
"lambdacontrols.menu.controller2": "Second Controller",
|
||||||
@@ -114,6 +115,7 @@
|
|||||||
"lambdacontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
"lambdacontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
||||||
"lambdacontrols.narrator.unbound": "Unbound %s",
|
"lambdacontrols.narrator.unbound": "Unbound %s",
|
||||||
"lambdacontrols.not_bound": "Not bound",
|
"lambdacontrols.not_bound": "Not bound",
|
||||||
|
"lambdacontrols.tooltip.analog_movement": "Enables analog movement when possible.",
|
||||||
"lambdacontrols.tooltip.auto_switch_mode": "If the controls mode should be switched to Controller automatically if one is connected.",
|
"lambdacontrols.tooltip.auto_switch_mode": "If the controls mode should be switched to Controller automatically if one is connected.",
|
||||||
"lambdacontrols.tooltip.controller2": "Second controller to use, which allows Joy-Cons support for example.",
|
"lambdacontrols.tooltip.controller2": "Second controller to use, which allows Joy-Cons support for example.",
|
||||||
"lambdacontrols.tooltip.controller_type": "The controller type to display the correct buttons.",
|
"lambdacontrols.tooltip.controller_type": "The controller type to display the correct buttons.",
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
"lambdacontrols.controller.connected": "Manette %d connecté.",
|
"lambdacontrols.controller.connected": "Manette %d connecté.",
|
||||||
"lambdacontrols.controller.disconnected": "Manette %d déconnecté.",
|
"lambdacontrols.controller.disconnected": "Manette %d déconnecté.",
|
||||||
"lambdacontrols.controller.mappings.1": "Pour configurer les correspondances de la manette, veuillez utiliser %s",
|
"lambdacontrols.controller.mappings.1": "Pour configurer les correspondances de la manette, veuillez utiliser %s",
|
||||||
"lambdacontrols.controller.mappings.3": "et copier/coller les correspondances dans l'éditeur inclut.",
|
"lambdacontrols.controller.mappings.3": "et copier/coller les correspondances dans l'éditeur de manette.",
|
||||||
"lambdacontrols.controller.mappings.error": "Une erreur est apparue pendant le chargement des manettes.",
|
"lambdacontrols.controller.mappings.error": "Une erreur est apparue pendant le chargement des manettes.",
|
||||||
"lambdacontrols.controller.mappings.error.write": "Une erreur est apparue pendant l'écriture des manettes au fichier.",
|
"lambdacontrols.controller.mappings.error.write": "Une erreur est apparue pendant l'écriture des manettes au fichier.",
|
||||||
"lambdacontrols.controller.mappings.updated": "Configuration des manettes mise à jour!",
|
"lambdacontrols.controller.mappings.updated": "Configuration des manettes mise à jour!",
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
"lambdacontrols.controls_mode.touchscreen": "Tactile",
|
"lambdacontrols.controls_mode.touchscreen": "Tactile",
|
||||||
"lambdacontrols.hud_side.left": "gauche",
|
"lambdacontrols.hud_side.left": "gauche",
|
||||||
"lambdacontrols.hud_side.right": "droit",
|
"lambdacontrols.hud_side.right": "droit",
|
||||||
|
"lambdacontrols.menu.analog_movement": "Mouvement analogique",
|
||||||
"lambdacontrols.menu.auto_switch_mode": "Changement auto de mode",
|
"lambdacontrols.menu.auto_switch_mode": "Changement auto de mode",
|
||||||
"lambdacontrols.menu.controller": "Manette",
|
"lambdacontrols.menu.controller": "Manette",
|
||||||
"lambdacontrols.menu.controller2": "Deuxième manette",
|
"lambdacontrols.menu.controller2": "Deuxième manette",
|
||||||
@@ -106,13 +107,15 @@
|
|||||||
"lambdacontrols.menu.title.controller_controls": "Contrôles de la manette",
|
"lambdacontrols.menu.title.controller_controls": "Contrôles de la manette",
|
||||||
"lambdacontrols.menu.title.gameplay": "Options de Gameplay",
|
"lambdacontrols.menu.title.gameplay": "Options de Gameplay",
|
||||||
"lambdacontrols.menu.title.general": "Options générales",
|
"lambdacontrols.menu.title.general": "Options générales",
|
||||||
|
"lambdacontrols.menu.title.hud": "Options du HUD",
|
||||||
|
"lambdacontrols.menu.title.mappings.string": "Éditeur de manettes",
|
||||||
"lambdacontrols.menu.title.visual": "Options d'apparences",
|
"lambdacontrols.menu.title.visual": "Options d'apparences",
|
||||||
"lambdacontrols.menu.title.mappings.string": "Éditeur du fichier des manettes",
|
|
||||||
"lambdacontrols.menu.unfocused_input": "Entrée en fond",
|
"lambdacontrols.menu.unfocused_input": "Entrée en fond",
|
||||||
"lambdacontrols.menu.virtual_mouse": "Souris virtuelle",
|
"lambdacontrols.menu.virtual_mouse": "Souris virtuelle",
|
||||||
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
||||||
"lambdacontrols.narrator.unbound": "Délier %s",
|
"lambdacontrols.narrator.unbound": "Délier %s",
|
||||||
"lambdacontrols.not_bound": "Non défini",
|
"lambdacontrols.not_bound": "Non défini",
|
||||||
|
"lambdacontrols.tooltip.analog_movement": "Active le mouvement analogique si possible.",
|
||||||
"lambdacontrols.tooltip.auto_switch_mode": "Détermine si le mode de contrôle doit automatiquement changer sur Manette si une manette est connectée et inversement.",
|
"lambdacontrols.tooltip.auto_switch_mode": "Détermine si le mode de contrôle doit automatiquement changer sur Manette si une manette est connectée et inversement.",
|
||||||
"lambdacontrols.tooltip.controller2": "Défini une deuxième manette, utile dans le cas d'utilisation de Joy-Cons.",
|
"lambdacontrols.tooltip.controller2": "Défini une deuxième manette, utile dans le cas d'utilisation de Joy-Cons.",
|
||||||
"lambdacontrols.tooltip.controller_type": "Le type de contrôle n'influe que sur les boutons affichés.",
|
"lambdacontrols.tooltip.controller_type": "Le type de contrôle n'influe que sur les boutons affichés.",
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
"lambdacontrols.controls_mode.touchscreen": "Tactile",
|
"lambdacontrols.controls_mode.touchscreen": "Tactile",
|
||||||
"lambdacontrols.hud_side.left": "gauche",
|
"lambdacontrols.hud_side.left": "gauche",
|
||||||
"lambdacontrols.hud_side.right": "droit",
|
"lambdacontrols.hud_side.right": "droit",
|
||||||
|
"lambdacontrols.menu.analog_movement": "Mouvement analogique",
|
||||||
"lambdacontrols.menu.auto_switch_mode": "Changement auto de mode",
|
"lambdacontrols.menu.auto_switch_mode": "Changement auto de mode",
|
||||||
"lambdacontrols.menu.controller": "Manette",
|
"lambdacontrols.menu.controller": "Manette",
|
||||||
"lambdacontrols.menu.controller2": "Deuxième manette",
|
"lambdacontrols.menu.controller2": "Deuxième manette",
|
||||||
@@ -114,6 +115,7 @@
|
|||||||
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
"lambdacontrols.menu.virtual_mouse.skin": "Apparence souris virtuelle",
|
||||||
"lambdacontrols.narrator.unbound": "Délier %s",
|
"lambdacontrols.narrator.unbound": "Délier %s",
|
||||||
"lambdacontrols.not_bound": "Non défini",
|
"lambdacontrols.not_bound": "Non défini",
|
||||||
|
"lambdacontrols.tooltip.analog_movement": "Active le mouvement analogique si possible.",
|
||||||
"lambdacontrols.tooltip.auto_switch_mode": "Détermine si le mode de contrôle doit automatiquement changer sur Manette si une manette est connectée et inversement.",
|
"lambdacontrols.tooltip.auto_switch_mode": "Détermine si le mode de contrôle doit automatiquement changer sur Manette si une manette est connectée et inversement.",
|
||||||
"lambdacontrols.tooltip.controller2": "Défini une deuxième manette, utile dans le cas d'utilisation de Joy-Cons.",
|
"lambdacontrols.tooltip.controller2": "Défini une deuxième manette, utile dans le cas d'utilisation de Joy-Cons.",
|
||||||
"lambdacontrols.tooltip.controller_type": "Le type de contrôle n'influe que sur les boutons affichés.",
|
"lambdacontrols.tooltip.controller_type": "Le type de contrôle n'influe que sur les boutons affichés.",
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ debug = false
|
|||||||
[gameplay]
|
[gameplay]
|
||||||
# Enables fast block placing like in Bedrock Edition.
|
# Enables fast block placing like in Bedrock Edition.
|
||||||
fast_block_placing = true
|
fast_block_placing = true
|
||||||
|
# Enables analogic movement if possible.
|
||||||
|
analog_movement = true
|
||||||
# Fly behaviors
|
# Fly behaviors
|
||||||
[gameplay.fly]
|
[gameplay.fly]
|
||||||
# Enables fly drifting.
|
# Enables fly drifting.
|
||||||
|
|||||||
Reference in New Issue
Block a user