Files
MidnightControls/src/main/java/eu/midnightdust/midnightcontrols/ControlsMode.java
Motschen 34408d7a2a MidnightControls 1.2.0 - Touchscreen, Modded Keybinds, Bugfixes
- Added #40 (Modded keybind support)
- Added #20 (Touchscreen support)
- Improved #13 (Sodium screen controller support)
- Attempt to fix #31 & #38 (Jittery input on low FPS)
- Fixed #35 (Front placing being broken)
- Fixed #32 (Option to disable double tap to sprint)
- Fixed #27 (Auto-adapt controller icons)
- Fixed #19 (HUD-scaling on big scales)
- Fixed #36 (Crash on game load)
- Fixed reset option
- Fixed scrolling in trading screens
- Disable features that might be considered as cheats (install MidnightControlsExtra to enable)
2022-06-25 21:23:25 +02:00

67 lines
1.6 KiB
Java

/*
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
*
* This file is part of midnightcontrols.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/
package eu.midnightdust.midnightcontrols;
import dev.lambdaurora.spruceui.util.Nameable;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Optional;
/**
* Represents the controls mode.
*
* @author LambdAurora
* @version 1.7.0
* @since 1.0.0
*/
public enum ControlsMode implements Nameable {
DEFAULT,
CONTROLLER,
TOUCHSCREEN;
/**
* Returns the next controls mode available.
*
* @return the next available controls mode
*/
public ControlsMode next() {
var v = values();
if (v.length == this.ordinal() + 1)
return v[0];
return v[this.ordinal() + 1];
}
/**
* Gets the translation key of this controls mode.
*
* @return the translated key of this controls mode
* @since 1.1.0
*/
public String getTranslationKey() {
return "midnightcontrols.controls_mode." + this.getName();
}
@Override
public @NotNull String getName() {
return this.name().toLowerCase();
}
/**
* Gets the controls mode from its identifier.
*
* @param id the identifier of the controls mode
* @return the controls mode if found, else empty
*/
public static Optional<ControlsMode> byId(@NotNull String id) {
return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst();
}
}