Files
MidnightControls/src/main/java/eu/midnightdust/midnightcontrols/client/ring/RingButtonMode.java
Motschen 5fcf4c2b1b MidnightControls 0.1.0 (Beta)
Changes from LambdaControls:
- Support for Steam Deck and Dualsense
- Support for L4, L5, R4, R5 buttons
- Updated Libraries
- New Logo and Name
- Lots of Bugfixes
- MidnightConfig backend
2022-03-12 22:33:19 +01:00

72 lines
1.7 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.client.ring;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import org.aperlambda.lambdacommon.utils.Nameable;
import org.jetbrains.annotations.NotNull;
/**
* Represents the mode of a ring button.
*
* @author LambdAurora
* @version 1.4.0
* @since 1.4.0
*/
public enum RingButtonMode implements Nameable {
PRESS("press"),
HOLD("hold"),
TOGGLE("toggle");
private final String name;
private final Text text;
RingButtonMode(@NotNull String name) {
this.name = name;
this.text = new TranslatableText(this.getTranslationKey());
}
/**
* Returns the next ring button mode available.
*
* @return the next ring button mode
*/
public @NotNull RingButtonMode next() {
var v = values();
if (v.length == this.ordinal() + 1)
return v[0];
return v[this.ordinal() + 1];
}
/**
* Returns the translation key of this ring button mode.
*
* @return the translation key of this ring button mode
*/
public @NotNull String getTranslationKey() {
return "midnightcontrols.ring.button_mode." + this.getName();
}
/**
* Gets the translated name of this ring button mode.
*
* @return the translated name of this ring button mode
*/
public @NotNull Text getTranslatedText() {
return this.text;
}
@Override
public @NotNull String getName() {
return this.name;
}
}