mirror of
https://github.com/lukasabbe/SimpleTransportHud.git
synced 2026-04-30 10:50:53 +00:00
Fixed boat hud config
This commit is contained in:
@@ -28,6 +28,9 @@ public class Config {
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumElytra = SpeedEnum.kmh;
|
||||
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumBoat = SpeedEnum.kmh;
|
||||
|
||||
@SerialEntry
|
||||
public boolean ignoreSafeArea = false;
|
||||
|
||||
|
||||
@@ -39,6 +39,17 @@ public class ModMenu implements ModMenuApi {
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.boat_hud.name"))
|
||||
.option(Option
|
||||
.<SpeedEnum>createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.elytra_options.option.speed_enum.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_hud.config.category.elytra_options.option.speed_enum.description")))
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumBoat, newVal -> instance.speedEnumBoat = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.build())
|
||||
.save(() -> Config.HANDLER.save())
|
||||
.build().generateScreen(parent);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.tools.BoatTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -45,7 +46,7 @@ public class BoatHud implements SimpleHud {
|
||||
|
||||
//Draw speed
|
||||
int speedTextY = 15;
|
||||
renderCenteredScaledText(graphics, getSpeed(), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
renderCenteredScaledText(graphics, getSpeed(Config.HANDLER.instance().speedEnumBoat), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
|
||||
//Draw coordinates
|
||||
int coordinatesTextY = 25;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.tools.ElytraTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -43,7 +44,7 @@ public class ElytraHud implements SimpleHud {
|
||||
|
||||
//Draw speed
|
||||
int speedTextY = 15;
|
||||
renderCenteredScaledText(graphics, getSpeed(), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
renderCenteredScaledText(graphics, getSpeed(Config.HANDLER.instance().speedEnumElytra), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
|
||||
//Draw coordinates
|
||||
int coordinatesTextY = 25;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.SimpleHudMod;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import com.lukasabbe.simplehud.config.SpeedEnum;
|
||||
import com.lukasabbe.simplehud.tools.ElytraTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -117,8 +118,8 @@ public interface SimpleHud {
|
||||
}
|
||||
}
|
||||
|
||||
default String getSpeed(){
|
||||
return switch (Config.HANDLER.instance().speedEnumElytra){
|
||||
default String getSpeed(SpeedEnum configSpeedEnum){
|
||||
return switch (configSpeedEnum){
|
||||
case kmh -> String.format("%.1f km/h", ElytraTools.getSpeedKmh());
|
||||
case mph -> String.format("%.1f mph", ElytraTools.getSpeedMph());
|
||||
case ms -> String.format("%.1f m/s", ElytraTools.getSpeedMs());
|
||||
|
||||
@@ -11,5 +11,8 @@
|
||||
"simple_hud.config.category.elytra_options.option.speed_enum.description": "You can change the speed unit to what you are used to",
|
||||
"simple_hud.config.speed_enum.kmh": "km/h",
|
||||
"simple_hud.config.speed_enum.mph": "MPH",
|
||||
"simple_hud.config.speed_enum.ms": "m/s"
|
||||
"simple_hud.config.speed_enum.ms": "m/s",
|
||||
"simple_hud.config.category.boat_hud.name": "Boat HUD options",
|
||||
"simple_hud.config.category.general.group.activated_huds.option.boat_hud.name": "Boat HUD",
|
||||
"simple_hud.config.category.general.group.activated_huds.option.boat_hud.description": "Boat Hud toggle, if you don't want to see the an HUD when you boat around."
|
||||
}
|
||||
Reference in New Issue
Block a user