mirror of
https://github.com/lukasabbe/SimpleTransportHud.git
synced 2026-04-30 10:50:53 +00:00
1.0
This commit is contained in:
@@ -13,8 +13,12 @@ Transports included:
|
||||
|
||||
Examples:
|
||||
- Elytra 
|
||||
- Boat 
|
||||
- Minecart 
|
||||
- Boat 
|
||||
- Minecart 
|
||||
- Horse 
|
||||
- Happy Ghast 
|
||||
- Nautilus 
|
||||
- Strider 
|
||||
|
||||
# Looking for a server?
|
||||
Get BisectHosting and save 25% off for new customers using code Lukas at checkout.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
minecraft_version=1.21.11
|
||||
loader_version=0.18.4
|
||||
# Mod Properties
|
||||
mod_version=0.2+1.21.11
|
||||
mod_version=1.0+1.21.11
|
||||
versionType=beta
|
||||
maven_group=com.lukasabbe
|
||||
archives_base_name=SimpleTransportHud
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -14,6 +14,9 @@ public class Constants {
|
||||
public final static Identifier BoatHudIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "boat_hud");
|
||||
public final static Identifier MinecartHudIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "minecart_hud");
|
||||
public final static Identifier HorseHudIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "horse_hud");
|
||||
public final static Identifier HappyGhastIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "happy_ghast_hud");
|
||||
public final static Identifier NautilusHudIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "nautilus_hud");
|
||||
public final static Identifier StriderHudIdentifier = Identifier.fromNamespaceAndPath(MOD_ID, "strider_hud");
|
||||
|
||||
public final static List<Identifier> HudIdentifiers = Arrays.asList(ElytraHudIdentifier, BoatHudIdentifier, MinecartHudIdentifier, HorseHudIdentifier);
|
||||
public final static List<Identifier> HudIdentifiers = Arrays.asList(ElytraHudIdentifier, BoatHudIdentifier, MinecartHudIdentifier, HorseHudIdentifier, HappyGhastIdentifier, NautilusHudIdentifier, StriderHudIdentifier);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ public class SimpleTransportHudMod implements ClientModInitializer {
|
||||
new ElytraHud(),
|
||||
new BoatHud(),
|
||||
new MinecartHud(),
|
||||
new HorseHud()
|
||||
new HorseHud(),
|
||||
new HappyGhastHud(),
|
||||
new NautilusHud(),
|
||||
new StriderHud()
|
||||
);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,12 @@ public class Config {
|
||||
public HudPosition hudPositionMinecart = HudPosition.CENTER;
|
||||
@SerialEntry
|
||||
public HudPosition hudPositionHorse = HudPosition.CENTER;
|
||||
@SerialEntry
|
||||
public HudPosition hudPositionHappyGhast = HudPosition.CENTER;
|
||||
@SerialEntry
|
||||
public HudPosition hudPositionNautilus = HudPosition.CENTER;
|
||||
@SerialEntry
|
||||
public HudPosition hudPositionStrider = HudPosition.CENTER;
|
||||
|
||||
|
||||
//Hud speed unit
|
||||
@@ -50,6 +56,13 @@ public class Config {
|
||||
public SpeedEnum speedEnumMinecart = SpeedEnum.kmh;
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumHorse = SpeedEnum.kmh;
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumHappyGhast = SpeedEnum.kmh;
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumNautilus = SpeedEnum.kmh;
|
||||
@SerialEntry
|
||||
public SpeedEnum speedEnumStrider = SpeedEnum.kmh;
|
||||
|
||||
|
||||
//Display speed
|
||||
@SerialEntry
|
||||
@@ -60,6 +73,12 @@ public class Config {
|
||||
public int minecartHudDelay = 0;
|
||||
@SerialEntry
|
||||
public int horseHudDelay = 0;
|
||||
@SerialEntry
|
||||
public int happyGhastHudDelay = 0;
|
||||
@SerialEntry
|
||||
public int nautilusHudDelay = 0;
|
||||
@SerialEntry
|
||||
public int striderHudDelay = 0;
|
||||
|
||||
private Map<String, Boolean> getActiveHuds() {
|
||||
Map<String, Boolean> activatedHuds = new IdentityHashMap<>();
|
||||
|
||||
@@ -117,6 +117,106 @@ public class ModMenu implements ModMenuApi {
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 30).step(1))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.minecart_hud.name"))
|
||||
.option(Option
|
||||
.<SpeedEnum>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.description")))
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumMinecart, newVal -> instance.speedEnumMinecart = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionMinecart, newVal -> instance.hudPositionMinecart = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<Integer>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.description")))
|
||||
.binding(0, () -> instance.minecartHudDelay, newVal -> instance.minecartHudDelay = newVal)
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 30).step(1))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.horse_hud.name"))
|
||||
.option(Option
|
||||
.<SpeedEnum>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.description")))
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumHorse, newVal -> instance.speedEnumHorse = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionHorse, newVal -> instance.hudPositionHorse = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<Integer>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.description")))
|
||||
.binding(0, () -> instance.horseHudDelay, newVal -> instance.horseHudDelay = newVal)
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 30).step(1))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.happy_ghast_hud.name"))
|
||||
.option(Option
|
||||
.<SpeedEnum>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.description")))
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumHappyGhast, newVal -> instance.speedEnumHappyGhast = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionHappyGhast, newVal -> instance.hudPositionHappyGhast = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<Integer>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.description")))
|
||||
.binding(0, () -> instance.happyGhastHudDelay, newVal -> instance.happyGhastHudDelay = newVal)
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 30).step(1))
|
||||
.build())
|
||||
.build())
|
||||
.category(ConfigCategory
|
||||
.createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.strider.name"))
|
||||
.option(Option
|
||||
.<SpeedEnum>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.speed_enum.description")))
|
||||
.binding(SpeedEnum.kmh, () -> instance.speedEnumStrider, newVal -> instance.speedEnumStrider = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, SpeedEnum.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<HudPosition>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.hud_position.description")))
|
||||
.binding(HudPosition.CENTER, () -> instance.hudPositionStrider, newVal -> instance.hudPositionStrider = newVal)
|
||||
.customController(opt -> new EnumController<>(opt, HudPosition.class))
|
||||
.build())
|
||||
.option(Option
|
||||
.<Integer>createBuilder()
|
||||
.name(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.name"))
|
||||
.description(OptionDescription.of(Component.translatable("simple_transport_hud.config.category.elytra_options.option.delay_hud.description")))
|
||||
.binding(0, () -> instance.striderHudDelay, newVal -> instance.striderHudDelay = newVal)
|
||||
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 30).step(1))
|
||||
.build())
|
||||
.build())
|
||||
.save(() -> Config.HANDLER.save())
|
||||
.build().generateScreen(parent);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,40 @@
|
||||
package com.lukasabbe.simpletransporthud.huds;
|
||||
|
||||
import com.lukasabbe.simpletransporthud.Constants;
|
||||
import com.lukasabbe.simpletransporthud.config.Config;
|
||||
import com.lukasabbe.simpletransporthud.config.HudPosition;
|
||||
import com.lukasabbe.simpletransporthud.config.SpeedEnum;
|
||||
import com.lukasabbe.simpletransporthud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.animal.happyghast.HappyGhast;
|
||||
|
||||
public class HappyGhastHud extends RideableHud{
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, DeltaTracker tracker) {
|
||||
if(!EntityTools.isRidingEntity(HappyGhast.class)) return;
|
||||
super.render(graphics, tracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedEnum getSpeedEnum() {
|
||||
return Config.HANDLER.instance().speedEnumHappyGhast;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelay() {
|
||||
return Config.HANDLER.instance().happyGhastHudDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
return Constants.HappyGhastIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
return Config.HANDLER.instance().hudPositionHappyGhast;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.lukasabbe.simpletransporthud.huds;
|
||||
import com.lukasabbe.simpletransporthud.Constants;
|
||||
import com.lukasabbe.simpletransporthud.config.Config;
|
||||
import com.lukasabbe.simpletransporthud.config.HudPosition;
|
||||
import com.lukasabbe.simpletransporthud.config.SpeedEnum;
|
||||
import com.lukasabbe.simpletransporthud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -17,6 +18,16 @@ public class HorseHud extends RideableHud {
|
||||
super.render(graphics, tracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedEnum getSpeedEnum() {
|
||||
return Config.HANDLER.instance().speedEnumHorse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelay() {
|
||||
return Config.HANDLER.instance().horseHudDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getIdentifier() {
|
||||
return Constants.HorseHudIdentifier;
|
||||
|
||||
@@ -1,16 +1,40 @@
|
||||
package com.lukasabbe.simpletransporthud.huds;
|
||||
|
||||
import com.lukasabbe.simpletransporthud.Constants;
|
||||
import com.lukasabbe.simpletransporthud.config.Config;
|
||||
import com.lukasabbe.simpletransporthud.config.HudPosition;
|
||||
import com.lukasabbe.simpletransporthud.config.SpeedEnum;
|
||||
import com.lukasabbe.simpletransporthud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.animal.nautilus.AbstractNautilus;
|
||||
|
||||
public class NautilusHud extends RideableHud {
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, DeltaTracker tracker) {
|
||||
if(!EntityTools.isRidingEntity(AbstractNautilus.class)) return;
|
||||
super.render(graphics, tracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedEnum getSpeedEnum() {
|
||||
return Config.HANDLER.instance().speedEnumNautilus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelay() {
|
||||
return Config.HANDLER.instance().nautilusHudDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
return Constants.NautilusHudIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
return Config.HANDLER.instance().hudPositionNautilus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.lukasabbe.simpletransporthud.huds;
|
||||
|
||||
import com.lukasabbe.simpletransporthud.config.Config;
|
||||
import com.lukasabbe.simpletransporthud.config.SpeedEnum;
|
||||
import com.lukasabbe.simpletransporthud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -13,7 +13,7 @@ public abstract class RideableHud implements SimpleHud {
|
||||
if(!isHudActivated()) return;
|
||||
if(client.noRender) return;
|
||||
if(client.player == null) return;
|
||||
if(EntityTools.getTime() < Config.HANDLER.instance().boatHudDelay) return;
|
||||
if(EntityTools.getTime() < getDelay()) return;
|
||||
int[] pos = getCornerPos();
|
||||
int x = pos[0];
|
||||
int y = pos[1];
|
||||
@@ -26,7 +26,7 @@ public abstract class RideableHud implements SimpleHud {
|
||||
|
||||
//Draw speed
|
||||
int speedTextY = 5;
|
||||
renderCenteredScaledText(graphics, getSpeed(Config.HANDLER.instance().speedEnumBoat), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
renderCenteredScaledText(graphics, getSpeed(getSpeedEnum()), x + textX, y + speedTextY, whiteColor, textScale);
|
||||
|
||||
//Draw coordinates
|
||||
int coordinatesTextY = 15;
|
||||
@@ -185,4 +185,7 @@ public abstract class RideableHud implements SimpleHud {
|
||||
|
||||
drawLine(graphics, centerX, centerY, endX, endY, (int) radius, compass_pointer);
|
||||
}
|
||||
|
||||
public abstract SpeedEnum getSpeedEnum();
|
||||
public abstract int getDelay();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
package com.lukasabbe.simpletransporthud.huds;
|
||||
|
||||
import com.lukasabbe.simpletransporthud.Constants;
|
||||
import com.lukasabbe.simpletransporthud.config.Config;
|
||||
import com.lukasabbe.simpletransporthud.config.HudPosition;
|
||||
import com.lukasabbe.simpletransporthud.config.SpeedEnum;
|
||||
import com.lukasabbe.simpletransporthud.tools.EntityTools;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.entity.monster.Strider;
|
||||
|
||||
public class StriderHud extends RideableHud{
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, DeltaTracker tracker) {
|
||||
if(!EntityTools.isRidingEntity(Strider.class)) return;
|
||||
super.render(graphics, tracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getIdentifier() {
|
||||
return null;
|
||||
return Constants.StriderHudIdentifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HudPosition getHudPosition() {
|
||||
return null;
|
||||
return Config.HANDLER.instance().hudPositionStrider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpeedEnum getSpeedEnum() {
|
||||
return Config.HANDLER.instance().speedEnumStrider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDelay() {
|
||||
return Config.HANDLER.instance().striderHudDelay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,22 @@
|
||||
"simple_transport_hud.config.category.general.option.scale.name": "Scale",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.minecart_hud.name": "Minecart HUD",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.minecart_hud.description": "Minecart Hud toggle",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.horse_hud.name": "Horse/Donky HUD",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.horse_hud.description": "Horse/Donky Hud toggle",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.happy_ghast_hud.name": "Happy Ghast HUD",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.happy_ghast_hud.description": "Happy Ghast Hud toggle",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.nautilus_hud.name": "Nautilus HUD",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.nautilus_hud.description": "Nautilus Hud toggle",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.strider_hud.name": "Strider HUD",
|
||||
"simple_transport_hud.config.category.general.group.activated_huds.option.strider_hud.description": "Strider Hud toggle",
|
||||
"simple_transport_hud.config.category.general.option.safe_area.name": "Ignore Safe Area",
|
||||
"simple_transport_hud.config.category.general.option.safe_area.description": "Move HUD to screen edges, ignoring GUI safe area margins",
|
||||
"simple_transport_hud.config.category.elytra_options.option.hud_position.name": "HUD Position",
|
||||
"simple_transport_hud.config.category.elytra_options.option.hud_position.description": "Change the position of the HUD on screen",
|
||||
"simple_transport_hud.config.category.elytra_options.option.delay_hud.name": "Delay HUD displaying",
|
||||
"simple_transport_hud.config.category.elytra_options.option.delay_hud.description": "Change the time it takes for the HUD to appear",
|
||||
"simple_transport_hud.config.category.minecart_hud.name": "Minecart HUD options"
|
||||
"simple_transport_hud.config.category.minecart_hud.name": "Minecart HUD options",
|
||||
"simple_transport_hud.config.category.horse_hud.name": "Horse HUD options",
|
||||
"simple_transport_hud.config.category.happy_ghast_hud.name": "Happy Ghast HUD opptions",
|
||||
"simple_transport_hud.config.category.strider.name": "Strider HUD options"
|
||||
}
|
||||
Reference in New Issue
Block a user