Skip to content

Commit

Permalink
setting gui button for radarHideInvisibleEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Dec 4, 2024
1 parent 7a4edde commit 6d9b736
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 0 deletions.
11 changes: 11 additions & 0 deletions common/src/main/java/xaeroplus/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import xaero.common.HudMod;
import xaero.hud.HudSession;
import xaero.map.core.XaeroWorldMapCore;
import xaeroplus.event.ClientPlaySessionFinalizedEvent;
Expand All @@ -28,6 +29,7 @@ public class Globals {
public static int minimapScaleMultiplier = 1;
public static int minimapSizeMultiplier = 1;
public static boolean shouldResetFBO = false;
public static boolean minimapSettingsInitialized = false;
public static ResourceKey<Level> getCurrentDimensionId() {
try {
var dim = XaeroWorldMapCore.currentSession.getMapProcessor().getMapWorld().getCurrentDimensionId();
Expand Down Expand Up @@ -69,6 +71,15 @@ public static void initStickySettings() {
}, ClientPlaySessionFinalizedEvent.class);
}

public static void initSyncedSettings() {
try {
boolean baseSetting = HudMod.INSTANCE.getSettings().radarHideInvisibleEntities;
Settings.REGISTRY.radarHideInvisibleEntities.setValue(baseSetting);
} catch (final Exception ex) {
XaeroPlus.LOGGER.error("Failed syncing setting: radarHideInvisibleEntities", ex);
}
}

public static void switchToDimension(final ResourceKey<Level> newDimId) {
if (newDimId == null) return;
try {
Expand Down
6 changes: 6 additions & 0 deletions common/src/main/java/xaeroplus/XaeroPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import xaero.map.platform.Services;
import xaeroplus.event.MinimapInitCompletedEvent;
import xaeroplus.settings.Settings;
import xaeroplus.settings.XaeroPlusSetting;

Expand All @@ -23,5 +24,10 @@ public static void initializeSettings() {
loadXPSettings();
Settings.REGISTRY.getAllSettings().forEach(XaeroPlusSetting::init);
Globals.initStickySettings();
XaeroPlus.EVENT_BUS.registerConsumer((e) -> {
if (Globals.minimapSettingsInitialized) return;
Globals.minimapSettingsInitialized = true;
Globals.initSyncedSettings();
}, MinimapInitCompletedEvent.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package xaeroplus.event;

public record MinimapInitCompletedEvent() {
public static final MinimapInitCompletedEvent INSTANCE = new MinimapInitCompletedEvent();
}
18 changes: 18 additions & 0 deletions common/src/main/java/xaeroplus/mixin/client/MixinHudMod.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package xaeroplus.mixin.client;

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;
import xaero.common.HudMod;
import xaeroplus.XaeroPlus;
import xaeroplus.event.MinimapInitCompletedEvent;

@Mixin(value = HudMod.class, remap = false)
public class MixinHudMod {

@Inject(method = "loadLater", at = @At("RETURN"))
public void onClientLoadComplete(final CallbackInfo ci) {
XaeroPlus.EVENT_BUS.call(MinimapInitCompletedEvent.INSTANCE);
}
}
16 changes: 16 additions & 0 deletions common/src/main/java/xaeroplus/settings/Settings.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package xaeroplus.settings;

import net.minecraft.client.Minecraft;
import xaero.common.HudMod;
import xaero.map.WorldMapSession;
import xaeroplus.Globals;
import xaeroplus.XaeroPlus;
import xaeroplus.module.ModuleManager;
import xaeroplus.module.impl.*;
import xaeroplus.util.BaritoneHelper;
Expand Down Expand Up @@ -700,6 +702,20 @@ public String getTranslationKey() {
"xaeroplus.setting.disable_internet",
false),
SettingLocation.WORLD_MAP_MAIN);
public final BooleanSetting radarHideInvisibleEntities = register(
BooleanSetting.create(
"Hide Invisible Entities",
"xaeroplus.setting.radar_hide_invisible_entities",
true,
(b) -> {
if (!Globals.minimapSettingsInitialized) return;
try {
HudMod.INSTANCE.getSettings().radarHideInvisibleEntities = b;
} catch (Exception e) {
XaeroPlus.LOGGER.error("Error updating radarHideInvisibleEntities", e);
}
}),
SettingLocation.MINIMAP_ENTITY_RADAR);
public final BooleanSetting expandSettingEntries = register(
BooleanSetting.create(
"Expanded Setting Entries",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Renders the estimated time of arrival on waypoint distance text. The ETA is based on the player's current speed and movement direction",
"xaeroplus.setting.disable_internet": "Disable Xaero Internet Access",
"xaeroplus.setting.disable_internet.tooltip": "Disables WorldMap and Minimap mods from using the internet to check for updates and patreon subscriptions at launch.\n Xaero mods do not expose this setting in the GUI normally.\n XaeroPlus does not use the internet regardless of this setting.",
"xaeroplus.setting.radar_hide_invisible_entities": "Hide Invisible Entities",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Configures whether invisible or sneaking entities are rendered on the radar",
"xaeroplus.setting.expanded_settings": "Expanded Settings",
"xaeroplus.setting.expanded_settings.tooltip": "Increases the number of settings shown per page on larger screens",
"xaeroplus.setting.sodium_embeddium_integration": "Sodium/Embeddium Settings Integration",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/es_ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Muestra el tiempo estimado de llegada en el texto de distancia del punto de referencia. El ETA se basa en la velocidad y dirección de movimiento actuales del jugador",
"xaeroplus.setting.disable_internet": "Deshabilitar el acceso a Internet de Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Desactiva el uso de Internet de las modificaciones de WorldMap y Minimap para buscar actualizaciones y suscripciones a Patreon en el momento del lanzamiento.\n Los mods de Xaero normalmente no exponen esta configuración en la GUI.\n XaeroPlus no utiliza Internet independientemente de esta configuración.",
"xaeroplus.setting.radar_hide_invisible_entities": "Ocultar entidades invisibles",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Configura si las entidades invisibles o agachadas se renderizan en el radar",
"xaeroplus.setting.expanded_settings": "Configuración ampliada",
"xaeroplus.setting.expanded_settings.tooltip": "Aumenta la cantidad de configuraciones que se muestran por página en pantallas más grandes",
"xaeroplus.setting.sodium_embeddium_integration": "Integración de Configuración de Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/fr_ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Affiche l'heure d'arrivée estimée sur le texte de distance du point de passage. L'ETA est basé sur la vitesse et la direction de déplacement actuelles du joueur",
"xaeroplus.setting.disable_internet": "Désactiver l'accès Internet Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Empêche les mods WorldMap et Minimap d'utiliser Internet pour vérifier les mises à jour et les abonnements Patreon au lancement.\n Les mods Xaero n'exposent pas normalement ce paramètre dans l'interface graphique.\n XaeroPlus n'utilise pas Internet quel que soit ce paramètre.",
"xaeroplus.setting.radar_hide_invisible_entities": "Masquer les entités invisibles",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Configure si les entités invisibles ou accroupies sont affichées sur le radar",
"xaeroplus.setting.expanded_settings": "Paramètres étendus",
"xaeroplus.setting.expanded_settings.tooltip": "Augmente le nombre de paramètres affichés par page sur des écrans plus grands",
"xaeroplus.setting.sodium_embeddium_integration": "Intégration des Paramètres Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/fr_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Affiche l'heure d'arrivée estimée sur le texte de distance du point de passage. L'ETA est basé sur la vitesse et la direction de déplacement actuelles du joueur",
"xaeroplus.setting.disable_internet": "Désactiver l'accès Internet Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Empêche les mods WorldMap et Minimap d'utiliser Internet pour vérifier les mises à jour et les abonnements Patreon au lancement.\n Les mods Xaero n'exposent pas normalement ce paramètre dans l'interface graphique.\n XaeroPlus n'utilise pas Internet quel que soit ce paramètre.",
"xaeroplus.setting.radar_hide_invisible_entities": "Masquer les entités invisibles",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Configure si les entités invisibles ou accroupies sont affichées sur le radar",
"xaeroplus.setting.expanded_settings": "Paramètres étendus",
"xaeroplus.setting.expanded_settings.tooltip": "Augmente le nombre de paramètres affichés par page sur des écrans plus grands",
"xaeroplus.setting.sodium_embeddium_integration": "Intégration des Paramètres Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "プレイヤーの現在の速度と移動方向に基づいて、ウェイポイントの距離に推定到着時刻を表示します",
"xaeroplus.setting.disable_internet": "Xaeroのインターネットアクセスを無効にする",
"xaeroplus.setting.disable_internet.tooltip": "WorldMapとMinimapのMODが起動時にインターネットを使用してアップデートとパトロン購読をチェックするのを無効にします。\nXaeroのMODは通常GUIでこの設定を公開しません。\nXaeroPlusはこの設定に関係なくインターネットを使用しません。",
"xaeroplus.setting.radar_hide_invisible_entities": "透明なエンティティを非表示",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "透明またはスニーク中のエンティティをレーダーに表示するかどうかを設定します",
"xaeroplus.setting.expanded_settings": "拡張設定",
"xaeroplus.setting.expanded_settings.tooltip": "大きな画面では、ページごとに表示される設定の数が増加します",
"xaeroplus.setting.sodium_embeddium_integration": "Sodium/Embeddium 設定の統合",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/pl_pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Wyświetla szacowany czas przybycia na tekście odległości do punktu. ETA opiera się na obecnej prędkości i kierunku ruchu gracza",
"xaeroplus.setting.disable_internet": "Wyłącz dostęp do Internetu Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Wyłącza modom WorldMap i Minimap korzystanie z Internetu w celu sprawdzania dostępności aktualizacji i subskrypcji Patreona przy uruchomieniu.\n Mody Xaero normalnie nie udostępniają tego ustawienia w GUI.\n XaeroPlus nie korzysta z Internetu niezależnie od tego ustawienia.",
"xaeroplus.setting.radar_hide_invisible_entities": "Ukryj niewidzialne jednostki",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Konfiguruje, czy niewidzialne lub skradające się jednostki są wyświetlane na radarze",
"xaeroplus.setting.expanded_settings": "Rozszerzone ustawienia",
"xaeroplus.setting.expanded_settings.tooltip": "Zwiększa liczbę ustawień wyświetlanych na stronie na większych ekranach",
"xaeroplus.setting.sodium_embeddium_integration": "Integracja Ustawień Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/pt_pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Exibe o tempo estimado de chegada no texto de distância do ponto de referência. O ETA é baseado na velocidade e direção de movimento atuais do jogador",
"xaeroplus.setting.disable_internet": "Desati. Acesso à Internet ao Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Desativa o acesso à Internet para verificação de atualizações ou subscrição do Patreon dos mods do mapa-mundo e mini-mapa. \n Normalmente os mods Xaero não mostram esta configuração no GUI. \n O XaeroPlus não usa a Internet independentemente desta definição.",
"xaeroplus.setting.radar_hide_invisible_entities": "Ocultar entidades invisíveis",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Configura se entidades invisíveis ou agachadas são exibidas no radar",
"xaeroplus.setting.expanded_settings": "Configurações expandidas",
"xaeroplus.setting.expanded_settings.tooltip": "Aumenta o número de configurações mostradas por página em telas maiores",
"xaeroplus.setting.sodium_embeddium_integration": "Integração de Configurações Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Отображает расчетное время прибытия на тексте расстояния до точки. ETA основано на текущей скорости и направлении движения игрока",
"xaeroplus.setting.disable_internet": "Отключить доступ Xaero в Интернет",
"xaeroplus.setting.disable_internet.tooltip": "Отключает модам WorldMap и Minimap использование Интернета для проверки обновлений и подписок на Patreon при запуске.\n Моды Xaero обычно не отображают этот параметр в графическом интерфейсе.\n XaeroPlus не использует Интернет независимо от этой настройки.",
"xaeroplus.setting.radar_hide_invisible_entities": "Скрыть невидимые сущности",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Настраивает отображение невидимых или крадущихся сущностей на радаре",
"xaeroplus.setting.expanded_settings": "Расширенные настройки",
"xaeroplus.setting.expanded_settings.tooltip": "Увеличивает количество настроек, отображаемых на странице на больших экранах.",
"xaeroplus.setting.sodium_embeddium_integration": "Интеграция Настроек Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/vi_vn.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "Hiển thị thời gian đến ước tính trên văn bản khoảng cách đến điểm đường. ETA dựa trên tốc độ và hướng di chuyển hiện tại của người chơi",
"xaeroplus.setting.disable_internet": "Vô Hiệu Hóa Truy Cập Internet Xaero",
"xaeroplus.setting.disable_internet.tooltip": "Vô hiệu hóa các mod WorldMap và Minimap từ việc sử dụng internet để kiểm tra cập nhật và đăng ký patreon khi khởi động.\n Các mod Xaero không hiển thị cài đặt này trong giao diện người dùng bình thường.\n XaeroPlus không sử dụng internet bất kể cài đặt này.",
"xaeroplus.setting.radar_hide_invisible_entities": "Ẩn thực thể vô hình",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "Cấu hình liệu các thực thể vô hình hoặc đang lén lút có được hiển thị trên radar hay không",
"xaeroplus.setting.expanded_settings": "Cài đặt mở rộng",
"xaeroplus.setting.expanded_settings.tooltip": "Tăng số lượng cài đặt hiển thị trên mỗi trang trên màn hình lớn hơn",
"xaeroplus.setting.sodium_embeddium_integration": "Tích hợp Cài đặt Sodium/Embeddium",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "在航点距离文本上显示预计到达时间。ETA 基于玩家当前的速度和移动方向",
"xaeroplus.setting.disable_internet": "禁用 Xaero 互联网访问",
"xaeroplus.setting.disable_internet.tooltip": "禁止 WorldMap 和 Minimap mods 在启动时使用互联网检查更新和 patreon 订阅。\n Xaero mods 通常不会在 GUI 中公开此设置。\n 无论此设置如何,XaeroPlus 都不会使用互联网。",
"xaeroplus.setting.radar_hide_invisible_entities": "隐藏隐形实体",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "设置是否在雷达上显示隐形或潜行的实体",
"xaeroplus.setting.expanded_settings": "扩展设置",
"xaeroplus.setting.expanded_settings.tooltip": "增加大屏幕上每页显示的设置数量",
"xaeroplus.setting.sodium_embeddium_integration": "Sodium/Embeddium 设置集成",
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"xaeroplus.setting.waypoint_eta.tooltip": "在航點距離文本上顯示預計到達時間。ETA 基於玩家當前的速度和移動方向",
"xaeroplus.setting.disable_internet": "停用 Xaero 網際網路存取",
"xaeroplus.setting.disable_internet.tooltip": "停用世界地圖和小地圖模組在啟動時使用網際網路檢查更新和 Patreon 訂閱。\n Xaero 模組通常不會在介面中公開此設定。\n 無論此設定如何,XaeroPlus 都不会使用網際網路。",
"xaeroplus.setting.radar_hide_invisible_entities": "隱藏隱形實體",
"xaeroplus.setting.radar_hide_invisible_entities.tooltip": "設置是否在雷達上顯示隱形或潛行的實體",
"xaeroplus.setting.expanded_settings": "擴展設定",
"xaeroplus.setting.expanded_settings.tooltip": "在較大的螢幕上增加每頁顯示的設定數量",
"xaeroplus.setting.sodium_embeddium_integration": "Sodium/Embeddium 設定集成",
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/xaeroplus.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"MixinGuiWaypointSettings",
"MixinGuiWaypointsList",
"MixinGuiWorldMapSettings",
"MixinHudMod",
"MixinImprovedFramebuffer",
"MixinKeyEventHandler",
"MixinLeveledRegion",
Expand Down

0 comments on commit 6d9b736

Please sign in to comment.