mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 23:25:10 +01:00
feat: fancy input mode icons
This commit is contained in:
@@ -9,12 +9,20 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols;
|
package eu.midnightdust.midnightcontrols;
|
||||||
|
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.text.object.AtlasTextObjectContents;
|
||||||
|
import net.minecraft.text.object.TextObjectContents;
|
||||||
|
import net.minecraft.util.Atlases;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.TranslatableOption;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.thinkingstudio.obsidianui.util.Nameable;
|
import org.thinkingstudio.obsidianui.util.Nameable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the controls mode.
|
* Represents the controls mode.
|
||||||
*
|
*
|
||||||
@@ -22,10 +30,15 @@ import java.util.Optional;
|
|||||||
* @version 1.7.0
|
* @version 1.7.0
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public enum ControlsMode {
|
public enum ControlsMode implements TranslatableOption {
|
||||||
DEFAULT,
|
DEFAULT("icon/keyboard_mouse"),
|
||||||
CONTROLLER,
|
CONTROLLER("icon/controller"),
|
||||||
TOUCHSCREEN;
|
TOUCHSCREEN("icon/touchscreen");
|
||||||
|
final String emoji;
|
||||||
|
|
||||||
|
ControlsMode(String emoji) {
|
||||||
|
this.emoji = emoji;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next controls mode available.
|
* Returns the next controls mode available.
|
||||||
@@ -39,6 +52,16 @@ public enum ControlsMode {
|
|||||||
return v[this.ordinal() + 1];
|
return v[this.ordinal() + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return this.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Text getText() {
|
||||||
|
return Text.object(new AtlasTextObjectContents(Atlases.GUI, id(emoji))).append(" ").append(Text.translatable(getTranslationKey()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the translation key of this controls mode.
|
* Gets the translation key of this controls mode.
|
||||||
*
|
*
|
||||||
@@ -49,6 +72,7 @@ public enum ControlsMode {
|
|||||||
return "midnightcontrols.controls_mode." + this.getName();
|
return "midnightcontrols.controls_mode." + this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public @NotNull String getName() {
|
public @NotNull String getName() {
|
||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user