Skip to content

Commit

Permalink
add option to turn off specific map mod integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
omergunr100 committed Dec 29, 2024
1 parent e3d958e commit fd45b70
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,7 @@
"config.gtceu.option.bronzeBoilerMaxTemperature": "ǝɹnʇɐɹǝdɯǝ⟘xɐWɹǝןıoᗺǝzuoɹq",
"config.gtceu.option.buttonAnchor": "ɹoɥɔuⱯuoʇʇnq",
"config.gtceu.option.casingsPerCraft": "ʇɟɐɹƆɹǝԀsbuısɐɔ",
"config.gtceu.option.chunksIntegration": "uoıʇɐɹbǝʇuIsʞunɥɔ",
"config.gtceu.option.cleanMultiblocks": "sʞɔoןqıʇןnWuɐǝןɔ",
"config.gtceu.option.client": "ʇuǝıןɔ",
"config.gtceu.option.compat": "ʇɐdɯoɔ",
Expand Down Expand Up @@ -1786,6 +1787,7 @@
"config.gtceu.option.inWorldPreviewDuration": "uoıʇɐɹnᗡʍǝıʌǝɹԀpןɹoMuı",
"config.gtceu.option.increaseDungeonLoot": "ʇooꞀuoǝbunᗡǝsɐǝɹɔuı",
"config.gtceu.option.infiniteBedrockOresFluids": "spınןℲsǝɹOʞɔoɹpǝᗺǝʇıuıɟuı",
"config.gtceu.option.journeyMapIntegration": "uoıʇɐɹbǝʇuIdɐWʎǝuɹnoظ",
"config.gtceu.option.largeBoilers": "sɹǝןıoᗺǝbɹɐן",
"config.gtceu.option.ldFluidPipeMinDistance": "ǝɔuɐʇsıᗡuıWǝdıԀpınןℲpן",
"config.gtceu.option.ldItemPipeMinDistance": "ǝɔuɐʇsıᗡuıWǝdıԀɯǝʇIpן",
Expand Down Expand Up @@ -1845,6 +1847,7 @@
"config.gtceu.option.surfaceRockProspectRange": "ǝbuɐᴚʇɔǝdsoɹԀʞɔoᴚǝɔɐɟɹns",
"config.gtceu.option.titaniumBoilerHeatSpeed": "pǝǝdSʇɐǝHɹǝןıoᗺɯnıuɐʇıʇ",
"config.gtceu.option.titaniumBoilerMaxTemperature": "ǝɹnʇɐɹǝdɯǝ⟘xɐWɹǝןıoᗺɯnıuɐʇıʇ",
"config.gtceu.option.toggle": "ǝןbboʇ",
"config.gtceu.option.toolCraftingSounds": "spunoSbuıʇɟɐɹƆןooʇ",
"config.gtceu.option.toolUseSounds": "spunoSǝs∩ןooʇ",
"config.gtceu.option.tools": "sןooʇ",
Expand All @@ -1864,6 +1867,7 @@
"config.gtceu.option.worldAcceleratorBlacklist": "ʇsıןʞɔɐןᗺɹoʇɐɹǝןǝɔɔⱯpןɹoʍ",
"config.gtceu.option.worldgen": "uǝbpןɹoʍ",
"config.gtceu.option.xOffset": "ʇǝsɟɟOx",
"config.gtceu.option.xaeroxMapIntegration": "uoıʇɐɹbǝʇuIdɐWxoɹǝɐx",
"config.gtceu.option.yOffset": "ʇǝsɟɟOʎ",
"config.gtceu.option.zombieSpawnWithSabers": "sɹǝqɐSɥʇıMuʍɐdSǝıqɯoz",
"config.jade.plugin_gtceu.auto_output_info": "oɟuI ʇndʇnO oʇnⱯ ]nƎƆ⟘⅁[",
Expand Down
4 changes: 4 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,7 @@
"config.gtceu.option.bronzeBoilerMaxTemperature": "bronzeBoilerMaxTemperature",
"config.gtceu.option.buttonAnchor": "buttonAnchor",
"config.gtceu.option.casingsPerCraft": "casingsPerCraft",
"config.gtceu.option.chunksIntegration": "chunksIntegration",
"config.gtceu.option.cleanMultiblocks": "cleanMultiblocks",
"config.gtceu.option.client": "client",
"config.gtceu.option.compat": "compat",
Expand Down Expand Up @@ -1786,6 +1787,7 @@
"config.gtceu.option.inWorldPreviewDuration": "inWorldPreviewDuration",
"config.gtceu.option.increaseDungeonLoot": "increaseDungeonLoot",
"config.gtceu.option.infiniteBedrockOresFluids": "infiniteBedrockOresFluids",
"config.gtceu.option.journeyMapIntegration": "journeyMapIntegration",
"config.gtceu.option.largeBoilers": "largeBoilers",
"config.gtceu.option.ldFluidPipeMinDistance": "ldFluidPipeMinDistance",
"config.gtceu.option.ldItemPipeMinDistance": "ldItemPipeMinDistance",
Expand Down Expand Up @@ -1845,6 +1847,7 @@
"config.gtceu.option.surfaceRockProspectRange": "surfaceRockProspectRange",
"config.gtceu.option.titaniumBoilerHeatSpeed": "titaniumBoilerHeatSpeed",
"config.gtceu.option.titaniumBoilerMaxTemperature": "titaniumBoilerMaxTemperature",
"config.gtceu.option.toggle": "toggle",
"config.gtceu.option.toolCraftingSounds": "toolCraftingSounds",
"config.gtceu.option.toolUseSounds": "toolUseSounds",
"config.gtceu.option.tools": "tools",
Expand All @@ -1864,6 +1867,7 @@
"config.gtceu.option.worldAcceleratorBlacklist": "worldAcceleratorBlacklist",
"config.gtceu.option.worldgen": "worldgen",
"config.gtceu.option.xOffset": "xOffset",
"config.gtceu.option.xaeroxMapIntegration": "xaeroxMapIntegration",
"config.gtceu.option.yOffset": "yOffset",
"config.gtceu.option.zombieSpawnWithSabers": "zombieSpawnWithSabers",
"config.jade.plugin_gtceu.auto_output_info": "[GTCEu] Auto Output Info",
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.gregtechceu.gtceu.common.data.GTEntityTypes;
import com.gregtechceu.gtceu.common.data.GTParticleTypes;
import com.gregtechceu.gtceu.common.entity.GTBoat;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ClientCacheManager;
import com.gregtechceu.gtceu.integration.map.cache.client.GTClientCache;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksPlugin;
Expand All @@ -20,7 +21,6 @@
import com.gregtechceu.gtceu.integration.map.layer.builtin.OreRenderLayer;
import com.gregtechceu.gtceu.utils.input.KeyBind;

