diff --git a/gradle.properties b/gradle.properties index 937b48f..8579f01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true # Mod properties -mod_version = 4.1.3 +mod_version = 4.1.2 maven_group = io.github.adytech99.healthindicators archives_name = HealthIndicators enabled_platforms = fabric,neoforge diff --git a/remappedSrc/io/github/adytech99/healthindicators/HealthIndicatorsMod.java b/remappedSrc/io/github/adytech99/healthindicators/HealthIndicatorsMod.java deleted file mode 100644 index 8e36ee6..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/HealthIndicatorsMod.java +++ /dev/null @@ -1,134 +0,0 @@ -package io.github.adytech99.healthindicators; - -import com.terraformersmc.modmenu.ModMenu; -import io.github.adytech99.healthindicators.commands.ModCommands; -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import io.github.adytech99.healthindicators.util.ConfigUtils; -import io.github.adytech99.healthindicators.util.Maths; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Environment(EnvType.CLIENT) -public class HealthIndicatorsMod implements ClientModInitializer { - public static final String MOD_ID = "healthindicators"; - public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); - public static final String CONFIG_FILE = "healthindicators.json"; - - public static final KeyBinding RENDERING_ENABLED_KEY_BINDING = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".renderingEnabled", - InputUtil.GLFW_KEY_LEFT, - "key.categories." + MOD_ID - )); - public static final KeyBinding OVERRIDE_ALL_FILTERS = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".overrideAllFilters", - InputUtil.GLFW_KEY_RIGHT, - "key.categories." + MOD_ID - )); - public static final KeyBinding INCREASE_HEART_OFFSET_KEY_BINDING = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".increaseHeartOffset", - InputUtil.GLFW_KEY_UP, - "key.categories." + MOD_ID - )); - public static final KeyBinding DECREASE_HEART_OFFSET_KEY_BINDING = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".decreaseHeartOffset", - InputUtil.GLFW_KEY_DOWN, - "key.categories." + MOD_ID - )); - - - private boolean changed = false; - private static boolean openConfig = false; - - public static void openConfig(MinecraftClient client){ - openConfig = client.world != null; - } - - @Override - public void onInitializeClient() { - ModConfig.HANDLER.load(); - Config.load(); - if(ModConfig.HANDLER.instance().enable_commands) ModCommands.registerCommands(); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if(openConfig){ - Screen configScreen = ModMenu.getConfigScreen(HealthIndicatorsMod.MOD_ID, client.currentScreen); - client.setScreen(configScreen); - openConfig = false; - } - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - while (RENDERING_ENABLED_KEY_BINDING.wasPressed()) { - Config.setRenderingEnabled(!Config.getRenderingEnabled()); - if (client.player != null) { - Formatting formatting; - if(ModConfig.HANDLER.instance().colored_messages) formatting = Config.getRenderingEnabled() ? Formatting.GREEN : Formatting.RED; - else formatting = Formatting.WHITE; - ConfigUtils.sendMessage(client.player, Text.literal((Config.getRenderingEnabled() ? "Enabled" : "Disabled") + " Health Indicators").formatted(formatting)); - } - } - - if (OVERRIDE_ALL_FILTERS.isPressed()) { - Config.setOverrideAllFiltersEnabled(true); - if (client.player != null) { - ConfigUtils.sendOverlayMessage(client.player, Text.literal( " Config Criteria " + (Config.getOverrideAllFiltersEnabled() ? "Temporarily Overridden" : "Re-implemented"))); - } - } - else if(Config.getOverrideAllFiltersEnabled()) { - Config.setOverrideAllFiltersEnabled(false); - client.inGameHud.setOverlayMessage(Text.literal(""), false); - } - - while (INCREASE_HEART_OFFSET_KEY_BINDING.wasPressed()) { - ModConfig.HANDLER.instance().display_offset = (ModConfig.HANDLER.instance().display_offset + ModConfig.HANDLER.instance().offset_step_size); - changed = true; - if (client.player != null) { - ConfigUtils.sendMessage(client.player, Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - } - } - - while (DECREASE_HEART_OFFSET_KEY_BINDING.wasPressed()) { - ModConfig.HANDLER.instance().display_offset = (ModConfig.HANDLER.instance().display_offset - ModConfig.HANDLER.instance().offset_step_size); - changed = true; - if (client.player != null) { - ConfigUtils.sendMessage(client.player, Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - } - } - }); - - ClientEntityEvents.ENTITY_UNLOAD.register((entity, world) -> { - RenderTracker.removeFromUUIDS(entity); - }); - - ClientTickEvents.START_CLIENT_TICK.register(client -> { - if(client.world == null) return; - if(changed && client.world.getTime() % 200 == 0){ - saveModConfig(); - changed = false; - } - }); - - ClientLifecycleEvents.CLIENT_STOPPING.register(client -> { - saveModConfig(); - }); - - ClientTickEvents.END_CLIENT_TICK.register(RenderTracker::tick); - LOGGER.info("Never be heartless!"); - } - - public void saveModConfig(){ - ModConfig.HANDLER.save(); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/RenderTracker.java b/remappedSrc/io/github/adytech99/healthindicators/RenderTracker.java deleted file mode 100644 index 971c606..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/RenderTracker.java +++ /dev/null @@ -1,165 +0,0 @@ -package io.github.adytech99.healthindicators; - -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.config.ModConfig; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.decoration.ArmorStandEntity; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileUtil; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; - -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -public class RenderTracker { - private static final ConcurrentHashMap UUIDS = new ConcurrentHashMap<>(); - - public static boolean after_attack = ModConfig.HANDLER.instance().after_attack; - - public static void tick(MinecraftClient client){ - if(client.player == null || client.world == null) return; - if(Config.getRenderingEnabled()) { - for (Entity entity : client.world.getEntities()) { - if (entity instanceof LivingEntity livingEntity && (satisfiesAdvancedCriteria(client.player, livingEntity) || overridePlayers(livingEntity))) { - addToUUIDS(livingEntity); - } else removeFromUUIDS(entity.getUuid()); - } - } - trimEntities(client.world); - if(ModConfig.HANDLER.instance().after_attack != after_attack) - if(ModConfig.HANDLER.instance().after_attack){ - UUIDS.clear(); - } - after_attack = ModConfig.HANDLER.instance().after_attack; - } - - public static void onDamage(DamageSource damageSource, LivingEntity livingEntity) { - if(damageSource.getAttacker() instanceof PlayerEntity){ - assert MinecraftClient.getInstance().world != null; - if (ModConfig.HANDLER.instance().after_attack - && livingEntity instanceof LivingEntity - && RenderTracker.isEntityTypeAllowed(livingEntity, MinecraftClient.getInstance().player)) { - - if(!addToUUIDS(livingEntity)){ - UUIDS.replace(livingEntity.getUuid(), (ModConfig.HANDLER.instance().time_after_hit * 20)); - } - } - } - } - - - public static void trimEntities(ClientWorld world) { - // Check if there's a need to trim entries - Iterator> iterator = UUIDS.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - entry.setValue(entry.getValue() - 1); - if (entry.getValue() <= 0) { - iterator.remove(); // Safe removal during iteration - } - } - - // Remove invalid entities - UUIDS.entrySet().removeIf(entry -> isInvalid(getEntityFromUUID(entry.getKey(), world))|| !Config.getRenderingEnabled()); - if(UUIDS.size() >= 1536) UUIDS.clear(); - } - - - public static void removeFromUUIDS(Entity entity){ - UUIDS.remove(entity.getUuid()); - } - public static void removeFromUUIDS(UUID uuid){ - UUIDS.remove(uuid); - } - - public static boolean addToUUIDS(LivingEntity livingEntity){ - if(!UUIDS.containsKey(livingEntity.getUuid())){ - UUIDS.put(livingEntity.getUuid(), ModConfig.HANDLER.instance().after_attack ? (ModConfig.HANDLER.instance().time_after_hit * 20) : 2400); - return true; - } - else return false; - } - - public static boolean isInUUIDS(LivingEntity livingEntity){ - return UUIDS.containsKey(livingEntity.getUuid()); - } - - public static boolean overridePlayers(LivingEntity livingEntity){ - return (ModConfig.HANDLER.instance().override_players && livingEntity instanceof PlayerEntity && livingEntity != MinecraftClient.getInstance().player) - || (livingEntity == MinecraftClient.getInstance().player && ModConfig.HANDLER.instance().self); - } - - public static boolean isEntityTypeAllowed(LivingEntity livingEntity, PlayerEntity self){ - if(!ModConfig.HANDLER.instance().passive_mobs && livingEntity instanceof PassiveEntity) return false; - if(!ModConfig.HANDLER.instance().hostile_mobs && livingEntity instanceof HostileEntity) return false; - if(!ModConfig.HANDLER.instance().players && livingEntity instanceof PlayerEntity) return false; - if(!ModConfig.HANDLER.instance().self && livingEntity == self) return false; - return !(livingEntity instanceof ArmorStandEntity); - } - - public static boolean satisfiesAdvancedCriteria(ClientPlayerEntity player, LivingEntity livingEntity){ - if(!isEntityTypeAllowed(livingEntity, player)) return false; //Entity Types - if(!UUIDS.containsKey(livingEntity.getUuid()) && ModConfig.HANDLER.instance().after_attack) return false; //Damaged by Player, key should have been added by separate means. Necessary because removal check is done by this method. - if(livingEntity.getHealth() == livingEntity.getMaxHealth() && ModConfig.HANDLER.instance().damaged_only && livingEntity.getAbsorptionAmount() <= 0) return false; //Damaged by Any Reason - - return !isInvalid(livingEntity); - } - - public static boolean isTargeted(LivingEntity livingEntity){ - Entity camera = MinecraftClient.getInstance().cameraEntity; - double d = ModConfig.HANDLER.instance().reach; - double e = MathHelper.square(d); - Vec3d vec3d = camera.getCameraPosVec(0); - HitResult hitResult = camera.raycast(d, 0, false); - double f = hitResult.getPos().squaredDistanceTo(vec3d); - if (hitResult.getType() != HitResult.Type.MISS) { - e = f; - d = Math.sqrt(e); - } - Vec3d vec3d2 = camera.getRotationVec(0); - Vec3d vec3d3 = vec3d.add(vec3d2.x * d, vec3d2.y * d, vec3d2.z * d); - float g = 1.0f; - Box box = camera.getBoundingBox().stretch(vec3d2.multiply(d)).expand(1.0, 1.0, 1.0); - assert MinecraftClient.getInstance().cameraEntity != null; - EntityHitResult entityHitResult = ProjectileUtil.raycast(MinecraftClient.getInstance().cameraEntity, vec3d, vec3d3, box, entity -> !entity.isSpectator() && entity.canHit(), e); - - if (entityHitResult != null && entityHitResult.getEntity() instanceof LivingEntity livingEntity1){ - return livingEntity1 == livingEntity; - } - return false; - } - - - public static boolean isInvalid(Entity entity){ - return (entity == null - || !entity.isAlive() - || !entity.isLiving() - || entity.isRegionUnloaded() - || !(entity instanceof LivingEntity) - || MinecraftClient.getInstance().player == null - || MinecraftClient.getInstance().player.getVehicle() == entity - || entity.isInvisibleTo(MinecraftClient.getInstance().player)); - } - private static Entity getEntityFromUUID(UUID uuid, ClientWorld world) { - for (Entity entity : world.getEntities()) { - if (entity.getUuid().equals(uuid)) { - return entity; - } - } - return null; - } -} - diff --git a/remappedSrc/io/github/adytech99/healthindicators/commands/ModCommands.java b/remappedSrc/io/github/adytech99/healthindicators/commands/ModCommands.java deleted file mode 100644 index abe6d5d..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/commands/ModCommands.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.github.adytech99.healthindicators.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.DoubleArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import io.github.adytech99.healthindicators.HealthIndicatorsMod; -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import io.github.adytech99.healthindicators.util.ConfigUtils; -import io.github.adytech99.healthindicators.util.Maths; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.text.Text; - -public class ModCommands { - @Environment(EnvType.CLIENT) - public static void registerCommands(){ - ClientCommandRegistrationCallback.EVENT.register(ModCommands::OffsetCommand); - ClientCommandRegistrationCallback.EVENT.register(ModCommands::OpenModMenuConfigCommand); - } - - private static void OffsetCommand(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - fabricClientCommandSourceCommandDispatcher.register(ClientCommandManager.literal("healthindicators") - .then(ClientCommandManager.argument("operation", StringArgumentType.string()) - .suggests((context, builder) -> { - builder.suggest("offset"); - return builder.buildFuture(); - }) - .then(ClientCommandManager.argument("offset", DoubleArgumentType.doubleArg()) - .executes(context -> { - ModConfig.HANDLER.instance().display_offset = DoubleArgumentType.getDouble(context, "offset"); - ModConfig.HANDLER.save(); - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - return 1; - })))); - } - - private static void OpenModMenuConfigCommand(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - fabricClientCommandSourceCommandDispatcher.register(ClientCommandManager.literal("healthindicators") - .executes(context -> { - HealthIndicatorsMod.openConfig(context.getSource().getClient()); - //client.player.sendMessage(Text.of(configScreen.toString())); - return 1; - })); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/config/Config.java b/remappedSrc/io/github/adytech99/healthindicators/config/Config.java deleted file mode 100644 index 7c445ee..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/config/Config.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import com.google.gson.Gson; -import io.github.adytech99.healthindicators.HealthIndicatorsMod; -import net.fabricmc.loader.api.FabricLoader; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; - -public class Config { - private static final Gson GSON = new Gson(); - - private static Config INSTANCE = new Config(); - - private boolean renderingEnabled = true; - private boolean overrideAllFiltersEnabled = false; - - public static boolean getRenderingEnabled() { - return INSTANCE.renderingEnabled; - } - - public static void setRenderingEnabled(boolean renderingEnabled) { - INSTANCE.renderingEnabled = renderingEnabled; - save(); - } - - public static boolean getOverrideAllFiltersEnabled() { - return INSTANCE.overrideAllFiltersEnabled; - } - - public static void setOverrideAllFiltersEnabled(boolean overrideAllFiltersEnabled) { - INSTANCE.overrideAllFiltersEnabled = overrideAllFiltersEnabled; - save(); - } - - - public static void load() { - try (BufferedReader reader = new BufferedReader(new FileReader(FabricLoader.getInstance().getConfigDir().resolve(HealthIndicatorsMod.CONFIG_FILE).toFile()))) { - Config config = GSON.fromJson(reader, Config.class); - if (config != null) { - INSTANCE = config; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void save() { - try (BufferedWriter writer = new BufferedWriter(new FileWriter(FabricLoader.getInstance().getConfigDir().resolve(HealthIndicatorsMod.CONFIG_FILE).toFile()))) { - GSON.toJson(INSTANCE, writer); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/config/ModConfig.java b/remappedSrc/io/github/adytech99/healthindicators/config/ModConfig.java deleted file mode 100644 index 54585cf..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/config/ModConfig.java +++ /dev/null @@ -1,209 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; -import dev.isxander.yacl3.config.v2.api.SerialEntry; -import dev.isxander.yacl3.config.v2.api.autogen.*; -import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; -import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; -import java.nio.file.Path; - -public class ModConfig { - public static final Path CONFIG_PATH = FabricLoader.getInstance().getConfigDir().resolve("health_indicators_config.json"); - - public static final ConfigClassHandler HANDLER = ConfigClassHandler.createBuilder(ModConfig.class) - .id(Identifier.of("health-indicators", "config")) - .serializer(config -> GsonConfigSerializerBuilder.create(config) - .setPath(CONFIG_PATH) - .build()) - .build(); - - @Label - @AutoGen(category = "filters") - private final Text filtersProTip = Text.literal("Pro Tip: You can temporarily override the below criteria and force health display for all living entities by holding the Right-Arrow key (customizable)").formatted(Formatting.GOLD); - - @Label - //@AutoGen(category = "filters", group = "entity_type") - private final Text filtersTypeLabel = Text.literal("Enable health display based on entity type").formatted(Formatting.BOLD, Formatting.AQUA); - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean passive_mobs = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean hostile_mobs = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @MasterTickBox(value = "override_players") - public boolean players = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean self = false; - - @Label - //@AutoGen(category = "filters", group = "advanced") - private final Text filtersAdvancedLabel = Text.literal("Enable health display based on additional misc. criteria").formatted(Formatting.BOLD, Formatting.AQUA); - - /*@Label - @AutoGen(category = "filters", group = "advanced") - //private final Text after_attack_label = Text.literal("Settings for the 'Show on attack' criteria:").formatted(Formatting.ITALIC); - private final Text after_attack_label = Text.literal(" ").formatted(Formatting.ITALIC);*/ - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = {"override_players", "time_after_hit"}) - public boolean after_attack = false; - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @IntSlider(min = 0, max = 120, step = 1) - public int time_after_hit = 60; - - @Label - @AutoGen(category = "filters", group = "advanced") - //private final Text damaged_only_label = Text.literal("Settings for the 'damaged entity' criteria:").formatted(Formatting.ITALIC); - private final Text damaged_only_label = Text.literal(" ").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = "override_players") - public boolean damaged_only = false; - - @Label - @AutoGen(category = "filters", group = "advanced") - //private final Text on_crosshair_label = Text.literal("Settings for the 'looking at entity' criteria:").formatted(Formatting.ITALIC); - private final Text on_crosshair_label = Text.literal(" ").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = {"override_players", "reach"}) - public boolean looking_at = false; - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @IntField(min = 0, max = 1024) - public int reach = 3; - - @Label - @AutoGen(category = "filters", group = "advanced") - private final Text override_players_label = Text.literal("Overrides").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @TickBox - public boolean override_players = true; - - - //APPEARANCE - - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @EnumCycler - public HealthDisplayTypeEnum indicator_type = HealthDisplayTypeEnum.HEARTS; - - @AutoGen(category = "appearance", group = "indicator_type") - @Label - private final Text heart_type_settings_label = Text.literal("Settings for the heart-type indicator"); - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @IntField - public int hearts_per_row = 10; - - @AutoGen(category = "appearance", group = "indicator_type") - @Label - private final Text number_type_settings_label = Text.literal("Settings for the number-type indicator"); - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @ColorField - public Color number_color = Color.RED; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @Boolean - public boolean render_number_display_shadow = false; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @MasterTickBox(value = {"number_display_background_color"}) - public boolean render_number_display_background_color = true; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @ColorField - public Color number_display_background_color = Color.BLACK; - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @DoubleField - public double display_offset = 0; - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @DoubleSlider(min = 0.0, max = 10.0, step = 0.5) - public double offset_step_size = 1; - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @Boolean - public boolean force_higher_offset_for_players = false; - - - //MESSAGES & COMMANDS - - - @SerialEntry - @AutoGen(category = "messages", group = "messages_appearance") - @EnumCycler - public MessageTypeEnum message_type = MessageTypeEnum.ACTIONBAR; - - @SerialEntry - @AutoGen(category = "messages", group = "messages_appearance") - @Boolean(colored = true) - public boolean colored_messages = true; - - @Label - @AutoGen(category = "messages", group = "commands") - private final Text commandsRestartWarning = Text.literal("For this section, a restart is required to apply any modifications").formatted(Formatting.RED); - - @SerialEntry - @AutoGen(category = "messages", group = "commands") - @Boolean(formatter = Boolean.Formatter.YES_NO) - public boolean enable_commands = true; - - /*@SerialEntry - @AutoGen(category = "appearance", group = "heart_offset") - @Boolean - public boolean hearts_clipping = true;*/ - - - - - - public static Screen createScreen(@Nullable Screen parent) { - return HANDLER.generateGui().generateScreen(parent); - } - public Screen createConfigScreen(Screen parent) { - if (FabricLoader.getInstance().isModLoaded("yet_another_config_lib_v3")) { - return createScreen(parent); - } - return null; - } - -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java b/remappedSrc/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java deleted file mode 100644 index aad78ed..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import com.terraformersmc.modmenu.api.ConfigScreenFactory; -import com.terraformersmc.modmenu.api.ModMenuApi; - - -public class ModMenuAPIImpl implements ModMenuApi { - @Override - public ConfigScreenFactory getModConfigScreenFactory() { - return ModConfig::createScreen; - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java b/remappedSrc/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java deleted file mode 100644 index ac05e0a..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import dev.isxander.yacl3.api.NameableEnum; -import net.minecraft.text.Text; - -public enum HealthDisplayTypeEnum implements NameableEnum { - NUMBER("Number"), - HEARTS("Hearts"); - - private final String displayName; - HealthDisplayTypeEnum(String displayName) { - this.displayName = displayName; - } - - @Override - public Text getDisplayName() { - return Text.of(displayName); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java b/remappedSrc/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java deleted file mode 100644 index ae6232b..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import net.minecraft.util.Identifier; - -public enum HeartTypeEnum { - EMPTY("container"), - RED_FULL("full"), - RED_HALF("half"), - YELLOW_FULL("absorbing_full"), - YELLOW_HALF("absorbing_half"); - - public final Identifier icon; - - HeartTypeEnum(String heartIcon) { - icon = Identifier.of("minecraft", "textures/gui/sprites/hud/heart/" + heartIcon + ".png"); - } -} \ No newline at end of file diff --git a/remappedSrc/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java b/remappedSrc/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java deleted file mode 100644 index add321c..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import dev.isxander.yacl3.api.NameableEnum; -import net.minecraft.text.Text; - -public enum MessageTypeEnum implements NameableEnum { - ACTIONBAR("Actionbar"), - CHAT("Chat"), - NONE("None"); - - private final String displayName; - MessageTypeEnum(String displayName) { - this.displayName = displayName; - } - - @Override - public Text getDisplayName() { - return Text.of(displayName); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java b/remappedSrc/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java deleted file mode 100644 index 5f2773e..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.github.adytech99.healthindicators.mixin; - -import io.github.adytech99.healthindicators.RenderTracker; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(LivingEntity.class) -public class EntityDamageMixin { - @Inject(method = "onDamaged", at = @At("HEAD")) - private void onEntityDamage(DamageSource damageSource, CallbackInfo callbackInfo) { - RenderTracker.onDamage(damageSource, ((LivingEntity) (Object) this)); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/mixin/NewEntityRendererMixin.java b/remappedSrc/io/github/adytech99/healthindicators/mixin/NewEntityRendererMixin.java deleted file mode 100644 index 58bc6d5..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/mixin/NewEntityRendererMixin.java +++ /dev/null @@ -1,191 +0,0 @@ -package io.github.adytech99.healthindicators.mixin; - -import com.mojang.blaze3d.systems.RenderSystem; -import io.github.adytech99.healthindicators.enums.HeartTypeEnum; -import io.github.adytech99.healthindicators.RenderTracker; -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum; -import io.github.adytech99.healthindicators.config.ModConfig; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.render.*; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.scoreboard.ScoreboardDisplaySlot; -import net.minecraft.util.math.MathHelper; -import org.joml.Matrix4f; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - - -@Mixin(LivingEntityRenderer.class) -public abstract class NewEntityRendererMixin> extends EntityRenderer implements FeatureRendererContext { - - @Unique - private final MinecraftClient client = MinecraftClient.getInstance(); - protected NewEntityRendererMixin(EntityRendererFactory.Context ctx) { - super(ctx); - } - - @Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("TAIL")) - public void render(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, CallbackInfo ci) { - - if (RenderTracker.isInUUIDS(livingEntity) || (Config.getOverrideAllFiltersEnabled() && !RenderTracker.isInvalid(livingEntity))) { - if((ModConfig.HANDLER.instance().looking_at && !RenderTracker.isTargeted(livingEntity)) - && (!Config.getOverrideAllFiltersEnabled() && !(livingEntity instanceof PlayerEntity && ModConfig.HANDLER.instance().override_players)) - && livingEntity != client.player) return; - - if(ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.HEARTS) renderHearts(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); - else if(ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.NUMBER) renderNumber(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light);; - - } - } - - @Unique private void renderHearts(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light){ - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder vertexConsumer; - - double d = this.dispatcher.getSquaredDistanceToCamera(livingEntity); - - int healthRed = MathHelper.ceil(livingEntity.getHealth()); - int maxHealth = MathHelper.ceil(livingEntity.getMaxHealth()); - int healthYellow = MathHelper.ceil(livingEntity.getAbsorptionAmount()); - - int heartsRed = MathHelper.ceil(healthRed / 2.0F); - boolean lastRedHalf = (healthRed & 1) == 1; - int heartsNormal = MathHelper.ceil(maxHealth / 2.0F); - int heartsYellow = MathHelper.ceil(healthYellow / 2.0F); - boolean lastYellowHalf = (healthYellow & 1) == 1; - int heartsTotal = heartsNormal + heartsYellow; - - int heartsPerRow = ModConfig.HANDLER.instance().hearts_per_row; - int pixelsTotal = Math.min(heartsTotal, heartsPerRow) * 8 + 1; - float maxX = pixelsTotal / 2.0f; - - double heartDensity = 50F - (Math.max(4F - Math.ceil((double) heartsTotal / heartsPerRow), -3F) * 5F); - double h = 0; - - for (int isDrawingEmpty = 0; isDrawingEmpty < 2; isDrawingEmpty++) { - for (int heart = 0; heart < heartsTotal; heart++) { - if (heart % heartsPerRow == 0) { - h = heart / heartDensity; - } - - matrixStack.push(); - vertexConsumer = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE); - float pixelSize = 0.025F; - - matrixStack.translate(0, livingEntity.getHeight() + 0.5f + h, 0); - if ((this.hasLabel(livingEntity) - || (ModConfig.HANDLER.instance().force_higher_offset_for_players && livingEntity instanceof PlayerEntity && livingEntity != client.player)) - && d <= 4096.0) { - matrixStack.translate(0.0D, 9.0F * 1.15F * pixelSize, 0.0D); - if (d < 100.0 && livingEntity instanceof PlayerEntity && livingEntity.getEntityWorld().getScoreboard().getObjectiveForSlot(ScoreboardDisplaySlot.BELOW_NAME) != null) { - matrixStack.translate(0.0D, 9.0F * 1.15F * pixelSize, 0.0D); - } - } - - matrixStack.multiply(this.dispatcher.getRotation()); - matrixStack.scale(pixelSize, pixelSize, pixelSize); - matrixStack.translate(0, ModConfig.HANDLER.instance().display_offset, 0); - Matrix4f model = matrixStack.peek().getPositionMatrix(); - - float x = maxX - (heart % heartsPerRow) * 8; - - if (isDrawingEmpty == 0) { - drawHeart(model, vertexConsumer, x, HeartTypeEnum.EMPTY); - } else { - HeartTypeEnum type; - if (heart < heartsRed) { - type = HeartTypeEnum.RED_FULL; - if (heart == heartsRed - 1 && lastRedHalf) { - type = HeartTypeEnum.RED_HALF; - } - } else if (heart < heartsNormal) { - type = HeartTypeEnum.EMPTY; - } else { - type = HeartTypeEnum.YELLOW_FULL; - if (heart == heartsTotal - 1 && lastYellowHalf) { - type = HeartTypeEnum.YELLOW_HALF; - } - } - if (type != HeartTypeEnum.EMPTY) { - drawHeart(model, vertexConsumer, x, type); - } - } - //tessellator.draw(); - BufferRenderer.drawWithGlobalProgram(vertexConsumer.end()); - matrixStack.pop(); - } - } - } - - - @Unique - private void renderNumber(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light){ - double d = this.dispatcher.getSquaredDistanceToCamera(livingEntity); - int health = MathHelper.ceil(livingEntity.getHealth()); - int maxHealth = MathHelper.ceil(livingEntity.getMaxHealth()); - int absorption = MathHelper.ceil(livingEntity.getAbsorptionAmount()); - - String healthText = health+absorption + " / " + maxHealth; - - matrixStack.push(); - float scale = 0.025F; - - matrixStack.translate(0, livingEntity.getHeight() + 0.5f, 0); - if ((this.hasLabel(livingEntity) - || (ModConfig.HANDLER.instance().force_higher_offset_for_players && livingEntity instanceof PlayerEntity && livingEntity != client.player)) - && d <= 4096.0) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - if (d < 100.0 && livingEntity instanceof PlayerEntity && livingEntity.getEntityWorld().getScoreboard().getObjectiveForSlot(ScoreboardDisplaySlot.BELOW_NAME) != null) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - } - } - - matrixStack.multiply(this.dispatcher.getRotation()); - matrixStack.scale(-scale, -scale, scale); - matrixStack.translate(0, -ModConfig.HANDLER.instance().display_offset, 0); - - TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer; - float x = -textRenderer.getWidth(healthText) / 2.0f; - Matrix4f model = matrixStack.peek().getPositionMatrix(); - - textRenderer.draw(healthText, x, 0, ModConfig.HANDLER.instance().number_color.getRGB(), ModConfig.HANDLER.instance().render_number_display_shadow, model, vertexConsumerProvider, TextRenderer.TextLayerType.NORMAL, ModConfig.HANDLER.instance().render_number_display_background_color ? ModConfig.HANDLER.instance().number_display_background_color.getRGB() : 0, light); - matrixStack.pop(); - } - - @Unique - private static void drawHeart(Matrix4f model, VertexConsumer vertexConsumer, float x, HeartTypeEnum type) { - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - RenderSystem.setShaderTexture(0, type.icon); - RenderSystem.enableDepthTest(); - - float minU = 0F; - float maxU = 1F; - float minV = 0F; - float maxV = 1F; - - float heartSize = 9F; - - drawVertex(model, vertexConsumer, x, 0F - heartSize, minU, maxV); - drawVertex(model, vertexConsumer, x - heartSize, 0F - heartSize, maxU, maxV); - drawVertex(model, vertexConsumer, x - heartSize, 0F, maxU, minV); - drawVertex(model, vertexConsumer, x, 0F, minU, minV); - } - - @Unique - private static void drawVertex(Matrix4f model, VertexConsumer vertices, float x, float y, float u, float v) { - vertices.vertex(model, x, y, 0.0F).texture(u, v); - //vertices.vertex(model, x, y, 0.0F).texture(u, v).next(); - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/util/ConfigUtils.java b/remappedSrc/io/github/adytech99/healthindicators/util/ConfigUtils.java deleted file mode 100644 index 82ccbb0..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/util/ConfigUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.adytech99.healthindicators.util; - -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.text.Text; - -public class ConfigUtils { - public static void sendMessage(ClientPlayerEntity player, Text text){ - if(isSendMessage()) { - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - player.sendMessage(text, overlay); - } - } - public static void sendOverlayMessage(ClientPlayerEntity player, Text text) { - if (isSendMessage()){ - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - player.sendMessage(text, true); - } - } - public static boolean isSendMessage(){ - return ModConfig.HANDLER.instance().message_type != MessageTypeEnum.NONE; - } -} diff --git a/remappedSrc/io/github/adytech99/healthindicators/util/Maths.java b/remappedSrc/io/github/adytech99/healthindicators/util/Maths.java deleted file mode 100644 index efcc9ec..0000000 --- a/remappedSrc/io/github/adytech99/healthindicators/util/Maths.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.github.adytech99.healthindicators.util; - -public class Maths { - public static double truncate(double number, int places) { - return Math.floor(number * Math.pow(10, places)) / Math.pow(10, places); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/HealthIndicatorsMod.java b/src/main/java/io/github/adytech99/healthindicators/HealthIndicatorsMod.java deleted file mode 100644 index cb2f95c..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/HealthIndicatorsMod.java +++ /dev/null @@ -1,159 +0,0 @@ -package io.github.adytech99.healthindicators; - -import com.terraformersmc.modmenu.ModMenu; -import io.github.adytech99.healthindicators.commands.ModCommands; -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import io.github.adytech99.healthindicators.util.ConfigUtils; -import io.github.adytech99.healthindicators.util.Maths; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Environment(EnvType.CLIENT) -public class HealthIndicatorsMod implements ClientModInitializer { - public static final String MOD_ID = "healthindicators"; - public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); - public static final String CONFIG_FILE = "healthindicators.json"; - - public static final KeyBinding RENDERING_ENABLED = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".renderingEnabled", - InputUtil.GLFW_KEY_LEFT, - "key.categories." + MOD_ID - )); - - public static final KeyBinding ARMOR_RENDERING_ENABLED = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".armorRenderingEnabled", - InputUtil.GLFW_KEY_RIGHT_SHIFT, - "key.categories." + MOD_ID - )); - - public static final KeyBinding OVERRIDE_ALL_FILTERS = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".overrideAllFilters", - InputUtil.GLFW_KEY_RIGHT, - "key.categories." + MOD_ID - )); - public static final KeyBinding INCREASE_HEART_OFFSET = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".increaseHeartOffset", - InputUtil.GLFW_KEY_UP, - "key.categories." + MOD_ID - )); - public static final KeyBinding DECREASE_HEART_OFFSET = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".decreaseHeartOffset", - InputUtil.GLFW_KEY_DOWN, - "key.categories." + MOD_ID - )); - - public static final KeyBinding OPEN_MOD_MENU_CONFIG = KeyBindingHelper.registerKeyBinding(new KeyBinding( - "key." + MOD_ID + ".openModMenuConfig", - InputUtil.GLFW_KEY_I, - "key.categories." + MOD_ID - )); - - - private boolean changed = false; - private static boolean openConfig = false; - - public static void openConfig(MinecraftClient client){ - openConfig = client.world != null; - } - - @Override - public void onInitializeClient() { - ModConfig.HANDLER.load(); - Config.load(); - if(ModConfig.HANDLER.instance().enable_commands) ModCommands.registerCommands(); - ClientTickEvents.END_CLIENT_TICK.register(RenderTracker::tick); - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if(openConfig){ - Screen configScreen = ModMenu.getConfigScreen(HealthIndicatorsMod.MOD_ID, client.currentScreen); - client.setScreen(configScreen); - openConfig = false; - } - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - while (RENDERING_ENABLED.wasPressed()) { - Config.setRenderingEnabled(!Config.getHeartsRenderingEnabled()); - if (client.player != null) { - Formatting formatting; - if(ModConfig.HANDLER.instance().colored_messages) formatting = Config.getHeartsRenderingEnabled() ? Formatting.GREEN : Formatting.RED; - else formatting = Formatting.WHITE; - ConfigUtils.sendMessage(client.player, Text.literal((Config.getHeartsRenderingEnabled() ? "Enabled" : "Disabled") + " Health Indicators").formatted(formatting)); - } - } - - while (ARMOR_RENDERING_ENABLED.wasPressed()) { - Config.setArmorRenderingEnabled(!Config.getArmorRenderingEnabled()); - if (client.player != null) { - Formatting formatting; - if(ModConfig.HANDLER.instance().colored_messages) formatting = Config.getArmorRenderingEnabled() ? Formatting.GREEN : Formatting.RED; - else formatting = Formatting.WHITE; - ConfigUtils.sendMessage(client.player, Text.literal((Config.getArmorRenderingEnabled() ? "Enabled" : "Disabled") + " Armor Indicators").formatted(formatting)); - } - } - - while (INCREASE_HEART_OFFSET.wasPressed()) { - ModConfig.HANDLER.instance().display_offset = (ModConfig.HANDLER.instance().display_offset + ModConfig.HANDLER.instance().offset_step_size); - changed = true; - if (client.player != null) { - ConfigUtils.sendMessage(client.player, Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - } - } - - while (DECREASE_HEART_OFFSET.wasPressed()) { - ModConfig.HANDLER.instance().display_offset = (ModConfig.HANDLER.instance().display_offset - ModConfig.HANDLER.instance().offset_step_size); - changed = true; - if (client.player != null) { - ConfigUtils.sendMessage(client.player, Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - } - } - if (OVERRIDE_ALL_FILTERS.isPressed()) { - Config.setOverrideAllFiltersEnabled(true); - if (client.player != null) { - ConfigUtils.sendOverlayMessage(client.player, Text.literal( " Config Criteria " + (Config.getOverrideAllFiltersEnabled() ? "Temporarily Overridden" : "Re-implemented"))); - } - } - else if(Config.getOverrideAllFiltersEnabled()) { - Config.setOverrideAllFiltersEnabled(false); - client.inGameHud.setOverlayMessage(Text.literal(""), false); - } - if(OPEN_MOD_MENU_CONFIG.isPressed()){ - openConfig(client); - } - }); - - ClientEntityEvents.ENTITY_UNLOAD.register((entity, world) -> { - RenderTracker.removeFromUUIDS(entity); - }); - - ClientTickEvents.START_CLIENT_TICK.register(client -> { - if(client.world == null) return; - if(changed && client.world.getTime() % 200 == 0){ - saveModConfig(); - changed = false; - } - }); - - ClientLifecycleEvents.CLIENT_STOPPING.register(client -> { - saveModConfig(); - }); - - LOGGER.info("Never be heartless!"); - } - - public void saveModConfig(){ - ModConfig.HANDLER.save(); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/RenderTracker.java b/src/main/java/io/github/adytech99/healthindicators/RenderTracker.java deleted file mode 100644 index 533a304..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/RenderTracker.java +++ /dev/null @@ -1,166 +0,0 @@ -package io.github.adytech99.healthindicators; - -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.config.ModConfig; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.decoration.ArmorStandEntity; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileUtil; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; - -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -public class RenderTracker { - private static final ConcurrentHashMap UUIDS = new ConcurrentHashMap<>(); - - public static boolean after_attack = ModConfig.HANDLER.instance().after_attack; - - public static void tick(MinecraftClient client){ - if(client.player == null || client.world == null) return; - if(Config.getRenderingEnabled()) { - for (Entity entity : client.world.getEntities()) { - if (entity instanceof LivingEntity livingEntity && (satisfiesAdvancedCriteria(client.player, livingEntity) || overridePlayers(livingEntity))) { - addToUUIDS(livingEntity); - } else removeFromUUIDS(entity.getUuid()); - } - } - trimEntities(client.world); - if(ModConfig.HANDLER.instance().after_attack != after_attack) - if(ModConfig.HANDLER.instance().after_attack){ - UUIDS.clear(); - } - after_attack = ModConfig.HANDLER.instance().after_attack; - } - - public static void onDamage(DamageSource damageSource, LivingEntity livingEntity) { - if(damageSource.getAttacker() instanceof PlayerEntity){ - assert MinecraftClient.getInstance().world != null; - if (ModConfig.HANDLER.instance().after_attack - && livingEntity instanceof LivingEntity - && RenderTracker.isEntityTypeAllowed(livingEntity, MinecraftClient.getInstance().player)) { - - if(!addToUUIDS(livingEntity)){ - UUIDS.replace(livingEntity.getUuid(), (ModConfig.HANDLER.instance().time_after_hit * 20)); - } - } - } - } - - - public static void trimEntities(ClientWorld world) { - // Check if there's a need to trim entries - Iterator> iterator = UUIDS.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - entry.setValue(entry.getValue() - 1); - if (entry.getValue() <= 0) { - iterator.remove(); // Safe removal during iteration - } - } - - // Remove invalid entities - UUIDS.entrySet().removeIf(entry -> isInvalid(getEntityFromUUID(entry.getKey(), world))|| !Config.getRenderingEnabled() ); - if(UUIDS.size() >= 1536) UUIDS.clear(); - } - - - public static void removeFromUUIDS(Entity entity){ - UUIDS.remove(entity.getUuid()); - } - public static void removeFromUUIDS(UUID uuid){ - UUIDS.remove(uuid); - } - - public static boolean addToUUIDS(LivingEntity livingEntity){ - if(!UUIDS.containsKey(livingEntity.getUuid())){ - UUIDS.put(livingEntity.getUuid(), ModConfig.HANDLER.instance().after_attack ? (ModConfig.HANDLER.instance().time_after_hit * 20) : 2400); - return true; - } - else return false; - } - - public static boolean isInUUIDS(LivingEntity livingEntity){ - return UUIDS.containsKey(livingEntity.getUuid()); - } - - public static boolean overridePlayers(LivingEntity livingEntity){ - return (ModConfig.HANDLER.instance().override_players && livingEntity instanceof PlayerEntity && livingEntity != MinecraftClient.getInstance().player) - || (livingEntity == MinecraftClient.getInstance().player && ModConfig.HANDLER.instance().self); - } - - public static boolean isEntityTypeAllowed(LivingEntity livingEntity, PlayerEntity self){ - if(!ModConfig.HANDLER.instance().passive_mobs && livingEntity instanceof PassiveEntity) return false; - if(!ModConfig.HANDLER.instance().hostile_mobs && livingEntity instanceof HostileEntity) return false; - if(!ModConfig.HANDLER.instance().players && livingEntity instanceof PlayerEntity) return false; - if(!ModConfig.HANDLER.instance().self && livingEntity == self) return false; - return !(livingEntity instanceof ArmorStandEntity); - } - - public static boolean satisfiesAdvancedCriteria(ClientPlayerEntity player, LivingEntity livingEntity){ - if(!isEntityTypeAllowed(livingEntity, player)) return false; //Entity Types - if(!UUIDS.containsKey(livingEntity.getUuid()) && ModConfig.HANDLER.instance().after_attack) return false; //Damaged by Player, key should have been added by separate means. Necessary because removal check is done by this method. - if(livingEntity.getHealth() == livingEntity.getMaxHealth() && ModConfig.HANDLER.instance().damaged_only && livingEntity.getAbsorptionAmount() <= 0) return false; //Damaged by Any Reason - if(!isTargeted(livingEntity) && ModConfig.HANDLER.instance().looking_at) return false; - - return !isInvalid(livingEntity); - } - - public static boolean isTargeted(LivingEntity livingEntity){ - Entity camera = MinecraftClient.getInstance().cameraEntity; - double d = ModConfig.HANDLER.instance().reach; - double e = MathHelper.square(d); - Vec3d vec3d = camera.getCameraPosVec(0); - HitResult hitResult = camera.raycast(d, 0, false); - double f = hitResult.getPos().squaredDistanceTo(vec3d); - if (hitResult.getType() != HitResult.Type.MISS) { - e = f; - d = Math.sqrt(e); - } - Vec3d vec3d2 = camera.getRotationVec(0); - Vec3d vec3d3 = vec3d.add(vec3d2.x * d, vec3d2.y * d, vec3d2.z * d); - float g = 1.0f; - Box box = camera.getBoundingBox().stretch(vec3d2.multiply(d)).expand(1.0, 1.0, 1.0); - assert MinecraftClient.getInstance().cameraEntity != null; - EntityHitResult entityHitResult = ProjectileUtil.raycast(MinecraftClient.getInstance().cameraEntity, vec3d, vec3d3, box, entity -> !entity.isSpectator() && entity.canHit(), e); - - if (entityHitResult != null && entityHitResult.getEntity() instanceof LivingEntity livingEntity1){ - return livingEntity1 == livingEntity; - } - return false; - } - - - public static boolean isInvalid(Entity entity){ - return (entity == null - || !entity.isAlive() - || !entity.isLiving() - || entity.isRegionUnloaded() - || !(entity instanceof LivingEntity) - || MinecraftClient.getInstance().player == null - || MinecraftClient.getInstance().player.getVehicle() == entity - || entity.isInvisibleTo(MinecraftClient.getInstance().player)); - } - private static Entity getEntityFromUUID(UUID uuid, ClientWorld world) { - for (Entity entity : world.getEntities()) { - if (entity.getUuid().equals(uuid)) { - return entity; - } - } - return null; - } -} - diff --git a/src/main/java/io/github/adytech99/healthindicators/commands/ModCommands.java b/src/main/java/io/github/adytech99/healthindicators/commands/ModCommands.java deleted file mode 100644 index 88a4180..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/commands/ModCommands.java +++ /dev/null @@ -1,103 +0,0 @@ -package io.github.adytech99.healthindicators.commands; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.arguments.DoubleArgumentType; -import com.mojang.brigadier.arguments.StringArgumentType; -import io.github.adytech99.healthindicators.HealthIndicatorsMod; -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum; -import io.github.adytech99.healthindicators.util.ConfigUtils; -import io.github.adytech99.healthindicators.util.Maths; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.text.Text; - -public class ModCommands { - @Environment(EnvType.CLIENT) - public static void registerCommands(){ - ClientCommandRegistrationCallback.EVENT.register(ModCommands::configCommands); - ClientCommandRegistrationCallback.EVENT.register(ModCommands::openModMenuCommand); - //ClientCommandRegistrationCallback.EVENT.register(ModCommands::IndicatorTypeCommand); - } - - private static void configCommands(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - fabricClientCommandSourceCommandDispatcher.register(ClientCommandManager.literal("healthindicators") - .then(ClientCommandManager.literal("offset") - .then(ClientCommandManager.argument("offset", DoubleArgumentType.doubleArg()) - .executes(context -> { - ModConfig.HANDLER.instance().display_offset = DoubleArgumentType.getDouble(context, "offset"); - ModConfig.HANDLER.save(); - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Set heart offset to " + Maths.truncate(ModConfig.HANDLER.instance().display_offset,2))); - return 1; - }))) - - .then(ClientCommandManager.literal("indicator-type") - .then(ClientCommandManager.argument("indicator_type", StringArgumentType.string()) - .suggests((context, builder) -> { - builder.suggest("heart"); - builder.suggest("number"); - return builder.buildFuture(); - }) - .executes(context -> { - HealthDisplayTypeEnum displayTypeEnum; - if (StringArgumentType.getString(context, "indicator_type").equals("heart")) { - displayTypeEnum = HealthDisplayTypeEnum.HEARTS; - } else if (StringArgumentType.getString(context, "indicator_type").equals("number")) { - displayTypeEnum = HealthDisplayTypeEnum.NUMBER; - } else { - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Unknown argument, please try again.")); - return 1; - } - - ModConfig.HANDLER.instance().indicator_type = displayTypeEnum; - ModConfig.HANDLER.save(); - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Set display type to " + ModConfig.HANDLER.instance().indicator_type)); - return 1; - }))) - ); - } - - private static void IndicatorTypeCommand(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - fabricClientCommandSourceCommandDispatcher.register(ClientCommandManager.literal("healthindicators") - .then(ClientCommandManager.argument("operation", StringArgumentType.string()) - .suggests((context, builder) -> { - builder.suggest("indicator_type"); - return builder.buildFuture(); - }) - .then(ClientCommandManager.argument("indicator_type", StringArgumentType.string()) - .suggests((context, builder) -> { - builder.suggest("heart"); - builder.suggest("number"); - return builder.buildFuture(); - }) - .executes(context -> { - HealthDisplayTypeEnum displayTypeEnum; - if(StringArgumentType.getString(context, "indicator_type").equals("heart")){ - displayTypeEnum = HealthDisplayTypeEnum.HEARTS; - } else if (StringArgumentType.getString(context, "indicator_type").equals("number")) { - displayTypeEnum = HealthDisplayTypeEnum.NUMBER; - } - else { - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Unknown argument, please try again.")); - return 1; - } - - ModConfig.HANDLER.instance().indicator_type = displayTypeEnum; - ModConfig.HANDLER.save(); - ConfigUtils.sendMessage(context.getSource().getPlayer(), Text.literal("Set display type to " + ModConfig.HANDLER.instance().indicator_type)); - return 1; - })))); - } - - private static void openModMenuCommand(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - fabricClientCommandSourceCommandDispatcher.register(ClientCommandManager.literal("healthindicators") - .executes(context -> { - HealthIndicatorsMod.openConfig(context.getSource().getClient()); - return 1; - })); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/config/Config.java b/src/main/java/io/github/adytech99/healthindicators/config/Config.java deleted file mode 100644 index 7d42288..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/config/Config.java +++ /dev/null @@ -1,70 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import com.google.gson.Gson; -import io.github.adytech99.healthindicators.HealthIndicatorsMod; -import net.fabricmc.loader.api.FabricLoader; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; - -public class Config { - private static final Gson GSON = new Gson(); - - private static Config INSTANCE = new Config(); - - private boolean heartsRenderingEnabled = true; - private boolean armorRenderingEnabled = true; - private boolean overrideAllFiltersEnabled = false; - - public static boolean getRenderingEnabled(){ - return INSTANCE.heartsRenderingEnabled || INSTANCE.armorRenderingEnabled; - } - - public static boolean getHeartsRenderingEnabled() { - return INSTANCE.heartsRenderingEnabled; - } - - public static void setRenderingEnabled(boolean renderingEnabled) { - INSTANCE.heartsRenderingEnabled = renderingEnabled; - save(); - } - - public static boolean getArmorRenderingEnabled() { - return INSTANCE.armorRenderingEnabled; - } - public static void setArmorRenderingEnabled(boolean armorRenderingEnabled) { - INSTANCE.armorRenderingEnabled = armorRenderingEnabled; - save(); - } - - public static boolean getOverrideAllFiltersEnabled() { - return INSTANCE.overrideAllFiltersEnabled; - } - - public static void setOverrideAllFiltersEnabled(boolean overrideAllFiltersEnabled) { - INSTANCE.overrideAllFiltersEnabled = overrideAllFiltersEnabled; - save(); - } - - - public static void load() { - try (BufferedReader reader = new BufferedReader(new FileReader(FabricLoader.getInstance().getConfigDir().resolve(HealthIndicatorsMod.CONFIG_FILE).toFile()))) { - Config config = GSON.fromJson(reader, Config.class); - if (config != null) { - INSTANCE = config; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void save() { - try (BufferedWriter writer = new BufferedWriter(new FileWriter(FabricLoader.getInstance().getConfigDir().resolve(HealthIndicatorsMod.CONFIG_FILE).toFile()))) { - GSON.toJson(INSTANCE, writer); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/config/ModConfig.java b/src/main/java/io/github/adytech99/healthindicators/config/ModConfig.java deleted file mode 100644 index 23ec879..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/config/ModConfig.java +++ /dev/null @@ -1,238 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; -import dev.isxander.yacl3.config.v2.api.SerialEntry; -import dev.isxander.yacl3.config.v2.api.autogen.Boolean; -import dev.isxander.yacl3.config.v2.api.autogen.*; -import dev.isxander.yacl3.config.v2.api.autogen.Label; -import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; -import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; -import java.nio.file.Path; - -public class ModConfig { - public static final Path CONFIG_PATH = FabricLoader.getInstance().getConfigDir().resolve("health_indicators_config.json"); - - public static final ConfigClassHandler HANDLER = ConfigClassHandler.createBuilder(ModConfig.class) - .id(Identifier.of("health-indicators", "config")) - .serializer(config -> GsonConfigSerializerBuilder.create(config) - .setPath(CONFIG_PATH) - .build()) - .build(); - - @Label - @AutoGen(category = "filters") - private final Text filtersProTip = Text.literal("Pro Tip: You can temporarily override the below criteria and force health display for all living entities by holding the Right-Arrow key (customizable)").formatted(Formatting.GOLD); - - @Label - //@AutoGen(category = "filters", group = "entity_type") - private final Text filtersTypeLabel = Text.literal("Enable health display based on entity type").formatted(Formatting.BOLD, Formatting.AQUA); - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean passive_mobs = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean hostile_mobs = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @MasterTickBox(value = "override_players") - public boolean players = true; - - @SerialEntry - @AutoGen(category = "filters", group = "entity_type") - @TickBox - public boolean self = false; - - @Label - //@AutoGen(category = "filters", group = "advanced") - private final Text filtersAdvancedLabel = Text.literal("Enable health display based on additional misc. criteria").formatted(Formatting.BOLD, Formatting.AQUA); - - /*@Label - @AutoGen(category = "filters", group = "advanced") - //private final Text after_attack_label = Text.literal("Settings for the 'Show on attack' criteria:").formatted(Formatting.ITALIC); - private final Text after_attack_label = Text.literal(" ").formatted(Formatting.ITALIC);*/ - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = {"override_players", "time_after_hit"}) - public boolean after_attack = false; - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @IntSlider(min = 0, max = 120, step = 1) - public int time_after_hit = 60; - - @Label - @AutoGen(category = "filters", group = "advanced") - //private final Text damaged_only_label = Text.literal("Settings for the 'damaged entity' criteria:").formatted(Formatting.ITALIC); - private final Text damaged_only_label = Text.literal(" ").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = "override_players") - public boolean damaged_only = false; - - @Label - @AutoGen(category = "filters", group = "advanced") - //private final Text on_crosshair_label = Text.literal("Settings for the 'looking at entity' criteria:").formatted(Formatting.ITALIC); - private final Text on_crosshair_label = Text.literal(" ").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @MasterTickBox(value = {"override_players", "reach"}) - public boolean looking_at = false; - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @IntField(min = 0, max = 1024) - public int reach = 3; - - @Label - @AutoGen(category = "filters", group = "advanced") - private final Text override_players_label = Text.literal("Overrides").formatted(Formatting.ITALIC); - - @SerialEntry - @AutoGen(category = "filters", group = "advanced") - @TickBox - public boolean override_players = true; - - - //APPEARANCE - - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @EnumCycler - public HealthDisplayTypeEnum indicator_type = HealthDisplayTypeEnum.HEARTS; - - @AutoGen(category = "appearance", group = "indicator_type") - @Label - private final Text heart_type_settings_label = Text.literal("Settings for the heart-type indicator"); - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @IntField - public int icons_per_row = 10; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @Boolean - public boolean use_vanilla_textures = false; - - @AutoGen(category = "appearance", group = "indicator_type") - @Label - private final Text number_type_settings_label = Text.literal("Settings for the number-type indicator"); - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @ColorField - public Color number_color = Color.RED; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @Boolean - public boolean render_number_display_shadow = false; - - /*@SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @MasterTickBox(value = {"number_display_background_color"})*/ - public boolean render_number_display_background_color = false; - - /*@SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @ColorField*/ - public Color number_display_background_color = Color.BLACK; - - @AutoGen(category = "appearance", group = "indicator_type") - @Label - private final Text common_type_settings_label = Text.literal("Common settings for all indicator types"); - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @MasterTickBox(value = {"max_health"}) - public boolean percentage_based_health = false; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @IntSlider(min = 1, max = 100, step = 1) - public int max_health = 20; - - @SerialEntry - @AutoGen(category = "appearance", group = "indicator_type") - @FloatSlider(min = 0.0f, max = 0.1f, step = 0.005f, format = "%.3f") - public float size = 0.025f; - - - - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @DoubleField - public double display_offset = 0; - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @DoubleSlider(min = 0.0, max = 10.0, step = 0.5) - public double offset_step_size = 1; - - @SerialEntry - @AutoGen(category = "appearance", group = "offset") - @Boolean - public boolean force_higher_offset_for_players = false; - - - //MESSAGES & COMMANDS - - - @SerialEntry - @AutoGen(category = "messages", group = "messages_appearance") - @EnumCycler - public MessageTypeEnum message_type = MessageTypeEnum.ACTIONBAR; - - @SerialEntry - @AutoGen(category = "messages", group = "messages_appearance") - @Boolean(colored = true) - public boolean colored_messages = true; - - @Label - @AutoGen(category = "messages", group = "commands") - private final Text commandsRestartWarning = Text.literal("For this section, a restart is required to apply any modifications").formatted(Formatting.RED); - - @SerialEntry - @AutoGen(category = "messages", group = "commands") - @Boolean(formatter = Boolean.Formatter.YES_NO) - public boolean enable_commands = true; - - /*@SerialEntry - @AutoGen(category = "appearance", group = "heart_offset") - @Boolean - public boolean hearts_clipping = true;*/ - - - - - - public static Screen createScreen(@Nullable Screen parent) { - return HANDLER.generateGui().generateScreen(parent); - } - public Screen createConfigScreen(Screen parent) { - if (FabricLoader.getInstance().isModLoaded("yet_another_config_lib_v3")) { - return createScreen(parent); - } - return null; - } - -} diff --git a/src/main/java/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java b/src/main/java/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java deleted file mode 100644 index aad78ed..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/config/ModMenuAPIImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.github.adytech99.healthindicators.config; - -import com.terraformersmc.modmenu.api.ConfigScreenFactory; -import com.terraformersmc.modmenu.api.ModMenuApi; - - -public class ModMenuAPIImpl implements ModMenuApi { - @Override - public ConfigScreenFactory getModConfigScreenFactory() { - return ModConfig::createScreen; - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/enums/ArmorTypeEnum.java b/src/main/java/io/github/adytech99/healthindicators/enums/ArmorTypeEnum.java deleted file mode 100644 index f944f0b..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/enums/ArmorTypeEnum.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import net.minecraft.util.Identifier; - -public enum ArmorTypeEnum { - FULL("armor_full"), - HALF("armor_half"), - EMPTY("armor_empty"); - - public final Identifier icon; - public final Identifier vanillaIcon; - - ArmorTypeEnum(String armorIcon) { - icon = Identifier.of("minecraft", "textures/gui/sprites/hud/" + armorIcon + ".png"); - vanillaIcon = Identifier.of("healthindicators", "textures/gui/armor/" + armorIcon + ".png"); - } -} \ No newline at end of file diff --git a/src/main/java/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java b/src/main/java/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java deleted file mode 100644 index ac05e0a..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/enums/HealthDisplayTypeEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import dev.isxander.yacl3.api.NameableEnum; -import net.minecraft.text.Text; - -public enum HealthDisplayTypeEnum implements NameableEnum { - NUMBER("Number"), - HEARTS("Hearts"); - - private final String displayName; - HealthDisplayTypeEnum(String displayName) { - this.displayName = displayName; - } - - @Override - public Text getDisplayName() { - return Text.of(displayName); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java b/src/main/java/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java deleted file mode 100644 index d7391b8..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/enums/HeartTypeEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import net.minecraft.util.Identifier; - -public enum HeartTypeEnum { - EMPTY("container"), - RED_FULL("full"), - RED_HALF("half"), - YELLOW_FULL("absorbing_full"), - YELLOW_HALF("absorbing_half"); - - public final Identifier icon; - public final Identifier vanillaIcon; - - HeartTypeEnum(String heartIcon) { - icon = Identifier.of("minecraft", "textures/gui/sprites/hud/heart/" + heartIcon + ".png"); - vanillaIcon = Identifier.of("healthindicators", "textures/gui/heart/" + heartIcon + ".png"); - } -} \ No newline at end of file diff --git a/src/main/java/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java b/src/main/java/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java deleted file mode 100644 index add321c..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/enums/MessageTypeEnum.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.adytech99.healthindicators.enums; - -import dev.isxander.yacl3.api.NameableEnum; -import net.minecraft.text.Text; - -public enum MessageTypeEnum implements NameableEnum { - ACTIONBAR("Actionbar"), - CHAT("Chat"), - NONE("None"); - - private final String displayName; - MessageTypeEnum(String displayName) { - this.displayName = displayName; - } - - @Override - public Text getDisplayName() { - return Text.of(displayName); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java b/src/main/java/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java deleted file mode 100644 index 5f2773e..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/mixin/EntityDamageMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.github.adytech99.healthindicators.mixin; - -import io.github.adytech99.healthindicators.RenderTracker; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(LivingEntity.class) -public class EntityDamageMixin { - @Inject(method = "onDamaged", at = @At("HEAD")) - private void onEntityDamage(DamageSource damageSource, CallbackInfo callbackInfo) { - RenderTracker.onDamage(damageSource, ((LivingEntity) (Object) this)); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/mixin/EntityRendererMixin.java b/src/main/java/io/github/adytech99/healthindicators/mixin/EntityRendererMixin.java deleted file mode 100644 index cc7f17c..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/mixin/EntityRendererMixin.java +++ /dev/null @@ -1,318 +0,0 @@ -package io.github.adytech99.healthindicators.mixin; - -import com.mojang.blaze3d.systems.RenderSystem; -import io.github.adytech99.healthindicators.RenderTracker; -import io.github.adytech99.healthindicators.config.Config; -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.ArmorTypeEnum; -import io.github.adytech99.healthindicators.enums.HealthDisplayTypeEnum; -import io.github.adytech99.healthindicators.enums.HeartTypeEnum; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.render.*; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.scoreboard.ScoreboardDisplaySlot; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import org.joml.Matrix4f; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - - -@Mixin(LivingEntityRenderer.class) -public abstract class EntityRendererMixin> extends EntityRenderer implements FeatureRendererContext { - - @Unique - private final MinecraftClient client = MinecraftClient.getInstance(); - protected EntityRendererMixin(EntityRendererFactory.Context ctx) { - super(ctx); - } - - @Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("TAIL")) - public void render(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, CallbackInfo ci) { - - if (RenderTracker.isInUUIDS(livingEntity) || (Config.getOverrideAllFiltersEnabled() && !RenderTracker.isInvalid(livingEntity))) { - /*if((!Config.getOverrideAllFiltersEnabled() && !(livingEntity instanceof PlayerEntity && ModConfig.HANDLER.instance().override_players)) - && livingEntity != client.player) return;*/ - if(Config.getHeartsRenderingEnabled() || Config.getOverrideAllFiltersEnabled()) { - if (ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.HEARTS) - renderHearts(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); - else if (ModConfig.HANDLER.instance().indicator_type == HealthDisplayTypeEnum.NUMBER) - renderNumber(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); - } - if(Config.getArmorRenderingEnabled() || Config.getOverrideAllFiltersEnabled()) renderArmorPoints(livingEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); - } - } - - @Unique private void renderHearts(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light){ - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder vertexConsumer; - - double d = this.dispatcher.getSquaredDistanceToCamera(livingEntity); - - int healthRed = MathHelper.ceil(livingEntity.getHealth()); - int maxHealth = MathHelper.ceil(livingEntity.getMaxHealth()); - int healthYellow = MathHelper.ceil(livingEntity.getAbsorptionAmount()); - - if(ModConfig.HANDLER.instance().percentage_based_health) { - healthRed = MathHelper.ceil(((float) healthRed /maxHealth) * ModConfig.HANDLER.instance().max_health); - maxHealth = MathHelper.ceil(ModConfig.HANDLER.instance().max_health); - healthYellow = MathHelper.ceil(livingEntity.getAbsorptionAmount()); - } - - int heartsRed = MathHelper.ceil(healthRed / 2.0F); - boolean lastRedHalf = (healthRed & 1) == 1; - int heartsNormal = MathHelper.ceil(maxHealth / 2.0F); - int heartsYellow = MathHelper.ceil(healthYellow / 2.0F); - boolean lastYellowHalf = (healthYellow & 1) == 1; - int heartsTotal = heartsNormal + heartsYellow; - - int heartsPerRow = ModConfig.HANDLER.instance().icons_per_row; - int pixelsTotal = Math.min(heartsTotal, heartsPerRow) * 8 + 1; - float maxX = pixelsTotal / 2.0f; - - double heartDensity = 50F - (Math.max(4F - Math.ceil((double) heartsTotal / heartsPerRow), -3F) * 5F); - double h = 0; - - for (int isDrawingEmpty = 0; isDrawingEmpty < 2; isDrawingEmpty++) { - for (int heart = 0; heart < heartsTotal; heart++) { - if (heart % heartsPerRow == 0) { - h = heart / heartDensity; - } - - matrixStack.push(); - float scale = ModConfig.HANDLER.instance().size; - vertexConsumer = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE); - - matrixStack.translate(0, livingEntity.getHeight() + 0.5f + h, 0); - if ((this.hasLabel(livingEntity) - || (ModConfig.HANDLER.instance().force_higher_offset_for_players && livingEntity instanceof PlayerEntity && livingEntity != client.player)) - && d <= 4096.0) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - if (d < 100.0 && livingEntity instanceof PlayerEntity && livingEntity.getEntityWorld().getScoreboard().getObjectiveForSlot(ScoreboardDisplaySlot.BELOW_NAME) != null) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - } - } - - matrixStack.multiply(this.dispatcher.getRotation()); - matrixStack.scale(-scale, scale, scale); - matrixStack.translate(0, ModConfig.HANDLER.instance().display_offset, 0); - Matrix4f model = matrixStack.peek().getPositionMatrix(); - - float x = maxX - (heart % heartsPerRow) * 8; - - if (isDrawingEmpty == 0) { - drawHeart(model, vertexConsumer, x, HeartTypeEnum.EMPTY); - } else { - HeartTypeEnum type; - if (heart < heartsRed) { - type = HeartTypeEnum.RED_FULL; - if (heart == heartsRed - 1 && lastRedHalf) { - type = HeartTypeEnum.RED_HALF; - } - } else if (heart < heartsNormal) { - type = HeartTypeEnum.EMPTY; - } else { - type = HeartTypeEnum.YELLOW_FULL; - if (heart == heartsTotal - 1 && lastYellowHalf) { - type = HeartTypeEnum.YELLOW_HALF; - } - } - if (type != HeartTypeEnum.EMPTY) { - drawHeart(model, vertexConsumer, x, type); - } - } - - BuiltBuffer builtBuffer; - try { - builtBuffer = vertexConsumer.build(); - if(builtBuffer != null){ - BufferRenderer.drawWithGlobalProgram(builtBuffer); - builtBuffer.close(); - } - } - catch (Exception e){ - // F off - } - matrixStack.pop(); - } - } - } - - @Unique - private void renderNumber(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light){ - double d = this.dispatcher.getSquaredDistanceToCamera(livingEntity); - - float health = MathHelper.ceil(livingEntity.getHealth()); - float maxHealth = MathHelper.ceil(livingEntity.getMaxHealth()); - float absorption = MathHelper.ceil(livingEntity.getAbsorptionAmount()); - - String healthText = health+absorption + " / " + maxHealth; - - if(ModConfig.HANDLER.instance().percentage_based_health) { - healthText = ((health + absorption) / maxHealth) * 100 + " %"; - } - - matrixStack.push(); - float scale = ModConfig.HANDLER.instance().size; - - matrixStack.translate(0, livingEntity.getHeight() + 0.5f, 0); - if ((this.hasLabel(livingEntity) - || (ModConfig.HANDLER.instance().force_higher_offset_for_players && livingEntity instanceof PlayerEntity && livingEntity != client.player)) - && d <= 4096.0) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - if (d < 100.0 && livingEntity instanceof PlayerEntity && livingEntity.getEntityWorld().getScoreboard().getObjectiveForSlot(ScoreboardDisplaySlot.BELOW_NAME) != null) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - } - } - - matrixStack.multiply(this.dispatcher.getRotation()); - matrixStack.scale(scale, -scale, scale); - matrixStack.translate(0, -ModConfig.HANDLER.instance().display_offset, 0); - - TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer; - float x = -textRenderer.getWidth(healthText) / 2.0f; - Matrix4f model = matrixStack.peek().getPositionMatrix(); - - textRenderer.draw(healthText, x, 0, ModConfig.HANDLER.instance().number_color.getRGB(), ModConfig.HANDLER.instance().render_number_display_shadow, model, vertexConsumerProvider, TextRenderer.TextLayerType.NORMAL, ModConfig.HANDLER.instance().render_number_display_background_color ? ModConfig.HANDLER.instance().number_display_background_color.getRGB() : 0, light); - matrixStack.pop(); - } - - - @Unique private void renderArmorPoints(T livingEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light){ - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder vertexConsumer; - - double d = this.dispatcher.getSquaredDistanceToCamera(livingEntity); - - int armor = MathHelper.ceil(livingEntity.getArmor()); - int maxArmor = MathHelper.ceil(livingEntity.getArmor()); - - if(maxArmor == 0) return; - - int armorPoints = MathHelper.ceil(armor / 2.0F); - boolean lastPointHalf = (armor & 1) == 1; - int pointsNormal = MathHelper.ceil(maxArmor / 2.0F); - int pointsTotal = 10; - - int pointsPerRow = ModConfig.HANDLER.instance().icons_per_row; - int pixelsTotal = Math.min(pointsTotal, pointsPerRow) * 8 + 1; - float maxX = pixelsTotal / 2.0f; - - double pointDensity = 50F - (Math.max(4F - Math.ceil((double) pointsTotal / pointsPerRow), -3F) * 5F); - double h = 0; - - for (int isDrawingEmpty = 0; isDrawingEmpty < 2; isDrawingEmpty++) { - for (int pointCount = 0; pointCount < pointsTotal; pointCount++) { - if (pointCount % pointsPerRow == 0) { - h = pointCount / pointDensity; - } - - matrixStack.push(); - float scale = ModConfig.HANDLER.instance().size; - vertexConsumer = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE); - - matrixStack.translate(0, livingEntity.getHeight() + 0.75f + + h, 0); - if ((this.hasLabel(livingEntity) - || (ModConfig.HANDLER.instance().force_higher_offset_for_players && livingEntity instanceof PlayerEntity && livingEntity != client.player)) - && d <= 4096.0) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - if (d < 100.0 && livingEntity instanceof PlayerEntity && livingEntity.getEntityWorld().getScoreboard().getObjectiveForSlot(ScoreboardDisplaySlot.BELOW_NAME) != null) { - matrixStack.translate(0.0D, 9.0F * 1.15F * scale, 0.0D); - } - } - - matrixStack.multiply(this.dispatcher.getRotation()); - matrixStack.scale(-scale, scale, scale); - matrixStack.translate(0, ModConfig.HANDLER.instance().display_offset, 0); - Matrix4f model = matrixStack.peek().getPositionMatrix(); - - float x = maxX - (pointCount % pointsPerRow) * 8; - - if (isDrawingEmpty == 0) { - drawArmor(model, vertexConsumer, x, ArmorTypeEnum.EMPTY); - } else { - ArmorTypeEnum type = null; - if (pointCount < armorPoints) { - type = ArmorTypeEnum.FULL; - if (pointCount == armorPoints - 1 && lastPointHalf) { - type = ArmorTypeEnum.HALF; - } - } else if (pointCount < pointsNormal) { - type = ArmorTypeEnum.EMPTY; - } - if(type != null) drawArmor(model, vertexConsumer, x, type); - } - - BuiltBuffer builtBuffer; - try { - builtBuffer = vertexConsumer.build(); - if(builtBuffer != null){ - BufferRenderer.drawWithGlobalProgram(builtBuffer); - builtBuffer.close(); - } - } - catch (Exception e){ - // F off - } - matrixStack.pop(); - } - } - } - - @Unique - private static void drawArmor(Matrix4f model, VertexConsumer vertexConsumer, float x, ArmorTypeEnum type) { - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - Identifier armorIcon = ModConfig.HANDLER.instance().use_vanilla_textures ? type.vanillaIcon : type.icon; - RenderSystem.setShaderTexture(0, armorIcon); - RenderSystem.enableDepthTest(); - - float minU = 0F; - float maxU = 1F; - float minV = 0F; - float maxV = 1F; - - float heartSize = 9F; - - vertexConsumer.vertex(model, x, 0F - heartSize, 0.0F).texture(minU, maxV); - vertexConsumer.vertex(model, x - heartSize, 0F - heartSize, 0.0F).texture(maxU, maxV); - vertexConsumer.vertex(model, x - heartSize, 0F, 0.0F).texture(maxU, minV); - vertexConsumer.vertex(model, x, 0F, 0.0F).texture(minU, minV); - } - - @Unique - private static void drawHeart(Matrix4f model, VertexConsumer vertexConsumer, float x, HeartTypeEnum type) { - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - Identifier heartIcon = ModConfig.HANDLER.instance().use_vanilla_textures ? type.vanillaIcon : type.icon; - RenderSystem.setShaderTexture(0, heartIcon); - RenderSystem.enableDepthTest(); - - float minU = 0F; - float maxU = 1F; - float minV = 0F; - float maxV = 1F; - - float heartSize = 9F; - - vertexConsumer.vertex(model, x, 0F - heartSize, 0.0F).texture(minU, maxV); - vertexConsumer.vertex(model, x - heartSize, 0F - heartSize, 0.0F).texture(maxU, maxV); - vertexConsumer.vertex(model, x - heartSize, 0F, 0.0F).texture(maxU, minV); - vertexConsumer.vertex(model, x, 0F, 0.0F).texture(minU, minV); - } - - @Unique - @Deprecated - private static void drawVertex(Matrix4f model, VertexConsumer vertices, float x, float y, float u, float v) { - vertices.vertex(model, x, y, 0.0F).texture(u, v); - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/util/ConfigUtils.java b/src/main/java/io/github/adytech99/healthindicators/util/ConfigUtils.java deleted file mode 100755 index 82ccbb0..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/util/ConfigUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.adytech99.healthindicators.util; - -import io.github.adytech99.healthindicators.config.ModConfig; -import io.github.adytech99.healthindicators.enums.MessageTypeEnum; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.text.Text; - -public class ConfigUtils { - public static void sendMessage(ClientPlayerEntity player, Text text){ - if(isSendMessage()) { - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - player.sendMessage(text, overlay); - } - } - public static void sendOverlayMessage(ClientPlayerEntity player, Text text) { - if (isSendMessage()){ - boolean overlay = ModConfig.HANDLER.instance().message_type == MessageTypeEnum.ACTIONBAR; - player.sendMessage(text, true); - } - } - public static boolean isSendMessage(){ - return ModConfig.HANDLER.instance().message_type != MessageTypeEnum.NONE; - } -} diff --git a/src/main/java/io/github/adytech99/healthindicators/util/Maths.java b/src/main/java/io/github/adytech99/healthindicators/util/Maths.java deleted file mode 100644 index efcc9ec..0000000 --- a/src/main/java/io/github/adytech99/healthindicators/util/Maths.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.github.adytech99.healthindicators.util; - -public class Maths { - public static double truncate(double number, int places) { - return Math.floor(number * Math.pow(10, places)) / Math.pow(10, places); - } -} diff --git a/src/main/resources/assets/healthindicators/icon.png b/src/main/resources/assets/healthindicators/icon.png deleted file mode 100644 index 6d9cfc1..0000000 Binary files a/src/main/resources/assets/healthindicators/icon.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/lang/en_us.json b/src/main/resources/assets/healthindicators/lang/en_us.json deleted file mode 100644 index 0a3857f..0000000 --- a/src/main/resources/assets/healthindicators/lang/en_us.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "yacl3.config.health-indicators:config.passive_mobs": "Show health of passive mobs", - "yacl3.config.health-indicators:config.passive_mobs.desc": "Displays a health bar above passive mobs", - - "yacl3.config.health-indicators:config.hostile_mobs": "Show health of hostile mobs", - "yacl3.config.health-indicators:config.hostile_mobs.desc": "Displays a health bar above hostile mobs", - - "yacl3.config.health-indicators:config.angered_mobs": "Show health of angered mobs", - "yacl3.config.health-indicators:config.angered_mobs.desc": "Displays a health bar above angered mobs. This is different from 'Hostile Mobs,' since a passive mob (eg: iron golem, enderman) are not considered a hostile mob, but can still attack the player if provoked.", - - "yacl3.config.health-indicators:config.players": "Show health of players", - "yacl3.config.health-indicators:config.players.desc": "Displays a health bar above other players", - - "yacl3.config.health-indicators:config.self": "Show health of yourself", - "yacl3.config.health-indicators:config.self.desc": "Displays a health bar above yourself in third person and in the inventory menu", - - "yacl3.config.health-indicators:config.after_attack": "Show health only after attack", - "yacl3.config.health-indicators:config.after_attack.desc": "Health bar will display only after the entity has been attacked.", - - "yacl3.config.health-indicators:config.time_after_hit": "Seconds for health to disappear after attack", - "yacl3.config.health-indicators:config.time_after_hit.desc": "Health bar will disappear after the set number of seconds.", - - "yacl3.config.health-indicators:config.damaged_only": "Show health only if entity is damaged", - "yacl3.config.health-indicators:config.damaged_only.desc": "Health bar will display only if the entity's health is lower than its max health. May not work in cases where entities have absorption effect.", - - "yacl3.config.health-indicators:config.looking_at": "Show health only when looking at entity", - "yacl3.config.health-indicators:config.looking_at.desc": "Health will only render if the entity is being looked at.", - - "yacl3.config.health-indicators:config.reach": "'Looking at' range", - "yacl3.config.health-indicators:config.reach.desc": "How far can the entity be for the 'looking at' option. The default value (3 blocks) is equal to the attack reach for survival minecraft.", - - "yacl3.config.health-indicators:config.override_players": "Always show player health", - "yacl3.config.health-indicators:config.override_players.desc": "Overrides the above options to always display health of Players, even if they have not been attacked, they are full health or they are not on crosshair", - "yacl3.config.health-indicators:config.override_players_label.desc": "Overrides above criteria and always renders health for the below entity types. \n \n Currently only the playerentity type is supported here.", - - - - "yacl3.config.health-indicators:config.indicator_type": "Indicator Type", - "yacl3.config.health-indicators:config.indicator_type.desc": "Whether to render a floating hearts display or a number display.", - - "yacl3.config.health-indicators:config.icons_per_row": "Hearts per row (beta)", - - "yacl3.config.health-indicators:config.use_vanilla_textures": "Use vanilla textures", - "yacl3.config.health-indicators:config.use_vanilla_textures.desc": "Some resource packs use a custom heart icon, which can break this mod. Enabling this setting will override the custom icon.", - - "yacl3.config.health-indicators:config.number_type_settings_label.desc": "Settings for the number-type indicator", - - "yacl3.config.health-indicators:config.number_color": "Text color", - "yacl3.config.health-indicators:config.number_color.desc": "Color of the number", - - "yacl3.config.health-indicators:config.render_number_display_shadow": "Render shadow", - "yacl3.config.health-indicators:config.render_number_display_shadow.desc": "Whether there should be a shadow behind the display text", - - "yacl3.config.health-indicators:config.render_number_display_background_color": "Render background", - "yacl3.config.health-indicators:config.render_number_display_background_color.desc": "Whether there should be a colored background behind the number display", - - "yacl3.config.health-indicators:config.number_display_background_color": "Background color", - "yacl3.config.health-indicators:config.number_display_background_color.desc": "The background color for the number display", - - "yacl3.config.health-indicators:config.size": "Indicator Size", - "yacl3.config.health-indicators:config.size.desc": "The scale of the indicators", - - "yacl3.config.health-indicators:config.percentage_based_health": "Percentage based health", - "yacl3.config.health-indicators:config.percentage_based_health.desc": "Shows health as a percentage instead of raw values. Enabling this would mean that all mobs would show the same base-health (configurable below) and their actual health would be shown out of that. \n\nFor example, an iron golem might have 40 out of 50 hearts, but the indicator will show 8 out of 10 hearts. \n\nThe number-type indicator will not follow this mechanic, and simply show a % value: e.g. 80%", - - "yacl3.config.health-indicators:config.max_health": "Base health", - "yacl3.config.health-indicators:config.max_health.desc": "The base value (in hp, not hearts! 1 heart = 2hp) for the percentage based health.", - - - "yacl3.config.health-indicators:config.display_offset": "Display offset", - "yacl3.config.health-indicators:config.display_offset.desc": "The distance between the top of the Entity and the health display. Negative offset values can make the health display render below or in the middle of the entity. Extreme offset values can make the health display render out of view.", - - "yacl3.config.health-indicators:config.offset_step_size": "Offset step size", - "yacl3.config.health-indicators:config.offset_step_size.desc": "The offset that the keybind (default up-arrow and down-arrow) will change per click.", - - "yacl3.config.health-indicators:config.force_higher_offset_for_players": "Force higher offset for players", - "yacl3.config.health-indicators:config.force_higher_offset_for_players.desc": "Normally, the health display renders at a higher offset for Players and Entities with a visible name-tag. \n \n However, some servers implement a custom name-tag which the mod does not recognize and account for. This option will forcibly raise offset for *all* players to fix the problem.", - - "yacl3.config.health-indicators:config.message_type": "Message type", - "yacl3.config.health-indicators:config.message_type.desc": "Whether mod messages (Indicator Enabled/Disabled, Heart Offset, etc) will be sent in chat, actionbar or not be sent at all", - - "yacl3.config.health-indicators:config.colored_messages": "Colored Messages", - "yacl3.config.health-indicators:config.colored_messages.desc": "Whether the Indicator Enabled/Disabled messages should be colored (Green and Red respectively)", - - "yacl3.config.health-indicators:config.enable_commands": "Enable mod commands", - "yacl3.config.health-indicators:config.enable_commands.desc": "Enables the /healthindicators command and its subcommands", - - "yacl3.config.health-indicators:config.hearts_clipping": "Heart clipping", - "yacl3.config.health-indicators:config.hearts_clipping.desc": "Hearts will get pushed downwards if there is a solid block at their normal rendering position.", - - - "yacl3.config.health-indicators:config.category.filters": "Filters", - "yacl3.config.health-indicators:config.category.appearance": "Appearance", - "yacl3.config.health-indicators:config.category.messages": "Messages & Commands", - - "yacl3.config.health-indicators:config.category.filters.group.entity_type": "Entity Types", - "yacl3.config.health-indicators:config.category.filters.group.advanced": "Advanced", - "yacl3.config.health-indicators:config.category.appearance.group.indicator_type": "Indicator Appearance", - "yacl3.config.health-indicators:config.category.appearance.group.offset": "Indicator Location", - "yacl3.config.health-indicators:config.category.messages.group.messages_appearance": "Mod Messages", - "yacl3.config.health-indicators:config.category.messages.group.commands": "Mod Commands", - - - "key.categories.healthindicators": "Health Indicators", - "key.healthindicators.renderingEnabled": "Toggle Rendering", - "key.healthindicators.armorRenderingEnabled": "Toggle Armor Points Rendering", - "key.healthindicators.overrideAllFilters": "Override all config filters", - "key.healthindicators.increaseHeartOffset": "Increase Heart Offset", - "key.healthindicators.decreaseHeartOffset": "Decrease Heart Offset", - "key.healthindicators.openModMenuConfig": "Open Config Screen" -} \ No newline at end of file diff --git a/src/main/resources/assets/healthindicators/lang/ru_ru.json b/src/main/resources/assets/healthindicators/lang/ru_ru.json deleted file mode 100644 index d548f4a..0000000 --- a/src/main/resources/assets/healthindicators/lang/ru_ru.json +++ /dev/null @@ -1,96 +0,0 @@ -{ -"yacl3.config.health-indicators:config.passive_mobs": "Показывать здоровье мирных мобов", -"yacl3.config.health-indicators:config.passive_mobs.desc": "Отображает индикатор здоровья над мирными мобами", - -"yacl3.config.health-indicators:config.hostile_mobs": "Показывать здоровье враждебных мобов", -"yacl3.config.health-indicators:config.hostile_mobs.desc": "Отображает индикатор здоровья над враждебными мобами", - -"yacl3.config.health-indicators:config.angered_mobs": "Показывать здоровье разгневанных мобов", -"yacl3.config.health-indicators:config.angered_mobs.desc": "Отображает индикатор здоровья над разгневанными мобами. Это отличается от 'враждебных мобов', так как мирный моб (например, железный голем, эндермен) не считается враждебным, но может атаковать игрока, если его спровоцировать.", - -"yacl3.config.health-indicators:config.players": "Показывать здоровье игроков", -"yacl3.config.health-indicators:config.players.desc": "Отображает индикатор здоровья над другими игроками", - -"yacl3.config.health-indicators:config.self": "Показывать свое здоровье", -"yacl3.config.health-indicators:config.self.desc": "Отображает индикатор здоровья над вами в режиме от третьего лица и в меню инвентаря", - -"yacl3.config.health-indicators:config.after_attack": "Показывать здоровье только после атаки", -"yacl3.config.health-indicators:config.after_attack.desc": "Индикатор здоровья отображается только после того, как существо было атаковано.", - -"yacl3.config.health-indicators:config.time_after_hit": "Секунды до исчезновения здоровья после атаки", -"yacl3.config.health-indicators:config.time_after_hit.desc": "Индикатор здоровья исчезает после заданного количества секунд.", - -"yacl3.config.health-indicators:config.damaged_only": "Показывать здоровье только если существо ранено", -"yacl3.config.health-indicators:config.damaged_only.desc": "Индикатор здоровья отображается только если здоровье существа ниже его максимального. Может не работать в случаях, когда у существа есть эффект поглощения.", - -"yacl3.config.health-indicators:config.looking_at": "Показывать здоровье только при взгляде на существо", -"yacl3.config.health-indicators:config.looking_at.desc": "Индикатор здоровья отображается только если существо находится в поле зрения.", - -"yacl3.config.health-indicators:config.reach": "Дальность 'взгляда'", -"yacl3.config.health-indicators:config.reach.desc": "На каком расстоянии может находиться существо для опции 'взгляда'. Значение по умолчанию (3 блока) равно дальности атаки в режиме выживания Minecraft.", - -"yacl3.config.health-indicators:config.override_players": "Всегда показывать здоровье игроков", -"yacl3.config.health-indicators:config.override_players.desc": "Переопределяет вышеуказанные опции и всегда отображает здоровье игроков, даже если они не были атакованы, у них полное здоровье или они не находятся в прицеле.", -"yacl3.config.health-indicators:config.override_players_label.desc": "Переопределяет вышеуказанные критерии и всегда отображает здоровье для следующих типов существ. \n \n В настоящее время поддерживается только тип playerentity.", - -"yacl3.config.health-indicators:config.indicator_type": "Тип индикатора", -"yacl3.config.health-indicators:config.indicator_type.desc": "Отображать ли плавающие сердечки или числовой индикатор.", - -"yacl3.config.health-indicators:config.hearts_per_row": "Сердечки в строке (бета)", - -"yacl3.config.health-indicators:config.number_type_settings_label.desc": "Настройки для числового индикатора", - -"yacl3.config.health-indicators:config.number_color": "Цвет текста", -"yacl3.config.health-indicators:config.number_color.desc": "Цвет числового индикатора", - -"yacl3.config.health-indicators:config.render_number_display_shadow": "Отображать тень", -"yacl3.config.health-indicators:config.render_number_display_shadow.desc": "Должна ли быть тень за текстом индикатора", - -"yacl3.config.health-indicators:config.render_number_display_background_color": "Отображать фон", -"yacl3.config.health-indicators:config.render_number_display_background_color.desc": "Должен ли быть цветной фон за числовым индикатором", - -"yacl3.config.health-indicators:config.number_display_background_color": "Цвет фона", -"yacl3.config.health-indicators:config.number_display_background_color.desc": "Цвет фона для числового индикатора", - -"yacl3.config.health-indicators:config.size": "Размер индикатора", -"yacl3.config.health-indicators:config.size.desc": "Масштаб индикаторов", - -"yacl3.config.health-indicators:config.display_offset": "Смещение отображения", -"yacl3.config.health-indicators:config.display_offset.desc": "Расстояние между верхней частью существа и индикатором здоровья. Отрицательные значения смещения могут сделать так, что индикатор здоровья будет отображаться ниже или в середине существа. Экстремальные значения смещения могут сделать индикатор здоровья невидимым.", - -"yacl3.config.health-indicators:config.offset_step_size": "Шаг смещения", -"yacl3.config.health-indicators:config.offset_step_size.desc": "Шаг смещения, который изменяется при нажатии клавиши (по умолчанию вверх-вниз).", - -"yacl3.config.health-indicators:config.force_higher_offset_for_players": "Принудительное повышение смещения для игроков", -"yacl3.config.health-indicators:config.force_higher_offset_for_players.desc": "Обычно индикатор здоровья отображается с более высоким смещением для игроков и существ с видимой меткой имени. \n \n Однако некоторые серверы реализуют пользовательскую метку имени, которую мод не распознает и не учитывает. Эта опция принудительно повышает смещение для *всех* игроков для решения проблемы.", - -"yacl3.config.health-indicators:config.message_type": "Тип сообщения", -"yacl3.config.health-indicators:config.message_type.desc": "Будут ли сообщения мода (индикатор включен/выключен, смещение сердечек и т. д.) отправляться в чат, actionbar или не отправляться вообще", - -"yacl3.config.health-indicators:config.colored_messages": "Цветные сообщения", -"yacl3.config.health-indicators:config.colored_messages.desc": "Должны ли сообщения индикатора (включен/выключен) быть цветными (зеленый и красный соответственно)", - -"yacl3.config.health-indicators:config.enable_commands": "Включить команды мода", -"yacl3.config.health-indicators:config.enable_commands.desc": "Включает команду /healthindicators и ее подкоманды", - -"yacl3.config.health-indicators:config.hearts_clipping": "Обрезка сердечек", -"yacl3.config.health-indicators:config.hearts_clipping.desc": "Сердечки будут сдвигаться вниз, если на их нормальной позиции отображения есть твердый блок.", - -"yacl3.config.health-indicators:config.category.filters": "Фильтры", -"yacl3.config.health-indicators:config.category.appearance": "Внешний вид", -"yacl3.config.health-indicators:config.category.messages": "Сообщения и команды", - -"yacl3.config.health-indicators:config.category.filters.group.entity_type": "Типы существ", -"yacl3.config.health-indicators:config.category.filters.group.advanced": "Расширенные", -"yacl3.config.health-indicators:config.category.appearance.group.indicator_type": "Внешний вид индикатора", -"yacl3.config.health-indicators:config.category.appearance.group.offset": "Расположение индикатора", -"yacl3.config.health-indicators:config.category.messages.group.messages_appearance": "Сообщения мода", -"yacl3.config.health-indicators:config.category.messages.group.commands": "Команды мода", - -"key.categories.healthindicators": "Индикаторы здоровья", -"key.healthindicators.renderingEnabled": "Переключить отображение", -"key.healthindicators.armorRenderingEnabled": "Переключить отображение брони", -"key.healthindicators.overrideAllFilters": "Переопределить все фильтры конфигурации", -"key.healthindicators.increaseHeartOffset": "Увеличить смещение сердечек", -"key.healthindicators.decreaseHeartOffset": "Уменьшить смещение сердечек" -} \ No newline at end of file diff --git a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_empty.png b/src/main/resources/assets/healthindicators/textures/gui/armor/armor_empty.png deleted file mode 100755 index 789e8f4..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_empty.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_full.png b/src/main/resources/assets/healthindicators/textures/gui/armor/armor_full.png deleted file mode 100755 index d54ff05..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_half.png b/src/main/resources/assets/healthindicators/textures/gui/armor/armor_half.png deleted file mode 100755 index 42db802..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/armor/armor_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full.png deleted file mode 100755 index d49752b..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full_blinking.png deleted file mode 100755 index d49752b..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half.png deleted file mode 100755 index e5e17e6..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half_blinking.png deleted file mode 100755 index e5e17e6..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full.png deleted file mode 100755 index 86da3cb..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full_blinking.png deleted file mode 100755 index 86da3cb..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half.png deleted file mode 100755 index 8df8ec2..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half_blinking.png deleted file mode 100755 index 8df8ec2..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/absorbing_hardcore_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/container.png b/src/main/resources/assets/healthindicators/textures/gui/heart/container.png deleted file mode 100755 index 96c66f3..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/container.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/container_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/container_blinking.png deleted file mode 100755 index 7358b8c..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/container_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore.png b/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore.png deleted file mode 100755 index 96c66f3..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore_blinking.png deleted file mode 100755 index 7358b8c..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/container_hardcore_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full.png deleted file mode 100755 index 68cfd79..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full_blinking.png deleted file mode 100755 index 68cfd79..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half.png deleted file mode 100755 index 93f486f..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half_blinking.png deleted file mode 100755 index 93f486f..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full.png deleted file mode 100755 index 14c81dd..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full_blinking.png deleted file mode 100755 index 14c81dd..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half.png deleted file mode 100755 index 41edb27..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half_blinking.png deleted file mode 100755 index 41edb27..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/frozen_hardcore_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/full.png deleted file mode 100755 index 340c681..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/full_blinking.png deleted file mode 100755 index 5d08a1c..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/half.png deleted file mode 100755 index 6e205ed..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/half_blinking.png deleted file mode 100755 index b57770f..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full.png deleted file mode 100755 index f990ea4..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full_blinking.png deleted file mode 100755 index a41d8e8..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half.png deleted file mode 100755 index 558b905..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half_blinking.png deleted file mode 100755 index 25dacf1..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/hardcore_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full.png deleted file mode 100755 index 396c22e..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full_blinking.png deleted file mode 100755 index 7e02076..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half.png deleted file mode 100755 index 7493c78..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half_blinking.png deleted file mode 100755 index 158414b..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full.png deleted file mode 100755 index 8477203..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full_blinking.png deleted file mode 100755 index 0574829..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half.png deleted file mode 100755 index cfeac5f..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half_blinking.png deleted file mode 100755 index ef0db25..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/poisoned_hardcore_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_container.png b/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_container.png deleted file mode 100755 index 037dd1b..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_container.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_full.png deleted file mode 100755 index 7a30510..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_half.png deleted file mode 100755 index 9f8df60..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/vehicle_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full.png deleted file mode 100755 index 731c340..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full_blinking.png deleted file mode 100755 index e445e01..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half.png deleted file mode 100755 index 8eb8f65..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half_blinking.png deleted file mode 100755 index eece7cd..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_half_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full.png deleted file mode 100755 index 5968b94..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full_blinking.png deleted file mode 100755 index fb20bf8..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_full_blinking.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half.png deleted file mode 100755 index 99ce883..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half.png and /dev/null differ diff --git a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half_blinking.png b/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half_blinking.png deleted file mode 100755 index 2a88ff0..0000000 Binary files a/src/main/resources/assets/healthindicators/textures/gui/heart/withered_hardcore_half_blinking.png and /dev/null differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json deleted file mode 100644 index 354b0bf..0000000 --- a/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "schemaVersion": 1, - "id": "healthindicators", - "version": "${version}", - - "name": "Health Indicators", - "description": "Displays a health bar above mobs and players", - "authors": [ - "AdyTech99" - ], - - "license": "LGPL v3", - "icon": "assets/healthindicators/icon.png", - - "environment": "client", - "entrypoints": { - "client": [ - "io.github.adytech99.healthindicators.HealthIndicatorsMod" - ], - "modmenu" : ["io.github.adytech99.healthindicators.config.ModMenuAPIImpl"] - }, - "accessWidener": "healthindicators.accesswidener", - "mixins": [ - "healthindicators.mixins.json" - ], - - "depends": { - "fabricloader": ">=0.15.11", - "fabric": "*", - "minecraft": ">=1.21", - "java": ">=21" - } -} diff --git a/src/main/resources/healthindicators.accesswidener b/src/main/resources/healthindicators.accesswidener deleted file mode 100644 index 689121a..0000000 --- a/src/main/resources/healthindicators.accesswidener +++ /dev/null @@ -1,2 +0,0 @@ -accessWidener v2 named -accessible method net/minecraft/client/render/BufferBuilder build ()Lnet/minecraft/client/render/BuiltBuffer; \ No newline at end of file diff --git a/src/main/resources/healthindicators.mixins.json b/src/main/resources/healthindicators.mixins.json deleted file mode 100644 index d2a9647..0000000 --- a/src/main/resources/healthindicators.mixins.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "io.github.adytech99.healthindicators.mixin", - "compatibilityLevel": "JAVA_21", - "client": [ - "EntityRendererMixin", - "EntityDamageMixin" - ], - "injectors": { - "defaultRequire": 1 - } -}