mirror of
https://github.com/lukasabbe/SimpleTransportHud.git
synced 2026-04-30 10:50:53 +00:00
Added alot of config options
This commit is contained in:
@@ -12,6 +12,6 @@ public enum HudPosition implements NameableEnum {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return null;
|
||||
return Component.translatable("simple_hud.config.position." + name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,20 @@ public class ModMenu implements ModMenuApi {
|
||||
.name(Component.translatable("simple_hud.config.category.general.name"))
|
||||
.tooltip(Component.translatable("simple_hud.config.category.general.tooltip"))
|
||||
.group(toggleOptions())
|
||||
.option(Option.<Integer>createBuilder()
|
||||
.option(Option
|
||||
.<Integer>createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.general.option.scale.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_hud.config.category.general.option.scale.description")))
|
||||
.binding(10, () -> instance.hudScale, newVal -> instance.hudScale = newVal)
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0,20).step(1))
|
||||
.build())
|
||||
.option(Option
|
||||
.<Boolean>createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.general.option.safe_area.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_hud.config.category.general.option.safe_area.description")))
|
||||
.binding(false, () -> instance.ignoreSafeArea, newVal -> instance.ignoreSafeArea = newVal)
|
||||
.controller(TickBoxControllerBuilder::create)
|
||||
.build())
|
||||
.build()
|
||||
)
|
||||
.category(ConfigCategory
|
||||
@@ -45,6 +53,13 @@ public class ModMenu implements ModMenuApi {
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumElytra, newVal -> instance.speedEnumElytra = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionElytra, newVal -> instance.hudPositionElytra = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
@@ -56,6 +71,13 @@ public class ModMenu implements ModMenuApi {
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumBoat, newVal -> instance.speedEnumBoat = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionBoat, newVal -> instance.hudPositionBoat = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.build())
|
||||
.save(() -> Config.HANDLER.save())
|
||||
.build().generateScreen(parent);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import com.lukasabbe.simplehud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -201,4 +202,9 @@ public class BoatHud implements SimpleHud {
|
||||
public Identifier getIdentifier() {
|
||||
return Constants.BoatHudIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return Config.HANDLER.instance().hudPositionBoat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import com.lukasabbe.simplehud.tools.ElytraTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -148,4 +149,9 @@ public class ElytraHud implements SimpleHud {
|
||||
return Constants.ElytraHudIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return Config.HANDLER.instance().hudPositionElytra;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public class HappyGhastHud extends RideableHud{
|
||||
@@ -7,4 +8,9 @@ public class HappyGhastHud extends RideableHud{
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public class HorseHud extends RideableHud {
|
||||
@@ -7,4 +8,9 @@ public class HorseHud extends RideableHud {
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.Constants;
|
||||
import com.lukasabbe.simplehud.config.Config;
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import com.lukasabbe.simplehud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -134,4 +135,9 @@ public class MinecartHud implements SimpleHud {
|
||||
public Identifier getIdentifier() {
|
||||
return Constants.MinecartHudIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return Config.HANDLER.instance().hudPositionMinecart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public class NautilusHud extends RideableHud {
|
||||
@@ -7,4 +8,9 @@ public class NautilusHud extends RideableHud {
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public interface SimpleHud {
|
||||
void render(GuiGraphics graphics, DeltaTracker tracker);
|
||||
|
||||
Identifier getIdentifier();
|
||||
HudPosition getHudPosition();
|
||||
|
||||
default boolean isHudActivated(){
|
||||
return Config.HANDLER.instance().HudActivatedList.get(getIdentifier().toShortString());
|
||||
@@ -106,7 +107,7 @@ public interface SimpleHud {
|
||||
|
||||
int screenWidth = client.getWindow().getGuiScaledWidth();
|
||||
int screenHeight = client.getWindow().getGuiScaledHeight();
|
||||
int[] pos = calculateHudPosition(screenWidth, screenHeight, Config.HANDLER.instance().hudPositionElytra);
|
||||
int[] pos = calculateHudPosition(screenWidth, screenHeight, getHudPosition());
|
||||
int x = pos[0] - backPlateCenteredX;
|
||||
int y = pos[1] - backPlateCenteredY;
|
||||
return new int[]{x, y};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lukasabbe.simplehud.huds;
|
||||
|
||||
import com.lukasabbe.simplehud.config.HudPosition;
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public class StriderHud extends RideableHud{
|
||||
@@ -7,4 +8,9 @@ public class StriderHud extends RideableHud{
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,20 @@
|
||||
"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.position.center": "Center",
|
||||
"simple_hud.config.position.top_left": "Top Left",
|
||||
"simple_hud.config.position.top_right": "Top Right",
|
||||
"simple_hud.config.position.bottom_left": "Bottom Left",
|
||||
"simple_hud.config.position.bottom_right": "Bottom Right",
|
||||
"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",
|
||||
"simple_hud.config.category.general.option.scale.description": "Change the scale of the HUD",
|
||||
"simple_hud.config.category.general.option.scale.name": "Scale",
|
||||
"simple_hud.config.category.general.group.activated_huds.option.minecart_hud.name": "Minecart HUD",
|
||||
"simple_hud.config.category.general.group.activated_huds.option.minecart_hud.description": "Minecart Hud toggle"
|
||||
"simple_hud.config.category.general.group.activated_huds.option.minecart_hud.description": "Minecart Hud toggle",
|
||||
"simple_hud.config.category.general.option.safe_area.name": "Ignore Safe Area",
|
||||
"simple_hud.config.category.general.option.safe_area.description": "Move HUD to screen edges, ignoring GUI safe area margins",
|
||||
"simple_hud.config.category.elytra_options.option.hud_position.name": "HUD Position",
|
||||
"simple_hud.config.category.elytra_options.option.hud_position.description": "Change the position of the HUD on screen"
|
||||
}
|
||||
Reference in New Issue
Block a user