1
0
forked from Clones/Controlify

Battery level warning + update SDL with macOS ARM support

This commit is contained in:
isXander
2023-05-11 16:43:13 +01:00
parent 0e8bf0cc9b
commit 71c7e26587
19 changed files with 283 additions and 69 deletions

View File

@ -0,0 +1,21 @@
package dev.isxander.controlify.controller;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
public enum BatteryLevel {
EMPTY, LOW, MEDIUM, FULL, MAX,
WIRED, UNKNOWN;
public MutableComponent getFriendlyName() {
return Component.translatable("controlify.battery_level." + name().toLowerCase()).withStyle(
switch (this) {
case EMPTY, LOW -> ChatFormatting.RED;
case MEDIUM -> ChatFormatting.YELLOW;
case FULL, MAX -> ChatFormatting.GREEN;
default -> ChatFormatting.WHITE;
}
);
}
}