import com.lowdragmc.lowdraglib.LDLib;
import com.lowdragmc.lowdraglib.Platform;

import net.minecraft.client.model.BoatModel;
Expand Down Expand Up @@ -100,7 +100,8 @@ public void onRegisterParticleProviders(RegisterParticleProvidersEvent event) {

@SubscribeEvent
public void onClientSetup(FMLClientSetupEvent event) {
if (LDLib.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
if (ConfigHolder.INSTANCE.compat.minimap.toggle.chunksIntegration &&
Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
FTBChunksPlugin.addEventListeners();
}
}
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ public static class AE2CompatConfig {

public static class MinimapCompatConfig {

@Configurable
@Configurable.Comment({
"Toggle specific map mod integration on/off (need to restart for this to take effect)" })
public Toggle toggle = new Toggle();

@Configurable
@Configurable.Comment({ "The radius, in blocks, that picking up a surface rock will search for veins in.",
"-1 to disable.", "Default: 24" })
@Configurable.Range(min = 1)
public int surfaceRockProspectRange = 24;

@Configurable
@Configurable.Comment({ "The radius, in blocks, that clicking an ore block will search for veins in.",
"-1 to disable", "Default: 24" })
Expand Down Expand Up @@ -264,6 +268,21 @@ public static class MinimapCompatConfig {
"Default: true" })
public boolean rightToolbar = true;

public static class Toggle {

@Configurable
@Configurable.Comment({ "FTB Chunks integration enabled" })
public boolean chunksIntegration = false;

@Configurable
@Configurable.Comment({ "Journey Map integration enabled" })
public boolean journeyMapIntegration = true;

@Configurable
@Configurable.Comment({ "Xaerox's map integration enabled" })
public boolean xaeroxMapIntegration = true;
}

public enum Anchor {

TOP_LEFT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.ftbchunks;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ButtonState;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksOptions;

Expand Down Expand Up @@ -30,6 +31,7 @@ public abstract class LargeMapScreenMixin extends BaseScreen {

@Inject(method = "addWidgets", at = @At(value = "TAIL"))
private void gtceu$injectAddWidgets(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.chunksIntegration) return;
gtceu$injectedWidgets.clear();
var prefix = "gtceu.button.";
for (var button : ButtonState.getAllButtons()) {
Expand Down Expand Up @@ -63,6 +65,7 @@ public void addMouseOverText(TooltipList list) {

@Inject(method = "alignWidgets", at = @At(value = "TAIL"))
private void gtceu$injectAlignWidgets(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.chunksIntegration) return;
var buttonCount = gtceu$injectedWidgets.size();
var startHeight = (height - buttonCount * 18) / 2;
for (int i = 0; i < buttonCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.ftbchunks;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksOptions;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksRenderer;
import com.gregtechceu.gtceu.integration.map.ftbchunks.veins.fluid.FluidVeinIcon;
Expand Down Expand Up @@ -36,6 +37,7 @@ public RegionMapPanelMixin(Panel panel) {
@Inject(method = "addWidgets",
at = @At(value = "INVOKE", target = "Ldev/ftb/mods/ftbchunks/client/gui/RegionMapPanel;alignWidgets()V"))
private void gtceu$injectAddWidgets(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.chunksIntegration) return;
if (FTBChunksOptions.showLayer("bedrock_fluids")) {
FTBChunksRenderer.fluidElements.row(largeMap.currentDimension()).forEach((pos, icon) -> {
var widget = new FluidVeinWidget((RegionMapPanel) (Object) this, icon);
Expand All @@ -46,6 +48,7 @@ public RegionMapPanelMixin(Panel panel) {

@Inject(method = "alignWidgets", at = @At(value = "TAIL"))
private void gtceu$injectAlignWidgets(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.chunksIntegration) return;
var regionSize = largeMap.getRegionTileSize();
var chunkSize = largeMap.getRegionTileSize() / 32;
for (var widget : widgets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public FullscreenMixin(String title) {
shift = At.Shift.AFTER),
remap = false)
private void gtceu$injectInitButtons(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.journeyMapIntegration) return;
final Theme theme = ThemeLoader.getCurrentTheme();
gtceu$buttons = new LinkedHashMap<>();

Expand Down Expand Up @@ -79,6 +80,7 @@ public FullscreenMixin(String title) {

@Inject(method = "layoutButtons", at = @At("TAIL"), remap = false)
private void gtceu$injectLayoutButtons(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.journeyMapIntegration) return;
for (String buttonName : gtceu$buttons.keySet()) {
gtceu$buttons.get(buttonName).setToggled(ButtonState.isEnabled(buttonName), false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.xaerominimap;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.xaeros.minimap.fluid.FluidChunkHighlighter;

import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -19,6 +20,7 @@ public abstract class HighlighterRegistryMixin {

@Inject(method = "<init>", at = @At("TAIL"))
private void gtceu$registerHighlighters(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration) return;
this.register(new FluidChunkHighlighter());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.xaerominimap;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.xaeros.minimap.ore.OreVeinElementRenderer;

import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -37,6 +38,7 @@ public MinimapFBORendererMixin(IXaeroMinimap modMain, Minecraft mc, WaypointsGui
@Inject(method = "loadFrameBuffer",
at = @At(value = "INVOKE", target = "Lxaero/common/mods/SupportMods;worldmap()Z"))
private void gtceu$injectProspectionMarkers(MinimapProcessor minimapProcessor, CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration) return;
this.gtceu$oreVeinElementRenderer = OreVeinElementRenderer.Builder.begin().build();
minimapElementMapRendererHandler.add(this.gtceu$oreVeinElementRenderer);
this.minimap.getOverMapRendererHandler().add(this.gtceu$oreVeinElementRenderer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ protected GuiMapMixin(Screen parent, Screen escape, MapProcessor mapProcessor, E

@Inject(method = "init", at = @At("TAIL"), remap = true)
private void gtceu$injectInitGui(CallbackInfo ci) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration) return;
int startX, startY, xOffset, yOffset;

switch (ConfigHolder.INSTANCE.compat.minimap.direction) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.xaeroworldmap;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.xaeros.worldmap.ore.OreVeinElementRenderer;

import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -15,7 +16,9 @@ public class MapElementRenderHandlerBuilderMixin {

@ModifyVariable(method = "build", at = @At(value = "LOAD", ordinal = 3))
private List<MapElementRenderer<?, ?, ?>> gtceu$addOreRenderer(List<MapElementRenderer<?, ?, ?>> value) {
value.add(OreVeinElementRenderer.Builder.begin().build());
if (ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration) {
value.add(OreVeinElementRenderer.Builder.begin().build());
}
return value;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.core.mixins.xaeroworldmap;

import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.xaeros.worldmap.fluid.FluidChunkHighlighter;

import net.minecraft.client.multiplayer.ClientPacketListener;
Expand All @@ -23,6 +24,7 @@ public abstract class WorldMapSessionMixin {
locals = LocalCapture.CAPTURE_FAILSOFT)
private void cadmus$registerHighlighters(ClientPacketListener connection, long biomeZoomSeed, CallbackInfo ci,
@Local HighlighterRegistry highlightRegistry) {
if (!ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration) return;
highlightRegistry.register(new FluidChunkHighlighter());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata;
import com.gregtechceu.gtceu.api.gui.misc.ProspectorMode;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksRenderer;
import com.gregtechceu.gtceu.integration.map.journeymap.JourneymapRenderer;
import com.gregtechceu.gtceu.integration.map.xaeros.XaerosRenderer;
Expand All @@ -28,13 +29,14 @@ public class GroupingMapRenderer extends GenericMapRenderer {

static {
Map<String, GenericMapRenderer> renderers = new HashMap<>();
if (Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) {
var toggle = ConfigHolder.INSTANCE.compat.minimap.toggle;
if (toggle.journeyMapIntegration && Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) {
renderers.put(GTValues.MODID_JOURNEYMAP, new JourneymapRenderer());
}
if (Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) {
if (toggle.xaeroxMapIntegration && Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) {
renderers.put(GTValues.MODID_XAEROS_MINIMAP, new XaerosRenderer());
}
if (Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
if (toggle.chunksIntegration && Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
renderers.put(GTValues.MODID_FTB_CHUNKS, new FTBChunksRenderer());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gregtechceu.gtceu.integration.map;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksWaypointHandler;
import com.gregtechceu.gtceu.integration.map.journeymap.JourneymapWaypointHandler;
import com.gregtechceu.gtceu.integration.map.xaeros.XaeroWaypointHandler;
Expand Down Expand Up @@ -28,15 +29,16 @@ public class WaypointManager {
private static boolean active = false;

public static void init() {
if (Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) {
var toggle = ConfigHolder.INSTANCE.compat.minimap.toggle;
if (toggle.xaeroxMapIntegration && Platform.isModLoaded(GTValues.MODID_XAEROS_MINIMAP)) {
WaypointManager.registerWaypointHandler(new XaeroWaypointHandler());
active = true;
}
if (Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) {
if (toggle.journeyMapIntegration && Platform.isModLoaded(GTValues.MODID_JOURNEYMAP)) {
WaypointManager.registerWaypointHandler(new JourneymapWaypointHandler());
active = true;
}
if (Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
if (toggle.chunksIntegration && Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
WaypointManager.registerWaypointHandler(new FTBChunksWaypointHandler());
active = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gregtechceu.gtceu.integration.map.xaeros;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.config.ConfigHolder;

import com.lowdragmc.lowdraglib.Platform;

Expand Down Expand Up @@ -32,7 +33,8 @@ public static void toggleOption(String name, boolean active) {
dimHighlightHandler.requestRefresh();
}

if (Platform.isModLoaded(GTValues.MODID_XAEROS_WORLDMAP)) {
if (ConfigHolder.INSTANCE.compat.minimap.toggle.xaeroxMapIntegration &&
Platform.isModLoaded(GTValues.MODID_XAEROS_WORLDMAP)) {
WorldMapSession session = WorldMapSession.getCurrentSession();
MapWorld world = session.getMapProcessor().getMapWorld();
for (MapDimension mapDim : world.getDimensionsList()) {
Expand Down

0 comments on commit fd45b70

Please sign in to comment.