diff --git a/build.gradle b/build.gradle index 65cae4fb..3bc47bf0 100644 --- a/build.gradle +++ b/build.gradle @@ -11,15 +11,25 @@ version = project.mod_version group = project.maven_group +repositories { + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/" } +} + + dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" + modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + include "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}" // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - } processResources { diff --git a/gradle.properties b/gradle.properties index fe474fb7..f254f4c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,10 +12,14 @@ minecraft_version=1.19 yarn_mappings=1.19+build.1 loader_version=0.14.6 -#Fabric api +# Fabric api fabric_version=0.55.2+1.19 # Mod Properties mod_version = 1.19-fabric-1 maven_group = net.torocraft archives_base_name = torohealth + +# Third Party +modmenu_version = 4.0.0 +clothconfig_version = 7.0.65 \ No newline at end of file diff --git a/src/main/java/net/torocraft/torohealth/ModConfig.java b/src/main/java/net/torocraft/torohealth/ModConfig.java new file mode 100644 index 00000000..b72dc5ac --- /dev/null +++ b/src/main/java/net/torocraft/torohealth/ModConfig.java @@ -0,0 +1,139 @@ +package net.torocraft.torohealth; + +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; +import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; +import me.shedaniel.autoconfig.annotation.ConfigEntry.Gui.EnumHandler.EnumDisplayOption; + + +@Config(name = "torohealth") +public class ModConfig implements ConfigData { + @ConfigEntry.Gui.Excluded + public static ModConfig INSTANCE; + + public static void init() + { + AutoConfig.register(ModConfig.class, JanksonConfigSerializer::new); + INSTANCE = AutoConfig.getConfigHolder(ModConfig.class).getConfig(); + INSTANCE.postLoad(); + } + + @ConfigEntry.Gui.CollapsibleObject + public HudOptions hudOptions = new HudOptions(); + public static class HudOptions { + @ConfigEntry.Gui.Tooltip + public boolean showEntity = true; + + @ConfigEntry.Gui.Tooltip + public boolean showBar = true; + + @ConfigEntry.Gui.Tooltip + public boolean showSkin = true; + + @ConfigEntry.Gui.Tooltip + public boolean onlyWhenHurt = false; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.Gui.EnumHandler(option = EnumDisplayOption.BUTTON) + public AnchorPoint anchorPoint = AnchorPoint.TOP_LEFT; + + @ConfigEntry.Gui.Tooltip + public int hudHideDelay = 20; + + @ConfigEntry.Gui.Tooltip + public float hudDistance = 60f; + + @ConfigEntry.Gui.Tooltip + public int hudXPosition = 4; + + @ConfigEntry.Gui.Tooltip + public int hudYPosition = 4; + + @ConfigEntry.Gui.Tooltip + public float hudScale = 1f; + } + + + @ConfigEntry.Gui.CollapsibleObject + public ParticleOptions particleOptions = new ParticleOptions(); + public static class ParticleOptions { + @ConfigEntry.Gui.Tooltip + public boolean show = true; + + @ConfigEntry.Gui.Tooltip + public float particleDistance = 60f; + + @ConfigEntry.Gui.Excluded + public transient float particleDistanceSquared = 0; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int damageColor = 0xff0000; + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int healColor = 0x00ff00; + } + + + @ConfigEntry.Gui.CollapsibleObject + public InWorldBarOptions inWorldBarOptions = new InWorldBarOptions(); + public static class InWorldBarOptions { + @ConfigEntry.Gui.Tooltip + @ConfigEntry.Gui.EnumHandler(option = EnumDisplayOption.BUTTON) + public InWorldBarVisibilityMode inWorldBarVisibilityMode = InWorldBarVisibilityMode.NONE; + + @ConfigEntry.Gui.Tooltip + public boolean onlyWhenLookingAt = false; + + @ConfigEntry.Gui.Tooltip + public boolean onlyWhenHurt = false; + + @ConfigEntry.Gui.Tooltip + public float inWorldBarDistance = 60f; + } + + @ConfigEntry.Gui.CollapsibleObject + public BarOptions barOptions = new BarOptions(); + public static class BarOptions { + @ConfigEntry.Gui.Tooltip + @ConfigEntry.Gui.EnumHandler(option = EnumDisplayOption.BUTTON) + public HealthChangeType healthChangeType= HealthChangeType.LAST; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int friendColor = 0x00ff00; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int friendColorSecondary = 0x008000; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int foeColor = 0xff0000; + + @ConfigEntry.Gui.Tooltip + @ConfigEntry.ColorPicker + public int foeColorSecondary = 0x800000; + } + + + public enum AnchorPoint { + TOP_LEFT, TOP_CENTER, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT + } + + public enum InWorldBarVisibilityMode { + NONE, WHEN_HOLDING_WEAPON, ALWAYS + } + + public enum HealthChangeType { + NONE, LAST, CUMULATIVE + } + + + public void postLoad() { + // Recalculate dependent field + particleOptions.particleDistanceSquared = particleOptions.particleDistance * particleOptions.particleDistance; + } +} \ No newline at end of file diff --git a/src/main/java/net/torocraft/torohealth/ToroHealth.java b/src/main/java/net/torocraft/torohealth/ToroHealth.java index 322f6ffb..3b601708 100644 --- a/src/main/java/net/torocraft/torohealth/ToroHealth.java +++ b/src/main/java/net/torocraft/torohealth/ToroHealth.java @@ -1,28 +1,42 @@ package net.torocraft.torohealth; import java.util.Random; + +import net.minecraft.util.ActionResult; import net.fabricmc.api.ModInitializer; -import net.torocraft.torohealth.config.Config; -import net.torocraft.torohealth.config.loader.ConfigLoader; import net.torocraft.torohealth.display.Hud; import net.torocraft.torohealth.util.RayTrace; +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.ConfigHolder; public class ToroHealth implements ModInitializer { public static final String MODID = "torohealth"; - public static Config CONFIG = new Config(); + public static ModConfig CONFIG; public static Hud HUD = new Hud(); public static RayTrace RAYTRACE = new RayTrace(); public static boolean IS_HOLDING_WEAPON = false; public static Random RAND = new Random(); - private static ConfigLoader CONFIG_LOADER = new ConfigLoader<>(new Config(), - ToroHealth.MODID + ".json", config -> ToroHealth.CONFIG = config); @Override public void onInitialize() { - CONFIG_LOADER.load(); + ModConfig.init(); + + ConfigHolder holder = + AutoConfig.getConfigHolder(ModConfig.class); + + holder.registerSaveListener((h, c) -> { + c.postLoad(); + return ActionResult.SUCCESS; + }); + + holder.registerLoadListener((h, c) -> { + c.postLoad(); + return ActionResult.SUCCESS; + }); + CONFIG = ModConfig.INSTANCE; } } diff --git a/src/main/java/net/torocraft/torohealth/bars/BarState.java b/src/main/java/net/torocraft/torohealth/bars/BarState.java index d706697c..3a7647dd 100644 --- a/src/main/java/net/torocraft/torohealth/bars/BarState.java +++ b/src/main/java/net/torocraft/torohealth/bars/BarState.java @@ -62,7 +62,7 @@ private void handleHealthChange() { lastDmgDelay = HEALTH_INDICATOR_DELAY * 2; lastHealth = health; - if (ToroHealth.CONFIG.particle.show) { + if (ToroHealth.CONFIG.particleOptions.show) { BarStates.PARTICLES.add(new BarParticle(entity, lastDmg)); } } diff --git a/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java b/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java index 10ec0cac..08b3cd2a 100644 --- a/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java +++ b/src/main/java/net/torocraft/torohealth/bars/HealthBarRenderer.java @@ -18,9 +18,8 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3f; import net.torocraft.torohealth.ToroHealth; -import net.torocraft.torohealth.config.Config; -import net.torocraft.torohealth.config.Config.InWorld; -import net.torocraft.torohealth.config.Config.Mode; +import net.torocraft.torohealth.ModConfig.HealthChangeType; +import net.torocraft.torohealth.ModConfig.InWorldBarVisibilityMode; import net.torocraft.torohealth.util.EntityUtil; import net.torocraft.torohealth.util.EntityUtil.Relation; import org.lwjgl.opengl.GL11; @@ -31,10 +30,6 @@ public class HealthBarRenderer { private static final int DARK_GRAY = 0x808080; private static final float FULL_SIZE = 40; - private static InWorld getConfig() { - return ToroHealth.CONFIG.inWorld; - } - private static final List renderedEntities = new ArrayList<>(); public static void prepareRenderInWorld(LivingEntity entity) { @@ -44,25 +39,25 @@ public static void prepareRenderInWorld(LivingEntity entity) { return; } - if (entity.distanceTo(client.getCameraEntity()) > ToroHealth.CONFIG.inWorld.distance) { + if (entity.distanceTo(client.getCameraEntity()) > ToroHealth.CONFIG.inWorldBarOptions.inWorldBarDistance) { return; } BarStates.getState(entity); - if (Mode.WHEN_HOLDING_WEAPON.equals(getConfig().mode) && !ToroHealth.IS_HOLDING_WEAPON) { + if (InWorldBarVisibilityMode.WHEN_HOLDING_WEAPON.equals(ToroHealth.CONFIG.inWorldBarOptions.inWorldBarVisibilityMode) && !ToroHealth.IS_HOLDING_WEAPON) { return; } - if (Mode.NONE.equals(getConfig().mode)) { + if (InWorldBarVisibilityMode.NONE.equals(ToroHealth.CONFIG.inWorldBarOptions.inWorldBarVisibilityMode)) { return; } - if (ToroHealth.CONFIG.inWorld.onlyWhenLookingAt && ToroHealth.HUD.getEntity() != entity) { + if (ToroHealth.CONFIG.inWorldBarOptions.onlyWhenLookingAt && ToroHealth.HUD.getEntity() != entity) { return; } - if (ToroHealth.CONFIG.inWorld.onlyWhenHurt && entity.getHealth() >= entity.getMaxHealth()) { + if (ToroHealth.CONFIG.inWorldBarOptions.onlyWhenHurt && entity.getHealth() >= entity.getMaxHealth()) { return; } @@ -129,10 +124,10 @@ public static void render(MatrixStack matrix, LivingEntity entity, double x, dou Relation relation = EntityUtil.determineRelation(entity); - int color = relation.equals(Relation.FRIEND) ? ToroHealth.CONFIG.bar.friendColor - : ToroHealth.CONFIG.bar.foeColor; - int color2 = relation.equals(Relation.FRIEND) ? ToroHealth.CONFIG.bar.friendColorSecondary - : ToroHealth.CONFIG.bar.foeColorSecondary; + int color = relation.equals(Relation.FRIEND) ? ToroHealth.CONFIG.barOptions.friendColor + : ToroHealth.CONFIG.barOptions.foeColor; + int color2 = relation.equals(Relation.FRIEND) ? ToroHealth.CONFIG.barOptions.friendColorSecondary + : ToroHealth.CONFIG.barOptions.foeColorSecondary; BarState state = BarStates.getState(entity); @@ -146,9 +141,9 @@ public static void render(MatrixStack matrix, LivingEntity entity, double x, dou drawBar(m4f, x, y, width, percent, color, zOffset, inWorld); if (!inWorld) { - if (ToroHealth.CONFIG.bar.damageNumberType.equals(Config.NumberType.CUMULATIVE)) { + if (ToroHealth.CONFIG.barOptions.healthChangeType.equals(HealthChangeType.CUMULATIVE)) { drawDamageNumber(matrix, state.lastDmgCumulative, x, y, width); - } else if (ToroHealth.CONFIG.bar.damageNumberType.equals(Config.NumberType.LAST)) { + } else if (ToroHealth.CONFIG.barOptions.healthChangeType.equals(HealthChangeType.LAST)) { drawDamageNumber(matrix, state.lastDmg, x, y, width); } } @@ -163,7 +158,7 @@ public static void drawDamageNumber(MatrixStack matrix, int dmg, double x, doubl String s = Integer.toString(i); MinecraftClient minecraft = MinecraftClient.getInstance(); int sw = minecraft.textRenderer.getWidth(s); - int color = dmg < 0 ? ToroHealth.CONFIG.particle.healColor : ToroHealth.CONFIG.particle.damageColor; + int color = dmg < 0 ? ToroHealth.CONFIG.particleOptions.healColor : ToroHealth.CONFIG.particleOptions.damageColor; minecraft.textRenderer.draw(matrix, s, (int) (x + (width / 2) - sw), (int) y + 5, color); } diff --git a/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java b/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java index b0a83cba..b82d35a3 100644 --- a/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java +++ b/src/main/java/net/torocraft/torohealth/bars/ParticleRenderer.java @@ -21,7 +21,7 @@ public static void renderParticles(MatrixStack matrix, Camera camera) { private static void renderParticle(MatrixStack matrix, BarParticle particle, Camera camera) { double distanceSquared = camera.getPos().squaredDistanceTo(particle.x, particle.y, particle.z); - if (distanceSquared > ToroHealth.CONFIG.particle.distanceSquared) { + if (distanceSquared > ToroHealth.CONFIG.particleOptions.particleDistanceSquared) { return; } diff --git a/src/main/java/net/torocraft/torohealth/config/Config.java b/src/main/java/net/torocraft/torohealth/config/Config.java deleted file mode 100644 index 45d6a500..00000000 --- a/src/main/java/net/torocraft/torohealth/config/Config.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.torocraft.torohealth.config; - -import com.google.gson.annotations.JsonAdapter; -import net.torocraft.torohealth.config.loader.ColorJsonAdapter; -import net.torocraft.torohealth.config.loader.IConfig; - -public class Config implements IConfig { - public enum Mode { - NONE, WHEN_HOLDING_WEAPON, ALWAYS - } - - public enum NumberType { - NONE, LAST, CUMULATIVE - } - - public enum AnchorPoint { - TOP_LEFT, TOP_CENTER, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT - } - - public boolean watchForChanges = true; - public Hud hud = new Hud(); - public Bar bar = new Bar(); - public InWorld inWorld = new InWorld(); - public Particle particle = new Particle(); - - public static class Hud { - public int distance = 60; - public float x = 4f; - public float y = 4f; - public float scale = 1f; - public int hideDelay = 20; - public AnchorPoint anchorPoint = AnchorPoint.TOP_LEFT; - public boolean showEntity = true; - public boolean showBar = true; - public boolean showSkin = true; - public boolean onlyWhenHurt = false; - } - - public static class Particle { - public boolean show = true; - @JsonAdapter(ColorJsonAdapter.class) - public int damageColor = 0xff0000; - @JsonAdapter(ColorJsonAdapter.class) - public int healColor = 0x00ff00; - public int distance = 60; - public transient int distanceSquared = 0; - } - - public static class Bar { - public NumberType damageNumberType = NumberType.LAST; - @JsonAdapter(ColorJsonAdapter.class) - public int friendColor = 0x00ff00; - @JsonAdapter(ColorJsonAdapter.class) - public int friendColorSecondary = 0x008000; - @JsonAdapter(ColorJsonAdapter.class) - public int foeColor = 0xff0000; - @JsonAdapter(ColorJsonAdapter.class) - public int foeColorSecondary = 0x800000; - } - - public static class InWorld { - public Mode mode = Mode.NONE; - public float distance = 60f; - public boolean onlyWhenLookingAt = false; - public boolean onlyWhenHurt = false; - } - - @Override - public void update() { - particle.distanceSquared = particle.distance * particle.distance; - } - - @Override - public boolean shouldWatch() { - return watchForChanges; - } - -} diff --git a/src/main/java/net/torocraft/torohealth/config/loader/ColorJsonAdapter.java b/src/main/java/net/torocraft/torohealth/config/loader/ColorJsonAdapter.java deleted file mode 100644 index 78834e9d..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/ColorJsonAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -public class ColorJsonAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, Integer value) throws IOException { - String hex = String.format("#%06x", value & 0xFFFFFF); - out.value(hex); - } - - @Override - public Integer read(JsonReader in) throws IOException { - return parseColor(in.nextString()); - } - - private static Integer parseColor(String s) { - if (s.matches("^#[A-Fa-f0-9]{6}$")) { - return Integer.parseInt(s.substring(1), 16); - } - System.out.println("ToroHealth: failed to parse color [" + s + "]"); - return null; - } - -} diff --git a/src/main/java/net/torocraft/torohealth/config/loader/ConfigFolder.java b/src/main/java/net/torocraft/torohealth/config/loader/ConfigFolder.java deleted file mode 100644 index b045c6d7..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/ConfigFolder.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -import java.io.File; -import net.fabricmc.loader.api.FabricLoader; - -public class ConfigFolder { - - public static File get() { - return FabricLoader.getInstance().getConfigDir().toFile(); - } - -} diff --git a/src/main/java/net/torocraft/torohealth/config/loader/ConfigLoader.java b/src/main/java/net/torocraft/torohealth/config/loader/ConfigLoader.java deleted file mode 100644 index 22267515..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/ConfigLoader.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.util.function.Consumer; - -public class ConfigLoader { - - private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); - - private final Consumer onLoad; - private final File file; - private final T defaultConfig; - private FileWatcher watcher; - - public ConfigLoader(T defaultConfig, String filename, Consumer onLoad) { - this.defaultConfig = defaultConfig; - this.onLoad = onLoad; - this.file = new File(ConfigFolder.get(), filename); - } - - public void load() { - T config = defaultConfig; - - if (!file.exists()) { - save(config); - } - - config = read(); - - Defaulter.setDefaults(config, defaultConfig.getClass()); - - config.update(); - onLoad.accept(config); - - if (config.shouldWatch()) { - watch(file); - } - } - - @SuppressWarnings("unchecked") - public T read() { - try (FileReader reader = new FileReader(file)) { - return (T) GSON.fromJson(reader, defaultConfig.getClass()); - } catch (Exception e) { - e.printStackTrace(); - return defaultConfig; - } - } - - public void save(T config) { - try (FileWriter writer = new FileWriter(file)) { - writer.write(GSON.toJson(config)); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void watch(File file) { - if (watcher != null) { - return; - } - watcher = FileWatcher.watch(file, () -> load()); - } - -} diff --git a/src/main/java/net/torocraft/torohealth/config/loader/Defaulter.java b/src/main/java/net/torocraft/torohealth/config/loader/Defaulter.java deleted file mode 100644 index 9d749878..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/Defaulter.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -import java.lang.reflect.Field; - -public class Defaulter { - - private static boolean hasDefaultConstructor(Class clazz) { - try { - clazz.getDeclaredConstructor(); - return true; - } catch (Exception e) { - return false; - } - } - - public static void setDefaults(Object o, Class clazz) { - try { - Object defaults = clazz.getDeclaredConstructor().newInstance(); - Field[] fields = clazz.getFields(); - for (Field field : fields) { - if (field.get(o) == null) { - field.set(o, field.get(defaults)); - } - if (hasDefaultConstructor(field.getType())) { - setDefaults(field.get(o), field.getType()); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/src/main/java/net/torocraft/torohealth/config/loader/FileWatcher.java b/src/main/java/net/torocraft/torohealth/config/loader/FileWatcher.java deleted file mode 100644 index 26fe8e1d..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/FileWatcher.java +++ /dev/null @@ -1,70 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; -import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; -import java.io.File; -import java.io.IOException; -import java.nio.file.ClosedWatchServiceException; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.WatchEvent; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; - -public class FileWatcher implements Runnable { - private final File file; - private final Path filename; - private final Path parent; - private final Listener listener; - - @FunctionalInterface - public static interface Listener { - void onUpdate(); - } - - public static FileWatcher watch(File file, Listener listener) { - FileWatcher watcher = new FileWatcher(file, listener); - Thread thread = new Thread(watcher); - thread.setDaemon(true); - thread.start(); - return watcher; - } - - private FileWatcher(File file, Listener listener) { - this.file = file; - this.listener = listener; - this.filename = file.toPath().getFileName(); - this.parent = file.toPath().getParent(); - } - - @Override - public void run() { - try (WatchService watchService = FileSystems.getDefault().newWatchService()) { - this.parent.register(watchService, ENTRY_MODIFY, ENTRY_CREATE); - boolean poll = true; - while (poll) { - poll = pollEvents(watchService); - } - } catch (IOException | InterruptedException | ClosedWatchServiceException e) { - Thread.currentThread().interrupt(); - } - } - - protected boolean pollEvents(WatchService watchService) throws InterruptedException { - WatchKey key = watchService.take(); - for (WatchEvent event : key.pollEvents()) { - Path changedFilename = ((Path) event.context()).getFileName(); - if (changedFilename.equals(filename)) { - try { - listener.onUpdate(); - } catch (Exception e) { - new Exception("Error during file watch of " + file.getAbsolutePath(), e) - .printStackTrace(); - } - } - } - return key.reset(); - } - -} - diff --git a/src/main/java/net/torocraft/torohealth/config/loader/IConfig.java b/src/main/java/net/torocraft/torohealth/config/loader/IConfig.java deleted file mode 100644 index 11d1e116..00000000 --- a/src/main/java/net/torocraft/torohealth/config/loader/IConfig.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.torocraft.torohealth.config.loader; - -public interface IConfig { - void update(); - - boolean shouldWatch(); -} diff --git a/src/main/java/net/torocraft/torohealth/display/Hud.java b/src/main/java/net/torocraft/torohealth/display/Hud.java index 39480daf..36e096da 100644 --- a/src/main/java/net/torocraft/torohealth/display/Hud.java +++ b/src/main/java/net/torocraft/torohealth/display/Hud.java @@ -8,8 +8,7 @@ import net.minecraft.text.*; import net.minecraft.util.Identifier; import net.torocraft.torohealth.ToroHealth; -import net.torocraft.torohealth.config.Config; -import net.torocraft.torohealth.config.Config.AnchorPoint; +import net.torocraft.torohealth.ModConfig.AnchorPoint; public class Hud extends Screen { private static final Identifier BACKGROUND_TEXTURE = @@ -17,7 +16,6 @@ public class Hud extends Screen { private EntityDisplay entityDisplay = new EntityDisplay(); private LivingEntity entity; private BarDisplay barDisplay; - private Config config = new Config(); private int age; public Hud() { @@ -26,22 +24,18 @@ public Hud() { barDisplay = new BarDisplay(MinecraftClient.getInstance(), this); } - public void draw(MatrixStack matrix, Config config) { + public void draw(MatrixStack matrix) { if (this.client.options.debugEnabled) { return; } - this.config = config; - if (this.config == null) { - this.config = new Config(); - } float x = determineX(); float y = determineY(); - draw(matrix, x, y, config.hud.scale); + draw(matrix, x, y, ToroHealth.CONFIG.hudOptions.hudScale); } private float determineX() { - float x = config.hud.x; - AnchorPoint anchor = config.hud.anchorPoint; + float x = ToroHealth.CONFIG.hudOptions.hudXPosition; + AnchorPoint anchor = ToroHealth.CONFIG.hudOptions.anchorPoint; float wScreen = client.getWindow().getScaledWidth(); switch (anchor) { @@ -57,8 +51,8 @@ private float determineX() { } private float determineY() { - float y = config.hud.y; - AnchorPoint anchor = config.hud.anchorPoint; + float y = ToroHealth.CONFIG.hudOptions.hudYPosition; + AnchorPoint anchor = ToroHealth.CONFIG.hudOptions.anchorPoint; float hScreen = client.getWindow().getScaledHeight(); switch (anchor) { @@ -71,6 +65,7 @@ private float determineY() { } } + public void tick() { age++; } @@ -80,7 +75,7 @@ public void setEntity(LivingEntity entity) { age = 0; } - if (entity == null && age > config.hud.hideDelay) { + if (entity == null && age > ToroHealth.CONFIG.hudOptions.hudHideDelay) { setEntityWork(null); } @@ -103,22 +98,23 @@ private void draw(MatrixStack matrix, float x, float y, float scale) { return; } - if (config.hud.onlyWhenHurt && entity.getHealth() >= entity.getMaxHealth()) { + if (ToroHealth.CONFIG.hudOptions.onlyWhenHurt && entity.getHealth() >= entity.getMaxHealth()) { return; } matrix.push(); matrix.scale(scale, scale, scale); matrix.translate(x - 10, y - 10, 0); - if (config.hud.showSkin) { + if (ToroHealth.CONFIG.hudOptions.showSkin) { this.drawSkin(matrix); } matrix.translate(10, 10, 0); - if (config.hud.showEntity) { + if (ToroHealth.CONFIG.hudOptions.showEntity) { + entityDisplay.draw(matrix, scale); } matrix.translate(44, 0, 0); - if (config.hud.showBar) { + if (ToroHealth.CONFIG.hudOptions.showBar) { barDisplay.draw(matrix, entity); } matrix.pop(); diff --git a/src/main/java/net/torocraft/torohealth/integration/ModMenuIntegration.java b/src/main/java/net/torocraft/torohealth/integration/ModMenuIntegration.java new file mode 100644 index 00000000..96513345 --- /dev/null +++ b/src/main/java/net/torocraft/torohealth/integration/ModMenuIntegration.java @@ -0,0 +1,19 @@ +package net.torocraft.torohealth.integration; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import me.shedaniel.autoconfig.AutoConfig; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.torocraft.torohealth.ModConfig; + + +@Environment(EnvType.CLIENT) +public class ModMenuIntegration implements ModMenuApi +{ + @Override + public ConfigScreenFactory getModConfigScreenFactory() + { + return parent -> AutoConfig.getConfigScreen(ModConfig.class, parent).get(); + } +} \ No newline at end of file diff --git a/src/main/java/net/torocraft/torohealth/mixin/InGameHudMixin.java b/src/main/java/net/torocraft/torohealth/mixin/InGameHudMixin.java index 742bbb4f..aac96b1a 100644 --- a/src/main/java/net/torocraft/torohealth/mixin/InGameHudMixin.java +++ b/src/main/java/net/torocraft/torohealth/mixin/InGameHudMixin.java @@ -13,7 +13,7 @@ public class InGameHudMixin { @Inject(method = "render", at = @At("RETURN")) private void render(MatrixStack matrixStack, float partial, CallbackInfo info) { - ToroHealth.HUD.draw(matrixStack, ToroHealth.CONFIG); + ToroHealth.HUD.draw(matrixStack); } } diff --git a/src/main/java/net/torocraft/torohealth/mixin/PlayerEntityMixin.java b/src/main/java/net/torocraft/torohealth/mixin/PlayerEntityMixin.java index 0e9042c9..7c018b16 100644 --- a/src/main/java/net/torocraft/torohealth/mixin/PlayerEntityMixin.java +++ b/src/main/java/net/torocraft/torohealth/mixin/PlayerEntityMixin.java @@ -24,7 +24,7 @@ private void tick(CallbackInfo info) { if (!this.world.isClient) { return; } - ToroHealth.HUD.setEntity(ToroHealth.RAYTRACE.getEntityInCrosshair(0, ToroHealth.CONFIG.hud.distance)); + ToroHealth.HUD.setEntity(ToroHealth.RAYTRACE.getEntityInCrosshair(0, ToroHealth.CONFIG.hudOptions.hudDistance)); BarStates.tick(); HoldingWeaponUpdater.update(); ToroHealth.HUD.tick(); diff --git a/src/main/java/net/torocraft/torohealth/util/HoldingWeaponUpdater.java b/src/main/java/net/torocraft/torohealth/util/HoldingWeaponUpdater.java index 1f91cc50..e4605cd1 100644 --- a/src/main/java/net/torocraft/torohealth/util/HoldingWeaponUpdater.java +++ b/src/main/java/net/torocraft/torohealth/util/HoldingWeaponUpdater.java @@ -7,11 +7,11 @@ import net.minecraft.item.PotionItem; import net.minecraft.item.SwordItem; import net.torocraft.torohealth.ToroHealth; -import net.torocraft.torohealth.config.Config.Mode; +import net.torocraft.torohealth.ModConfig.InWorldBarVisibilityMode; public class HoldingWeaponUpdater { public static void update() { - if (Mode.NONE.equals(ToroHealth.CONFIG.inWorld.mode)) + if (InWorldBarVisibilityMode.NONE.equals(ToroHealth.CONFIG.inWorldBarOptions.inWorldBarVisibilityMode)) return; MinecraftClient minecraft = MinecraftClient.getInstance(); PlayerEntity player = minecraft.player; diff --git a/src/main/resources/assets/torohealth/lang/en_us.json b/src/main/resources/assets/torohealth/lang/en_us.json index 0b664e39..a3d4fe34 100644 --- a/src/main/resources/assets/torohealth/lang/en_us.json +++ b/src/main/resources/assets/torohealth/lang/en_us.json @@ -17,5 +17,65 @@ "config.torohealth.red": "Red", "config.torohealth.green": "Green", "config.torohealth.blue": "Blue", - "config.torohealth.alpha": "Alpha" + "config.torohealth.alpha": "Alpha", + + "text.autoconfig.torohealth.title": "ToroHealth Config", + + "text.autoconfig.torohealth.option.hudOptions": "HUD Options", + "text.autoconfig.torohealth.option.hudOptions.showEntity": "Show Entity", + "text.autoconfig.torohealth.option.hudOptions.showBar": "Show Bar", + "text.autoconfig.torohealth.option.hudOptions.showSkin": "Show Skin", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt": "Only When Hurt", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint": "HUD Anchor Point", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay": "HUD Hide Delay", + "text.autoconfig.torohealth.option.hudOptions.hudDistance": "HUD Max Distance", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition": "HUD X Position", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition": "HUD Y Position", + "text.autoconfig.torohealth.option.hudOptions.hudScale": "HUD Scale", + + "text.autoconfig.torohealth.option.particleOptions": "Particle Options", + "text.autoconfig.torohealth.option.particleOptions.show": "Display Particles", + "text.autoconfig.torohealth.option.particleOptions.particleDistance": "Particle Max Distance", + "text.autoconfig.torohealth.option.particleOptions.damageColor": "Damage Color", + "text.autoconfig.torohealth.option.particleOptions.healColor": "Heal Color", + + "text.autoconfig.torohealth.option.inWorldBarOptions": "In-World Bar Options", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode": "In-World Bar Visibility Mode", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt": "Only When Looking At", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt": "Only When Hurt", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance": "In-World Bar Max Distance", + + "text.autoconfig.torohealth.option.barOptions": "Bar Options", + "text.autoconfig.torohealth.option.barOptions.healthChangeType": "Health Change Type", + "text.autoconfig.torohealth.option.barOptions.friendColor": "Friend Color", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary": "Friend Color (Secondary)", + "text.autoconfig.torohealth.option.barOptions.foeColor": "Foe Color", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary": "Foe Color (Secondary)", + + "text.autoconfig.torohealth.option.hudOptions.showEntity.@Tooltip": "If true, draw the target entity model in the HUD overlay.", + "text.autoconfig.torohealth.option.hudOptions.showBar.@Tooltip": "If true, displays the health bar of the target entity in the HUD overlay.", + "text.autoconfig.torohealth.option.hudOptions.showSkin.@Tooltip": "If true, draw the frame texture in the HUD overlay.", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt.@Tooltip": "If true, the HUD only appears when the targeted entity has taken damage.", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint.@Tooltip": "Determines the screen corner or edge used as the anchor for positioning the HUD.", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay.@Tooltip": "Time (in ticks) before the HUD fades out after the entity is no longer targeted.", + "text.autoconfig.torohealth.option.hudOptions.hudDistance.@Tooltip": "Maximum distance at which the HUD will appear for targeted entities.", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition.@Tooltip": "Horizontal offset (in pixels) applied from the selected anchor point.", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition.@Tooltip": "Vertical offset (in pixels) applied from the selected anchor point.", + "text.autoconfig.torohealth.option.hudOptions.hudScale.@Tooltip": "Scales the size of the HUD overlay. 1.0 = default size.", + + "text.autoconfig.torohealth.option.particleOptions.show.@Tooltip": "If true, displays floating damage/heal particle numbers whenever an entity's health changes.", + "text.autoconfig.torohealth.option.particleOptions.particleDistance.@Tooltip": "Maximum distance (in blocks) at which damage/heal particles are rendered.", + "text.autoconfig.torohealth.option.particleOptions.damageColor.@Tooltip": "Color used for damage number particles.", + "text.autoconfig.torohealth.option.particleOptions.healColor.@Tooltip": "Color used for healing number particles.", + + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode.@Tooltip": "Determines when in-world health bars are displayed above entities.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt.@Tooltip": "If true, the in-world health bar is shown only when directly looking at the entity.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt.@Tooltip": "If true, the in-world health bar appears only when the entity has taken damage.", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance.@Tooltip": "Maximum distance (in blocks) at which in-world health bars are visible.", + + "text.autoconfig.torohealth.option.barOptions.healthChangeType.@Tooltip": "Sets which health-change number is shown in the HUD.", + "text.autoconfig.torohealth.option.barOptions.friendColor.@Tooltip": "Primary color used for the health bar of friendly entities.", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary.@Tooltip": "Secondary color used to display health loss on friendly entities.", + "text.autoconfig.torohealth.option.barOptions.foeColor.@Tooltip": "Primary color used for the health bar of hostile entities.", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary.@Tooltip": "Secondary color used to display health loss on hostile entities." } \ No newline at end of file diff --git a/src/main/resources/assets/torohealth/lang/es_es.json b/src/main/resources/assets/torohealth/lang/es_es.json index 48511a90..210f5b62 100644 --- a/src/main/resources/assets/torohealth/lang/es_es.json +++ b/src/main/resources/assets/torohealth/lang/es_es.json @@ -17,5 +17,65 @@ "config.torohealth.red": "Rojo", "config.torohealth.green": "Verde", "config.torohealth.blue": "Azul", - "config.torohealth.alpha": "Transparencia" + "config.torohealth.alpha": "Transparencia", + + "text.autoconfig.torohealth.title": "Configuración de ToroHealth", + + "text.autoconfig.torohealth.option.hudOptions": "Ajustes del HUD", + "text.autoconfig.torohealth.option.hudOptions.showEntity": "Mostrar entidad", + "text.autoconfig.torohealth.option.hudOptions.showBar": "Mostrar barra", + "text.autoconfig.torohealth.option.hudOptions.showSkin": "Mostrar marco", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt": "Solo al recibir daño", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint": "Punto de anclaje del HUD", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay": "Demora en ocultar el HUD", + "text.autoconfig.torohealth.option.hudOptions.hudDistance": "Distancia máxima del HUD", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition": "Posición X del HUD", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition": "Posición Y del HUD", + "text.autoconfig.torohealth.option.hudOptions.hudScale": "Escala del HUD", + + "text.autoconfig.torohealth.option.particleOptions": "Ajustes de partículas", + "text.autoconfig.torohealth.option.particleOptions.show": "Mostrar partículas", + "text.autoconfig.torohealth.option.particleOptions.particleDistance": "Distancia máxima de partículas", + "text.autoconfig.torohealth.option.particleOptions.damageColor": "Color de daño", + "text.autoconfig.torohealth.option.particleOptions.healColor": "Color de curación", + + "text.autoconfig.torohealth.option.inWorldBarOptions": "Opciones de barra sobre entidades", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode": "Modo de visibilidad de barra sobre entidades", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt": "Solo al mirar directamente", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt": "Solo al recibir daño", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance": "Distancia máxima de barra sobre entidades", + + "text.autoconfig.torohealth.option.barOptions": "Ajustes de la barra", + "text.autoconfig.torohealth.option.barOptions.healthChangeType": "Tipo de cambio de salud", + "text.autoconfig.torohealth.option.barOptions.friendColor": "Color para aliados", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary": "Color secundario (aliados)", + "text.autoconfig.torohealth.option.barOptions.foeColor": "Color para enemigos", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary": "Color secundario (enemigos)", + + "text.autoconfig.torohealth.option.hudOptions.showEntity.@Tooltip": "Si está activado, dibuja el modelo de la entidad objetivo en el HUD.", + "text.autoconfig.torohealth.option.hudOptions.showBar.@Tooltip": "Si está activado, muestra la barra de salud de la entidad objetivo en el HUD.", + "text.autoconfig.torohealth.option.hudOptions.showSkin.@Tooltip": "Si está activado, dibuja el marco decorativo alrededor del modelo de entidad en el HUD.", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt.@Tooltip": "Si está activado, el HUD solo aparece cuando la entidad objetivo ha recibido daño.", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint.@Tooltip": "Determina la esquina o borde de la pantalla que se usa como punto de anclaje del HUD.", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay.@Tooltip": "Tiempo (en ticks) antes de que el HUD se desvanezca después de dejar de mirar la entidad.", + "text.autoconfig.torohealth.option.hudOptions.hudDistance.@Tooltip": "Distancia máxima a la que aparece el HUD para entidades objetivo.", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition.@Tooltip": "Desplazamiento horizontal (en píxeles) aplicado desde el punto de anclaje.", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition.@Tooltip": "Desplazamiento vertical (en píxeles) aplicado desde el punto de anclaje.", + "text.autoconfig.torohealth.option.hudOptions.hudScale.@Tooltip": "Escala el tamaño del HUD. 1.0 = tamaño predeterminado.", + + "text.autoconfig.torohealth.option.particleOptions.show.@Tooltip": "Si está activado, muestra números flotantes de daño y curación cuando cambia la salud de una entidad.", + "text.autoconfig.torohealth.option.particleOptions.particleDistance.@Tooltip": "Distancia máxima (en bloques) a la que se renderizan las partículas de daño/curación.", + "text.autoconfig.torohealth.option.particleOptions.damageColor.@Tooltip": "Color utilizado para las partículas de daño.", + "text.autoconfig.torohealth.option.particleOptions.healColor.@Tooltip": "Color utilizado para las partículas de curación.", + + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode.@Tooltip": "Determina cuándo se muestran las barras de salud en el mundo encima de las entidades.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt.@Tooltip": "Si es verdadero, la barra de salud en el mundo solo se muestra al mirar directamente a la entidad.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt.@Tooltip": "Si es verdadero, la barra de salud en el mundo aparece solo cuando la entidad ha recibido daño.", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance.@Tooltip": "Distancia máxima (en bloques) a la que las barras de salud en el mundo son visibles.", + + "text.autoconfig.torohealth.option.barOptions.healthChangeType.@Tooltip": "Determina qué número de cambio de salud se muestra en el HUD.", + "text.autoconfig.torohealth.option.barOptions.friendColor.@Tooltip": "Color primario utilizado para la barra de salud de entidades amistosas.", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary.@Tooltip": "Color secundario que indica la pérdida de salud en entidades amistosas.", + "text.autoconfig.torohealth.option.barOptions.foeColor.@Tooltip": "Color primario utilizado para la barra de salud de entidades hostiles.", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary.@Tooltip": "Color secundario que indica la pérdida de salud en entidades hostiles." } diff --git a/src/main/resources/assets/torohealth/lang/fr_fr.json b/src/main/resources/assets/torohealth/lang/fr_fr.json index 41804da9..4ed744d8 100644 --- a/src/main/resources/assets/torohealth/lang/fr_fr.json +++ b/src/main/resources/assets/torohealth/lang/fr_fr.json @@ -1,21 +1,81 @@ { - "config.title": "Configuration de ToroHealth", - "config.category.hud": "Options de l'HUD", - "config.hud.hideDelay": "Délai de dissimulation", - "config.hud.x": "Position X", - "config.hud.y": "Position Y", - "config.hud.scale": "Échelle", - "config.torohealth.category.bar": "Options de la barre de vie", - "config.bar.damageNumberType": "Type de l'indicateur de dommage", - "config.torohealth.category.inWorld": "Options dans le monde", - "config.inWorld.mode": "Mode", - "config.inWorld.distance": "Distance", - "config.torohealth.friendColor.title": "Couleur de la barre pour les amis", - "config.torohealth.friendColorSecondary.title":"Couleur de la barre pour les amis (Secondaire)", - "config.torohealth.foeColor.title": "Couleur de la barre pour les ennemis", - "config.torohealth.foeColorSecondary.title":"Couleur de la barre pour les ennemis (Secondaire)", - "config.torohealth.red": "Rouge", - "config.torohealth.green": "Vert", - "config.torohealth.blue": "Bleu", - "config.torohealth.alpha": "Transparence" - } \ No newline at end of file + "config.title": "Configuration de ToroHealth", + "config.category.hud": "Options de l'HUD", + "config.hud.hideDelay": "Délai de dissimulation", + "config.hud.x": "Position X", + "config.hud.y": "Position Y", + "config.hud.scale": "Échelle", + "config.torohealth.category.bar": "Options de la barre de vie", + "config.bar.damageNumberType": "Type de l'indicateur de dommage", + "config.torohealth.category.inWorld": "Options dans le monde", + "config.inWorld.mode": "Mode", + "config.inWorld.distance": "Distance", + "config.torohealth.friendColor.title": "Couleur de la barre pour les amis", + "config.torohealth.friendColorSecondary.title":"Couleur de la barre pour les amis (Secondaire)", + "config.torohealth.foeColor.title": "Couleur de la barre pour les ennemis", + "config.torohealth.foeColorSecondary.title":"Couleur de la barre pour les ennemis (Secondaire)", + "config.torohealth.red": "Rouge", + "config.torohealth.green": "Vert", + "config.torohealth.blue": "Bleu", + "config.torohealth.alpha": "Transparence", + + "text.autoconfig.torohealth.title": "Configuration de ToroHealth", + + "text.autoconfig.torohealth.option.hudOptions": "Options de l'HUD", + "text.autoconfig.torohealth.option.hudOptions.showEntity": "Afficher l'entité", + "text.autoconfig.torohealth.option.hudOptions.showBar": "Afficher la barre", + "text.autoconfig.torohealth.option.hudOptions.showSkin": "Afficher le cadre", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt": "Uniquement en cas de dégâts", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint": "Point d'ancrage de l'HUD", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay": "Délai avant disparition du HUD", + "text.autoconfig.torohealth.option.hudOptions.hudDistance": "Distance maximale de l'HUD", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition": "Position X de l'HUD", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition": "Position Y de l'HUD", + "text.autoconfig.torohealth.option.hudOptions.hudScale": "Échelle de l'HUD", + + "text.autoconfig.torohealth.option.particleOptions": "Options des particules", + "text.autoconfig.torohealth.option.particleOptions.show": "Afficher les particules", + "text.autoconfig.torohealth.option.particleOptions.particleDistance": "Distance maximale des particules", + "text.autoconfig.torohealth.option.particleOptions.damageColor": "Couleur des dégâts", + "text.autoconfig.torohealth.option.particleOptions.healColor": "Couleur de soin", + + "text.autoconfig.torohealth.option.inWorldBarOptions": "Options des barres de vie au-dessus des entités", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode": "Mode d'affichage des barres de vie au-dessus des entités", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt": "Uniquement en la regardant directement", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt": "Uniquement en cas de dégâts", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance": "Distance maximale des barres de vie au-dessus des entités", + + "text.autoconfig.torohealth.option.barOptions": "Options de la barre", + "text.autoconfig.torohealth.option.barOptions.healthChangeType": "Type de changement de santé", + "text.autoconfig.torohealth.option.barOptions.friendColor": "Couleur (entités amies)", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary": "Couleur secondaire (entités amies)", + "text.autoconfig.torohealth.option.barOptions.foeColor": "Couleur (entités hostiles)", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary": "Couleur secondaire (entités hostiles)", + + "text.autoconfig.torohealth.option.hudOptions.showEntity.@Tooltip": "Si coché, affiche le modèle de l’entité visée dans l’HUD.", + "text.autoconfig.torohealth.option.hudOptions.showBar.@Tooltip": "Si coché, affiche la barre de vie de l’entité visée dans l’HUD.", + "text.autoconfig.torohealth.option.hudOptions.showSkin.@Tooltip": "Si coché, affiche le cadre décoratif autour du modèle dans l’HUD.", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt.@Tooltip": "Si coché, l’HUD n’apparaît que lorsque l’entité visée subit des dégâts.", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint.@Tooltip": "Détermine le coin ou le bord de l’écran utilisé comme ancre pour positionner le HUD.", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay.@Tooltip": "Temps (en ticks) avant que l’HUD disparaisse après avoir cessé de viser l’entité.", + "text.autoconfig.torohealth.option.hudOptions.hudDistance.@Tooltip": "Distance maximale à laquelle le HUD apparaît pour les entités ciblées.", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition.@Tooltip": "Décalage horizontal (en pixels) appliqué depuis le point d’ancrage.", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition.@Tooltip": "Décalage vertical (en pixels) appliqué depuis le point d’ancrage.", + "text.autoconfig.torohealth.option.hudOptions.hudScale.@Tooltip": "Met à l’échelle l’affichage HUD. 1,0 = taille par défaut.", + + "text.autoconfig.torohealth.option.particleOptions.show.@Tooltip": "Si coché, affiche les nombres flottants de dégâts et de soin lorsque la vie d’une entité change.", + "text.autoconfig.torohealth.option.particleOptions.particleDistance.@Tooltip": "Distance maximale (en blocs) à laquelle les particules de dégâts/soins sont affichées.", + "text.autoconfig.torohealth.option.particleOptions.damageColor.@Tooltip": "Couleur utilisée pour les particules de dégâts.", + "text.autoconfig.torohealth.option.particleOptions.healColor.@Tooltip": "Couleur utilisée pour les nombres de soin.", + + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode.@Tooltip": "Détermine quand les barres de vie au-dessus des entités sont affichées.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt.@Tooltip": "Si coché, la barre de vie au-dessus de l’entité n’apparaît que lorsqu’on la regarde directement.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt.@Tooltip": "Si coché, la barre de vie au-dessus de l’entité n’apparaît que lorsqu’elle subit des dégâts.", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance.@Tooltip": "Distance maximale (en blocs) à laquelle les barres de vie dans le monde sont visibles.", + + "text.autoconfig.torohealth.option.barOptions.healthChangeType.@Tooltip": "Détermine quel type de changement de vie est affiché dans l’HUD.", + "text.autoconfig.torohealth.option.barOptions.friendColor.@Tooltip": "Couleur principale utilisée pour la barre de vie des entités amies.", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary.@Tooltip": "Couleur secondaire utilisée pour indiquer la perte de vie des entités amies.", + "text.autoconfig.torohealth.option.barOptions.foeColor.@Tooltip": "Couleur principale utilisée pour la barre de vie des entités hostiles.", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary.@Tooltip": "Couleur secondaire utilisée pour indiquer la perte de vie des entités hostiles." +} \ No newline at end of file diff --git a/src/main/resources/assets/torohealth/lang/ru_ru.json b/src/main/resources/assets/torohealth/lang/ru_ru.json index 08c745fb..809ee4b5 100644 --- a/src/main/resources/assets/torohealth/lang/ru_ru.json +++ b/src/main/resources/assets/torohealth/lang/ru_ru.json @@ -1,6 +1,6 @@ { "config.title": "Конфиг ToroHealth", - "config.category.hud": "Параметры HUD", + "config.category.hud": "Настройки HUD", "config.hud.hideDelay": "Задержка до исчезновения", "config.hud.x": "Позиция X", "config.hud.y": "Позиция Y", @@ -17,5 +17,65 @@ "config.torohealth.red": "Красный", "config.torohealth.green": "Зелёный", "config.torohealth.blue": "Синий", - "config.torohealth.alpha": "Альфа" + "config.torohealth.alpha": "Альфа", + + "text.autoconfig.torohealth.title": "Конфиг ToroHealth", + + "text.autoconfig.torohealth.option.hudOptions": "Параметры HUD", + "text.autoconfig.torohealth.option.hudOptions.showEntity": "Показывать сущность", + "text.autoconfig.torohealth.option.hudOptions.showBar": "Показывать полоску", + "text.autoconfig.torohealth.option.hudOptions.showSkin": "Показывать рамку", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt": "Только при получении урона", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint": "Точка закрепления HUD", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay": "Задержка скрытия HUD", + "text.autoconfig.torohealth.option.hudOptions.hudDistance": "Максимальная дистанция HUD", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition": "Позиция HUD по X", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition": "Позиция HUD по Y", + "text.autoconfig.torohealth.option.hudOptions.hudScale": "Масштаб HUD", + + "text.autoconfig.torohealth.option.particleOptions": "Параметры частиц", + "text.autoconfig.torohealth.option.particleOptions.show": "Показывать частицы", + "text.autoconfig.torohealth.option.particleOptions.particleDistance": "Максимальная дистанция частиц", + "text.autoconfig.torohealth.option.particleOptions.damageColor": "Цвет урона", + "text.autoconfig.torohealth.option.particleOptions.healColor": "Цвет лечения", + + "text.autoconfig.torohealth.option.inWorldBarOptions": "Полоски здоровья над сущностями", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode": "Режим отображения полосок над сущностями", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt": "Только при наведении", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt": "Только при получении урона", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance": "Максимальная дистанция полосок над сущностями", + + "text.autoconfig.torohealth.option.barOptions": "Параметры полоски", + "text.autoconfig.torohealth.option.barOptions.healthChangeType": "Тип отображения изменения здоровья", + "text.autoconfig.torohealth.option.barOptions.friendColor": "Цвет для союзников", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary": "Цвет союзников (вторичный)", + "text.autoconfig.torohealth.option.barOptions.foeColor": "Цвет для врагов", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary": "Цвет врагов (вторичный)", + + "text.autoconfig.torohealth.option.hudOptions.showEntity.@Tooltip": "Если включено, отображает модель цели в интерфейсе HUD.", + "text.autoconfig.torohealth.option.hudOptions.showBar.@Tooltip": "Если включено, показывает полосу здоровья цели в HUD.", + "text.autoconfig.torohealth.option.hudOptions.showSkin.@Tooltip": "Если включено, отображает декоративную рамку вокруг модели сущности в HUD.", + "text.autoconfig.torohealth.option.hudOptions.onlyWhenHurt.@Tooltip": "Если включено, HUD появляется только когда цель получила урон.", + "text.autoconfig.torohealth.option.hudOptions.anchorPoint.@Tooltip": "Определяет угол или сторону экрана, используемые как точка привязки HUD.", + "text.autoconfig.torohealth.option.hudOptions.hudHideDelay.@Tooltip": "Задержка (в тиках) перед исчезновением HUD после того, как цель перестала быть выделена.", + "text.autoconfig.torohealth.option.hudOptions.hudDistance.@Tooltip": "Максимальная дистанция, на которой HUD появляется для выделенных сущностей.", + "text.autoconfig.torohealth.option.hudOptions.hudXPosition.@Tooltip": "Горизонтальное смещение (в пикселях) от точки привязки.", + "text.autoconfig.torohealth.option.hudOptions.hudYPosition.@Tooltip": "Вертикальное смещение (в пикселях) от точки привязки.", + "text.autoconfig.torohealth.option.hudOptions.hudScale.@Tooltip": "Масштаб HUD. 1.0 = стандартный размер.", + + "text.autoconfig.torohealth.option.particleOptions.show.@Tooltip": "Если включено, показывает плавающие цифры урона и лечения при изменении здоровья сущности.", + "text.autoconfig.torohealth.option.particleOptions.particleDistance.@Tooltip": "Максимальная дистанция (в блоках), на которой отображаются частицы урона/исцеления.", + "text.autoconfig.torohealth.option.particleOptions.damageColor.@Tooltip": "Цвет, используемый для частиц урона.", + "text.autoconfig.torohealth.option.particleOptions.healColor.@Tooltip": "Цвет, используемый для частиц исцеления.", + + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarVisibilityMode.@Tooltip": "Определяет, когда отображаются полоски здоровья в мире над сущностями.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenLookingAt.@Tooltip": "Если включено, полоска здоровья в мире показывается только при прямом взгляде на сущность.", + "text.autoconfig.torohealth.option.inWorldBarOptions.onlyWhenHurt.@Tooltip": "Если включено, полоска здоровья в мире появляется только после того, как сущность получила урон.", + "text.autoconfig.torohealth.option.inWorldBarOptions.inWorldBarDistance.@Tooltip": "Максимальная дистанция (в блоках), на которой отображаются полоски здоровья в мире.", + + "text.autoconfig.torohealth.option.barOptions.healthChangeType.@Tooltip": "Определяет, какое изменение здоровья отображается в HUD.", + "text.autoconfig.torohealth.option.barOptions.friendColor.@Tooltip": "Основной цвет полоски здоровья дружелюбных сущностей.", + "text.autoconfig.torohealth.option.barOptions.friendColorSecondary.@Tooltip": "Вторичный цвет, используемый для отображения потери здоровья у дружелюбных сущностей.", + "text.autoconfig.torohealth.option.barOptions.foeColor.@Tooltip": "Основной цвет полоски здоровья враждебных сущностей.", + "text.autoconfig.torohealth.option.barOptions.foeColorSecondary.@Tooltip": "Вторичный цвет, используемый для отображения потери здоровья у враждебных сущностей." } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 16604a79..37db6d8c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -18,6 +18,9 @@ "entrypoints": { "main": [ "net.torocraft.torohealth.ToroHealth" + ], + "modmenu": [ + "net.torocraft.torohealth.integration.ModMenuIntegration" ] }, "mixins": [