diff --git a/gradle.properties b/gradle.properties index 1231661..59a35d0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ loader_version_range=[4,) mod_id=the_trackers mod_name=The Trackers mod_license=LGPLv3 -mod_version=1.21.1-0.2.5 +mod_version=1.21.1-0.2.6 mod_group_id=nowebsite.makertechno.the_trackers mod_authors=MakerTechno mod_description=To follow the light to where all shadows begin. diff --git a/src/generated/resources/.cache/79cfe5bfff7b55794fea56f3e0a9b0e39c575861 b/src/generated/resources/.cache/79cfe5bfff7b55794fea56f3e0a9b0e39c575861 index 0b0dcdd..ccaac4c 100644 --- a/src/generated/resources/.cache/79cfe5bfff7b55794fea56f3e0a9b0e39c575861 +++ b/src/generated/resources/.cache/79cfe5bfff7b55794fea56f3e0a9b0e39c575861 @@ -1,2 +1,2 @@ -// 1.21.1 2025-12-30T03:29:47.8263854 Languages: en_us for mod: the_trackers -03304c51a90c9d9e2adcfc7f6ef3e7fe53f69a2a assets/the_trackers/lang/en_us.json +// 1.21.1 2026-06-12T19:48:54.9381165 Languages: en_us for mod: the_trackers +476f1b815154e366147c84048f930b12afa4cef6 assets/the_trackers/lang/en_us.json diff --git a/src/generated/resources/.cache/cbbc0b13008c21e8962ade032f423e5be1ab0b42 b/src/generated/resources/.cache/cbbc0b13008c21e8962ade032f423e5be1ab0b42 index 74c849b..eae0a43 100644 --- a/src/generated/resources/.cache/cbbc0b13008c21e8962ade032f423e5be1ab0b42 +++ b/src/generated/resources/.cache/cbbc0b13008c21e8962ade032f423e5be1ab0b42 @@ -1,2 +1,2 @@ -// 1.21.1 2025-12-30T03:29:47.8323821 Languages: zh_cn for mod: the_trackers -1abacc820d2baf494f695dc25ede351aeb2a290c assets/the_trackers/lang/zh_cn.json +// 1.21.1 2026-06-12T19:48:54.9401096 Languages: zh_cn for mod: the_trackers +983695bff3328e6f641c51536ee109256f22010b assets/the_trackers/lang/zh_cn.json diff --git a/src/generated/resources/assets/the_trackers/lang/en_us.json b/src/generated/resources/assets/the_trackers/lang/en_us.json index a1421cd..d2f5be6 100644 --- a/src/generated/resources/assets/the_trackers/lang/en_us.json +++ b/src/generated/resources/assets/the_trackers/lang/en_us.json @@ -6,6 +6,9 @@ "the_trackers.configuration.center_relative_tracking": "Tracking settings for center-relative cursors", "the_trackers.configuration.center_relative_tracking.button": "Settings for tracking entities", "the_trackers.configuration.center_relative_tracking.tooltip": "List of entity types with cursor types, separated with \"|\"", + "the_trackers.configuration.center_relative_tracking_secondary": "Secondary tracking settings for center-relative cursors", + "the_trackers.configuration.center_relative_tracking_secondary.button": "Settings for tracking entities", + "the_trackers.configuration.center_relative_tracking_secondary.tooltip": "List of entity types with cursor types, separated with \"|\"", "the_trackers.configuration.gui_scale": "The scale of tracking cursors", "the_trackers.configuration.gui_scale.tooltip": "Usually 0.6 on 1080p monitors", "the_trackers.configuration.head_flat_available": "Longitude hud available", @@ -23,5 +26,7 @@ "the_trackers.configuration.track_full_available.tooltip": "Enable or disable full screen tag cursors", "the_trackers.configuration.track_full_tracking": "Tracking settings for full-track cursors", "the_trackers.configuration.track_full_tracking.button": "Settings for tracking entities", - "the_trackers.configuration.track_full_tracking.tooltip": "List of entity types with cursor types, separated with \"|\"" + "the_trackers.configuration.track_full_tracking.tooltip": "List of entity types with cursor types, separated with \"|\"", + "the_trackers.configuration.track_secondary_enemies": "Secondary tracking available", + "the_trackers.configuration.track_secondary_enemies.tooltip": "Enable or disable tracking secondary targets" } \ No newline at end of file diff --git a/src/generated/resources/assets/the_trackers/lang/zh_cn.json b/src/generated/resources/assets/the_trackers/lang/zh_cn.json index 82f5d49..b07c3d8 100644 --- a/src/generated/resources/assets/the_trackers/lang/zh_cn.json +++ b/src/generated/resources/assets/the_trackers/lang/zh_cn.json @@ -6,6 +6,9 @@ "the_trackers.configuration.center_relative_tracking": "中心环绕式跟踪清单", "the_trackers.configuration.center_relative_tracking.button": "跟踪实体的设置", "the_trackers.configuration.center_relative_tracking.tooltip": "带有光标类型的实体类型列表,用\"|\"分隔", + "the_trackers.configuration.center_relative_tracking_secondary": "中心环绕式次要跟踪清单", + "the_trackers.configuration.center_relative_tracking_secondary.button": "跟踪实体的设置", + "the_trackers.configuration.center_relative_tracking_secondary.tooltip": "带有光标类型的实体类型列表,用\"|\"分隔", "the_trackers.configuration.gui_scale": "追踪指针大小", "the_trackers.configuration.gui_scale.tooltip": "默认值0.6,这在一般1080p设备上表现很好", "the_trackers.configuration.head_flat_available": "经度轴开关", @@ -23,5 +26,7 @@ "the_trackers.configuration.track_full_available.tooltip": "启用或禁用锁定定位式指针", "the_trackers.configuration.track_full_tracking": "绑定定位式跟踪清单", "the_trackers.configuration.track_full_tracking.button": "跟踪实体的设置", - "the_trackers.configuration.track_full_tracking.tooltip": "带有光标类型的实体类型列表,用\"|\"分隔" + "the_trackers.configuration.track_full_tracking.tooltip": "带有光标类型的实体类型列表,用\"|\"分隔", + "the_trackers.configuration.track_secondary_enemies": "次要追踪开关", + "the_trackers.configuration.track_secondary_enemies.tooltip": "启用或禁用追踪次要目标" } \ No newline at end of file diff --git a/src/main/java/nowebsite/makertechno/the_trackers/core/config/ConfigProcessor.java b/src/main/java/nowebsite/makertechno/the_trackers/core/config/ConfigProcessor.java index a05f176..ae72dc1 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/core/config/ConfigProcessor.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/core/config/ConfigProcessor.java @@ -2,10 +2,7 @@ import com.mojang.datafixers.util.Pair; import net.minecraft.world.entity.EntityType; -import nowebsite.makertechno.the_trackers.client.gui.cursors.TDir3BodyCursor; -import nowebsite.makertechno.the_trackers.client.gui.cursors.TDirectProjCursor; -import nowebsite.makertechno.the_trackers.client.gui.cursors.TRelativeCursor; -import nowebsite.makertechno.the_trackers.client.gui.cursors.TRenderCursor; +import nowebsite.makertechno.the_trackers.client.gui.cursors.*; import nowebsite.makertechno.the_trackers.client.gui.components.Icon; import nowebsite.makertechno.the_trackers.client.gui.components.BasicComponentFactory; import nowebsite.makertechno.the_trackers.client.gui.components.BaseComponent; @@ -21,131 +18,215 @@ public final class ConfigProcessor { - private static final Pair, Supplier> OF_EMPTY =new Pair<>(null, TRenderCursor::ofNull); - + // 格式: entityType|pointer|entityIcon(|optionalPatterns) public static boolean isValidEntityBindCRCursor(Object o) { - /* entityType|pointer|entityIcon(|optionalPatterns) */ + CRCursorParseData data = parseCRCursorData(o); + return validateCRCursorData(data); + } + + /** + * 通过配置表处理CenterRelative指针数据 + */ + @NotNull + public static Set, Supplier>> collectCREntityBindCursor(@NotNull List list) { + return list.stream() + .map(ConfigProcessor::parseCRCursorData) // 处理为中间数据件 + .filter(ConfigProcessor::validateCRCursorData) // 验证配置完整性 + .map(ConfigProcessor::buildCRCursorPair) // 构造指针 + .collect(Collectors.toSet()); + } + + // 格式: entityType|type:icon(|optionalPattern) + public static boolean isValidCREntityBindDTCursor(Object o) { + DTCursorParseData data = parseDTCursorData(o); + return validateDTCursorData(data); + } + + /** + * 通过配置表处理DirectProj指针数据 + */ + @NotNull + public static Set, Supplier>> collectDTEntityBindCursor(@NotNull List list) { + return list.stream() + .map(ConfigProcessor::parseDTCursorData) + .filter(ConfigProcessor::validateDTCursorData) + .map(ConfigProcessor::buildDTCursorPair) + .collect(Collectors.toSet()); + } + /** + * 处理CenterRelative配置 + */ + private static CRCursorParseData parseCRCursorData(Object o) { + CRCursorParseData data = new CRCursorParseData(); + + // 步骤1: 类型检查 + if (!(o instanceof String config)) return data.invalid(); + + // 步骤2: 分割验证 + data.parts = config.split("\\|"); + if (data.parts.length < 3 || data.parts.length > 4) return data.invalid(); + + // 步骤3: 解析实体类型 + Optional> entityType = EntityType.byString(data.parts[0]); + if (entityType.isEmpty()) return data.invalid(); + data.entityType = entityType.get(); + + // 步骤4: 读取图标键名 + data.pointerKey = data.parts[1]; + data.iconKey = data.parts[2]; + + // 步骤5: 处理可选模式 + if (data.parts.length == 4) { + String[] patterns = data.parts[3].split("&"); + if (patterns.length != 2) return data.invalid(); + data.pattern1 = patterns[0]; + data.pattern2 = patterns[1]; + data.hasPatterns = true; + } - if (!(o instanceof String s)) return false; - String[] split = s.split("\\|"); - if (split.length < 3 || split.length > 4) return false; + return data.valid(); + } - Optional> typeOpt = EntityType.byString(split[0]); - if (typeOpt.isEmpty()) return false; + private static boolean validateCRCursorData(CRCursorParseData data) { + if (!data.valid) return false; - if (TModClient.isLoaded && !split[1].equals("none") && TextureCache.getIcon(split[1]).equals(Icon.NONE)) return false; - if (TModClient.isLoaded && !split[2].equals("none") && TextureCache.getIcon(split[2]).equals(Icon.NONE)) return false; + // 验证图标有效性(仅在客户端加载时) + if (TModClient.isLoaded) { + if (!data.pointerKey.equals("none") && TextureCache.getIcon(data.pointerKey).equals(Icon.NONE)) + return false; + if (!data.iconKey.equals("none") && TextureCache.getIcon(data.iconKey).equals(Icon.NONE)) + return false; + } - if (split.length == 4) { - String[] patterns = split[3].split("&"); - if (patterns.length != 2) return false; - return BasicComponentFactory.hasElementPattern(patterns[0]) && BasicComponentFactory.hasElementPattern(patterns[1]); + // 验证模式有效性(如果有) + if (data.hasPatterns) { + if (!BasicComponentFactory.hasElementPattern(data.pattern1)) return false; + return BasicComponentFactory.hasElementPattern(data.pattern2); } return true; } - @NotNull - public static Set, Supplier>> collectCREntityBindCursor(@NotNull List list) { - return list.stream() - .map(s -> { - String[] split = s.split("\\|"); - if (split.length < 3 || split.length > 4) return OF_EMPTY; - - Optional> typeOpt = EntityType.byString(split[0]); - if (typeOpt.isEmpty()) return OF_EMPTY; - EntityType entityType = typeOpt.get(); - - Icon pointerIcon = TextureCache.getIcon(split[1]); - if (!split[1].equals("none") && pointerIcon.equals(Icon.NONE)) return OF_EMPTY; - - Icon icon = TextureCache.getIcon(split[2]); - if (!split[2].equals("none") && icon.equals(Icon.NONE)) return OF_EMPTY; - - Supplier supplier; - - if (split.length == 4) { - String[] patterns = split[3].split("&"); - if (patterns.length == 2 && - BasicComponentFactory.hasElementPattern(patterns[0]) && - BasicComponentFactory.hasElementPattern(patterns[1])) { - supplier = () -> new TRelativeCursor( - BasicComponentFactory.getElementComponent(pointerIcon, patterns[0]).get(), - BasicComponentFactory.getElementComponent(icon, patterns[1]).get() - ); - return new Pair, Supplier>(entityType, supplier); - } - } - - supplier = () -> new TRelativeCursor( - BasicComponentFactory.getDefault(pointerIcon).get(), - BasicComponentFactory.getDefault(icon).get() - ); - return new Pair, Supplier>(entityType, supplier); - }) - .filter(p -> p != OF_EMPTY) - .collect(Collectors.toSet()); + private static Pair, Supplier> buildCRCursorPair(CRCursorParseData data) { + Icon pointerIcon = TextureCache.getIcon(data.pointerKey); + Icon icon = TextureCache.getIcon(data.iconKey); + + Supplier supplier; + + if (data.hasPatterns) { + supplier = () -> new TRelativeCursor( + BasicComponentFactory.getElementComponent(pointerIcon, data.pattern1).get(), + BasicComponentFactory.getElementComponent(icon, data.pattern2).get() + ); + } else { + supplier = () -> new TRelativeCursor( + BasicComponentFactory.getDefault(pointerIcon).get(), + BasicComponentFactory.getDefault(icon).get() + ); + } + + return new Pair<>(data.entityType, supplier); } - public static boolean isValidCREntityBindDTCursor(Object o) { - /* entityType|type:icon(|optionalPattern) */ - /* optionalPattern = opt:type */ + private static DTCursorParseData parseDTCursorData(Object o) { + DTCursorParseData data = new DTCursorParseData(); - if (!(o instanceof String s)) return false; - String[] split = s.split("\\|"); - if (split.length < 2 || split.length > 3) return false; + // 步骤1: 类型检查 + if (!(o instanceof String config)) return data.invalid(); - Optional> typeOpt = EntityType.byString(split[0]); - if (typeOpt.isEmpty()) return false; + // 步骤2: 分割验证 + data.parts = config.split("\\|"); + if (data.parts.length < 2 || data.parts.length > 3) return data.invalid(); - String[] style = split[1].split(":"); - if (style.length != 2) return false; + // 步骤3: 解析实体类型 + Optional> typeOpt = EntityType.byString(data.parts[0]); + if (typeOpt.isEmpty()) return data.invalid(); + data.entityType = typeOpt.get(); - if (TModClient.isLoaded) { - if (!style[1].equals("none") && TextureCache.getIcon(style[1]).equals(Icon.NONE)) - if (TextureCache.getIcon(style[1]).equals(Icon.NONE)) return false; + // 步骤4: 解析样式和图标 + String[] styleParts = data.parts[1].split(":"); + if (styleParts.length != 2) return data.invalid(); + data.style = styleParts[0]; + data.iconKey = styleParts[1]; + + // 步骤5: 处理可选模式 + if (data.parts.length == 3) { + data.optionalPattern = data.parts[2]; + data.hasOptionalPattern = true; } - if (!(style[0].equals("normal") || style[0].equals("3body"))) return false; + return data.valid(); + } + + private static boolean validateDTCursorData(DTCursorParseData data) { + if (!data.valid) return false; + + // 验证样式类型 + if (!data.style.equals("normal") && !data.style.equals("3body")) return false; - if (split.length == 3) return BasicComponentFactory.hasElementPattern(split[2]); + // 验证图标有效性 + if (TModClient.isLoaded && !data.iconKey.equals("none")) { + if (TextureCache.getIcon(data.iconKey).equals(Icon.NONE)) return false; + } + + // 验证可选模式(如果有) + if (data.hasOptionalPattern) { + return BasicComponentFactory.hasElementPattern(data.optionalPattern); + } return true; } - @NotNull - public static Set, Supplier>> collectDTEntityBindCursor(@NotNull List list) { - return list.stream() - .map(s -> { - String[] split = s.split("\\|"); - if (split.length < 2 || split.length > 3) return OF_EMPTY; - - Optional> typeOpt = EntityType.byString(split[0]); - if (typeOpt.isEmpty()) return OF_EMPTY; - EntityType entityType = typeOpt.get(); - - String[] style = split[1].split(":"); - if (style.length != 2) return OF_EMPTY; - - Icon icon = TextureCache.getIcon(style[1]); - if (!style[1].equals("none") && icon.equals(Icon.NONE)) { - icon = TextureCache.getIcon(style[1]); - if (icon.equals(Icon.NONE)) return OF_EMPTY; - } - Supplier cps; - if (split.length == 3) cps = BasicComponentFactory.getElementComponent(icon, split[2]); - else cps = BasicComponentFactory.getDefault(icon); - - Supplier supplier; - if (style[0].equals("3body")){ - supplier = () -> new TDir3BodyCursor(cps.get(), cps.get(), cps.get()); - } else if (style[0].equals("normal")){ - supplier = () -> new TDirectProjCursor(cps.get()); - } else return OF_EMPTY; - - return new Pair, Supplier>(entityType, supplier); - }) - .filter(p -> p != OF_EMPTY) - .collect(Collectors.toSet()); + + private static Pair, Supplier> buildDTCursorPair(DTCursorParseData data) { + Icon icon = TextureCache.getIcon(data.iconKey); + + Supplier componentSupplier; + if (data.hasOptionalPattern) { + componentSupplier = BasicComponentFactory.getElementComponent(icon, data.optionalPattern); + } else { + componentSupplier = BasicComponentFactory.getDefault(icon); + } + + Supplier supplier; + if (data.style.equals("3body")) { + supplier = () -> new TDir3BodyCursor( + componentSupplier.get(), + componentSupplier.get(), + componentSupplier.get() + ); + } else { // "normal" + supplier = () -> new TDirectProjCursor(componentSupplier.get()); + } + + return new Pair<>(data.entityType, supplier); } -} + // ==================== 内部数据结构 ==================== + + private static class CRCursorParseData { + private boolean valid = false; + private String[] parts; + private EntityType entityType; + private String pointerKey; + private String iconKey; + private boolean hasPatterns = false; + private String pattern1; + private String pattern2; + + private CRCursorParseData valid() { this.valid = true; return this; } + private CRCursorParseData invalid() { this.valid = false; return this; } + } + + private static class DTCursorParseData { + private boolean valid = false; + private String[] parts; + private EntityType entityType; + private String style; + private String iconKey; + private boolean hasOptionalPattern = false; + private String optionalPattern; + + private DTCursorParseData valid() { this.valid = true; return this; } + private DTCursorParseData invalid() { this.valid = false; return this; } + } +} \ No newline at end of file diff --git a/src/main/java/nowebsite/makertechno/the_trackers/core/config/TConfig.java b/src/main/java/nowebsite/makertechno/the_trackers/core/config/TConfig.java index 6e784a2..0ba6046 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/core/config/TConfig.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/core/config/TConfig.java @@ -5,6 +5,7 @@ import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.event.config.ModConfigEvent; +import net.neoforged.fml.loading.LoadingModList; import net.neoforged.neoforge.common.ModConfigSpec; import nowebsite.makertechno.the_trackers.TheTrackers; import nowebsite.makertechno.the_trackers.client.gui.cursors.TRenderCursor; @@ -18,6 +19,10 @@ @EventBusSubscriber(modid = TheTrackers.MOD_ID) public class TConfig { + public static boolean isModLoaded(String modid) { + return LoadingModList.get().getModFileById(modid) != null; + } + public static final boolean TE_LOADED = isModLoaded("terra_entity"); private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); /* Basic settings. */ @@ -59,58 +64,78 @@ public class TConfig { .define("Head flat available", false); - public static final ModConfigSpec.ConfigValue> CENTER_RELATIVE_BIND = BUILDER - .comment("List of entity types with cursors for center relative display, separated with \"|\"") - .translation("the_trackers.configuration.center_relative_tracking") - .defineList( - "EntityType|PointerIconType|EntityIconType(|OptionalValue)", - List.of( - "minecraft:ender_dragon|normal|ender_dragon_head", - "minecraft:wither|normal_white|wither_head", - "terra_entity:king_slime|normal|king_slime", - "terra_entity:eye_of_cthulhu|normal|eye_of_cthulhu", - "terra_entity:brain_of_cthulhu|normal|brain_of_cthulhu", - "terra_entity:eater_of_worlds|normal|eater_of_worlds", - "terra_entity:queen_bee|normal|queen_bee", - "terra_entity:deerclops|normal|deerclops", - "terra_entity:skeletron|normal|skeletron", - "terra_entity:hill_of_flesh|normal|wall_of_flesh", - "terra_entity:wall_of_flesh|normal|wall_of_flesh", + /* Switch for those unwelcome functions */ + public static final ModConfigSpec.BooleanValue TRACK_SECONDARY_ENEMIES = BUILDER + .comment("Enable pointing secondary marked enemies") + .translation("the_trackers.configuration.track_secondary_enemies") + .define("Secondary track available", false); + /* Tracking list */ + public static final ModConfigSpec.ConfigValue> CENTER_RELATIVE_BIND = BUILDER + .comment("List of entity types with cursors for center relative display, separated with \"|\". e.g. EntityType|PointerIconType|EntityIconType(|OptionalValue)") + .translation("the_trackers.configuration.center_relative_tracking") + .defineList( + "CenterRelativeTracking", + TE_LOADED ? + List.of( + "minecraft:ender_dragon|normal|ender_dragon_head", + "minecraft:wither|normal_white|wither_head", + "terra_entity:king_slime|normal|king_slime", + "terra_entity:eye_of_cthulhu|normal|eye_of_cthulhu", + "terra_entity:brain_of_cthulhu|normal|brain_of_cthulhu", + "terra_entity:eater_of_worlds|normal|eater_of_worlds", + "terra_entity:queen_bee|normal|queen_bee", + "terra_entity:deerclops|normal|deerclops", + "terra_entity:skeletron|normal|skeletron", + "terra_entity:hill_of_flesh|normal|wall_of_flesh", + "terra_entity:wall_of_flesh|normal|wall_of_flesh" + ) : List.of( + "minecraft:ender_dragon|normal|ender_dragon_head", + "minecraft:wither|normal_white|wither_head" + ), + () -> "minecraft:player|normal_green|none", + ConfigProcessor::isValidEntityBindCRCursor + ); - "terra_entity:demon_eye|normal|none", - "terra_entity:flying_fish|normal|none", - "terra_entity:crimera|normal|none", - "terra_entity:eater_of_souls|normal|none", - "terra_entity:giant_worm|normal|none", - "terra_entity:tomb_crawler|normal|none", - "terra_entity:devourer|normal|none", - "terra_entity:cave_bat|normal|none", - "terra_entity:jungle_bat|normal|none", - "terra_entity:snatcher|normal|none", - "terra_entity:man_eater|normal|none", - "terra_entity:hornet|normal|none", - "terra_entity:hell_bat|normal|none", - "terra_entity:ice_bat|normal|none", - "terra_entity:spore_bat|normal|none", - "terra_entity:harpy|normal|none", - "terra_entity:cursed_skull|normal|none", - "terra_entity:dark_caster|normal|none", - "terra_entity:antlion_swarmer|normal|none", - "terra_entity:giant_antlion_swarmer|normal|none", - "terra_entity:wyvern|normal|none", - "terra_entity:granite_elemental|normal|none", - "terra_entity:ghost|normal|none", - "terra_entity:fire_imp|normal|none", - "terra_entity:demon|normal|none", - "terra_entity:voodoo_demon|normal|none", - "terra_entity:bone_serpent|normal|none", - "terra_entity:wither_bone_serpent|normal|none", - "terra_entity:meteor_head|normal|none" - ), - () -> "minecraft:player|normal_green|none", - ConfigProcessor::isValidEntityBindCRCursor - ); + public static final ModConfigSpec.ConfigValue> CENTER_RELATIVE_BIND_SECONDARY = BUILDER + .comment("Secondary list of entity types with cursors for center relative display, separated with \"|\". e.g. EntityType|PointerIconType|EntityIconType(|OptionalValue)") + .translation("the_trackers.configuration.center_relative_tracking_secondary") + .defineList( + "CenterRelativeTrackingSecondary", + TE_LOADED ? List.of( + "terra_entity:demon_eye|normal|none", + "terra_entity:flying_fish|normal|none", + "terra_entity:crimera|normal|none", + "terra_entity:eater_of_souls|normal|none", + "terra_entity:giant_worm|normal|none", + "terra_entity:tomb_crawler|normal|none", + "terra_entity:devourer|normal|none", + "terra_entity:cave_bat|normal|none", + "terra_entity:jungle_bat|normal|none", + "terra_entity:snatcher|normal|none", + "terra_entity:man_eater|normal|none", + "terra_entity:hornet|normal|none", + "terra_entity:hell_bat|normal|none", + "terra_entity:ice_bat|normal|none", + "terra_entity:spore_bat|normal|none", + "terra_entity:harpy|normal|none", + "terra_entity:cursed_skull|normal|none", + "terra_entity:dark_caster|normal|none", + "terra_entity:antlion_swarmer|normal|none", + "terra_entity:giant_antlion_swarmer|normal|none", + "terra_entity:wyvern|normal|none", + "terra_entity:granite_elemental|normal|none", + "terra_entity:ghost|normal|none", + "terra_entity:fire_imp|normal|none", + "terra_entity:demon|normal|none", + "terra_entity:voodoo_demon|normal|none", + "terra_entity:bone_serpent|normal|none", + "terra_entity:wither_bone_serpent|normal|none", + "terra_entity:meteor_head|normal|none" + ) : List.of(), + () -> "minecraft:player|normal_green|none", + ConfigProcessor::isValidEntityBindCRCursor + ); public static final ModConfigSpec.ConfigValue> TRACK_FULL_BIND = BUILDER .comment("List of entity types with cursors for full track display, separated with \"|\"") @@ -130,10 +155,12 @@ public class TConfig { public static int maxTrackingQuantity; public static int interval; public static boolean centerRelativeAvailable; + public static boolean secondaryAvailable; public static boolean trackFullAvailable; public static boolean headFlatAvailable; public static ProjectAlgorithmLib.Type projectAlgorithm; public static Set, Supplier>> CRCursorWithEntities; + public static Set, Supplier>> CRCursorWithSecondaryEntities; public static Set, Supplier>> DTCursorWithEntities; @SubscribeEvent @@ -143,11 +170,13 @@ static void onLoad(final ModConfigEvent event) { interval = REFRESH_POS_INTERVAL.get(); maxTrackingQuantity = MAX_TRACK_QUANTITY.get(); centerRelativeAvailable = CENTER_RELATIVE_AVAILABLE.get(); + secondaryAvailable = TRACK_SECONDARY_ENEMIES.get(); trackFullAvailable = TRACK_FULL_AVAILABLE.get(); headFlatAvailable = HEAD_FLAT_AVAILABLE.get(); projectAlgorithm = PROJECT_ALGORITHM.get(); if(TModClient.isLoaded) { CRCursorWithEntities = ConfigProcessor.collectCREntityBindCursor(CENTER_RELATIVE_BIND.get()); + CRCursorWithSecondaryEntities = ConfigProcessor.collectCREntityBindCursor(CENTER_RELATIVE_BIND_SECONDARY.get()); DTCursorWithEntities = ConfigProcessor.collectDTEntityBindCursor(TRACK_FULL_BIND.get()); EntityTracker.reCalcAllEntityGroups(); } diff --git a/src/main/java/nowebsite/makertechno/the_trackers/core/event/TModClient.java b/src/main/java/nowebsite/makertechno/the_trackers/core/event/TModClient.java index ecbd2d2..174bc98 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/core/event/TModClient.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/core/event/TModClient.java @@ -22,6 +22,7 @@ public final class TModClient { public static void onLoadComplete(FMLLoadCompleteEvent event) { isLoaded = true; TConfig.CRCursorWithEntities = ConfigProcessor.collectCREntityBindCursor(TConfig.CENTER_RELATIVE_BIND.get()); + TConfig.CRCursorWithSecondaryEntities = ConfigProcessor.collectCREntityBindCursor(TConfig.CENTER_RELATIVE_BIND_SECONDARY.get()); TConfig.DTCursorWithEntities = ConfigProcessor.collectDTEntityBindCursor(TConfig.TRACK_FULL_BIND.get()); EntityTracker.reCalcAllEntityGroups(); } diff --git a/src/main/java/nowebsite/makertechno/the_trackers/core/track/EntityTracker.java b/src/main/java/nowebsite/makertechno/the_trackers/core/track/EntityTracker.java index 509e0d5..ff6c623 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/core/track/EntityTracker.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/core/track/EntityTracker.java @@ -102,7 +102,10 @@ private static void tryCreateNew(Entity entity) { */ public static void reCalcAllEntityGroups() { ALL_GROUPS.clear(); - if (TConfig.centerRelativeAvailable) ALL_GROUPS.addAll(TConfig.CRCursorWithEntities); + if (TConfig.centerRelativeAvailable) { + ALL_GROUPS.addAll(TConfig.CRCursorWithEntities); + if (TConfig.secondaryAvailable) ALL_GROUPS.addAll(TConfig.CRCursorWithSecondaryEntities); + } if (TConfig.trackFullAvailable) ALL_GROUPS.addAll(TConfig.DTCursorWithEntities); //all.addAll(else); } diff --git a/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModChineseLanguageProvider.java b/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModChineseLanguageProvider.java index 2da2535..e0867ed 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModChineseLanguageProvider.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModChineseLanguageProvider.java @@ -37,12 +37,19 @@ protected void addTranslations() { ); addConfigurationTranslation("track_full_available", "锁定定位式指针开关", "启用或禁用锁定定位式指针"); addConfigurationTranslation("head_flat_available", "经度轴开关", "启用或禁用经度轴条"); + addConfigurationTranslation("track_secondary_enemies", "次要追踪开关", "启用或禁用追踪次要目标"); addConfigurationButtonTranslation( - "center_relative_tracking", - "中心环绕式跟踪清单", - "跟踪实体的设置", - "带有光标类型的实体类型列表,用\"|\"分隔" + "center_relative_tracking", + "中心环绕式跟踪清单", + "跟踪实体的设置", + "带有光标类型的实体类型列表,用\"|\"分隔" + ); + addConfigurationButtonTranslation( + "center_relative_tracking_secondary", + "中心环绕式次要跟踪清单", + "跟踪实体的设置", + "带有光标类型的实体类型列表,用\"|\"分隔" ); addConfigurationButtonTranslation( diff --git a/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModEnglishLanguageProvider.java b/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModEnglishLanguageProvider.java index 5ce0664..68712c7 100644 --- a/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModEnglishLanguageProvider.java +++ b/src/main/java/nowebsite/makertechno/the_trackers/data/datagen/ModEnglishLanguageProvider.java @@ -54,16 +54,27 @@ protected void addTranslations() { "Enable or disable full screen tag cursors" ); addConfigurationTranslation( - "head_flat_available", - "Longitude hud available", - "Enable or disable longitude display" + "head_flat_available", + "Longitude hud available", + "Enable or disable longitude display" + ); + addConfigurationTranslation( + "track_secondary_enemies", + "Secondary tracking available", + "Enable or disable tracking secondary targets" ); addConfigurationButtonTranslation( - "center_relative_tracking", - "Tracking settings for center-relative cursors", - "Settings for tracking entities", - "List of entity types with cursor types, separated with \"|\"" + "center_relative_tracking", + "Tracking settings for center-relative cursors", + "Settings for tracking entities", + "List of entity types with cursor types, separated with \"|\"" + ); + addConfigurationButtonTranslation( + "center_relative_tracking_secondary", + "Secondary tracking settings for center-relative cursors", + "Settings for tracking entities", + "List of entity types with cursor types, separated with \"|\"" ); addConfigurationButtonTranslation( "track_full_tracking",