Skip to content

Commit

Permalink
Add config option to only show "know" waypoints (#27)
Browse files Browse the repository at this point in the history
* Add config option to only show "know" waypoints
  • Loading branch information
UnRealDinnerbone authored Oct 25, 2024
1 parent d5abed1 commit 2a03e61
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ftb.mods.ftbxmodcompat.config;

import dev.ftb.mods.ftblibrary.config.NameMap;
import dev.ftb.mods.ftblibrary.snbt.config.BooleanValue;
import dev.ftb.mods.ftblibrary.snbt.config.EnumValue;
import dev.ftb.mods.ftblibrary.snbt.config.SNBTConfig;
import dev.ftb.mods.ftbxmodcompat.FTBXModCompat;
Expand All @@ -16,6 +17,9 @@ public interface FTBXModConfig {
EnumValue<PermSelector> PERMISSION_SELECTOR = CONFIG.addEnum("permission_selector", NameMap.of(PermSelector.DEFAULT, PermSelector.values()).create())
.comment("Select the permissions implementation to use", "DEFAULT: use FTB Ranks then Luckperms in preference order, depending on mod availability");

BooleanValue ONLY_SHOW_KNOWN_WAYSTONES = CONFIG.addBoolean("only_show_known_waystones", true)
.comment("Only show waystones that have been discovered");

enum StageSelector {
DEFAULT(()-> true),
VANILLA(() -> true),
Expand Down
3 changes: 2 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ processResources {
"ftbquestsversion": project.ftb_quests_version,
"ftbchunksversion": project.ftb_chunks_version,
"ftbranksversion": project.ftb_ranks_version,
"ftbteamsversion": project.ftb_teams_version
"ftbteamsversion": project.ftb_teams_version,
"required_waystones_version": project.required_waystones_version
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
package dev.ftb.mods.ftbxmodcompat.fabric.ftbchunks.waystones;

import dev.ftb.mods.ftbxmodcompat.FTBXModCompat;
import com.mojang.logging.LogUtils;
import dev.ftb.mods.ftbxmodcompat.config.FTBXModConfig;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneData;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneMapIcon;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystonesCommon;
import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.waystones.api.Waystone;
import net.blay09.mods.waystones.api.WaystoneVisibility;
import net.blay09.mods.waystones.api.WaystonesAPI;
import net.blay09.mods.waystones.api.event.WaystoneRemoveReceivedEvent;
import net.blay09.mods.waystones.api.event.WaystoneUpdatedEvent;
import net.minecraft.client.Minecraft;
import org.slf4j.Logger;

public class WaystonesCompat {
private static final Logger LOGGER = LogUtils.getLogger();

public static void init() {
Balm.getEvents().onEvent(WaystoneUpdatedEvent.class, WaystonesCompat::updateWaystone);
Balm.getEvents().onEvent(WaystoneRemoveReceivedEvent.class, WaystonesCompat::removeWaystone);
}

private static void removeWaystone(WaystoneRemoveReceivedEvent event) {
FTBXModCompat.LOGGER.info("waystone removed: " + event.getWaystoneId());
LOGGER.trace("Waystone removed: {}", event.getWaystoneId());
WaystonesCommon.removeWaystone(event.getWaystoneId());
}

private static void updateWaystone(WaystoneUpdatedEvent event) {
FTBXModCompat.LOGGER.info("waystone updated: " + event.getWaystone().getWaystoneUid());
LOGGER.trace("waystone updated: {} {}", event.getWaystone().getWaystoneUid(), event.getWaystone().getVisibility());
Waystone w = event.getWaystone();
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL)));
if (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(Minecraft.getInstance().player, w)) {
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL)));
}
}
}
3 changes: 2 additions & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"ftbquests": "<2001.3.0",
"ftbchunks": "<2001.2.0",
"jei": "<15.2",
"kubejs": "<2001.6.3-build.18"
"kubejs": "<2001.6.3-build.18",
"waystones": "<${required_waystones_version}"
}
}
12 changes: 7 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ neoforge_version=21.1.13
neoforge_version_range=[21.1.0,)
neoforge_loader_version=4
fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21
fabric_api_version=0.106.0+1.21.1
fabric_api_version_range=>=0.100.1+1.21

architectury_version=13.0.6
Expand All @@ -31,14 +31,16 @@ ftb_filter_system_version=21.0.0
rei_version=16.0.729
common_prot_api_version=1.0.0
luckperms_api_version=5.4
waystones_neoforge_version=5427156
waystones_neoforge_version=5841748
waystones_forge_version=5427151
waystones_fabric_version=5427150
balm_neoforge_version=5438018
waystones_fabric_version=5841746
balm_neoforge_version=5798246
balm_forge_version=5438000
balm_fabric_version=5437997
jei_version=19.8.5.118
jei_version=19.21.0.246
kubejs_version=2100.7.0-build.56

required_waystones_version=21.1.5

# TODO compiling against 1.20.4 version for now
gamestages_version=15.0.1
3 changes: 2 additions & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ processResources {
"ftbquestsversion": project.ftb_quests_version,
"ftbchunksversion": project.ftb_chunks_version,
"ftbranksversion": project.ftb_ranks_version,
"ftbteamsversion": project.ftb_teams_version
"ftbteamsversion": project.ftb_teams_version,
"required_waystones_version": project.required_waystones_version
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
package dev.ftb.mods.ftbxmodcompat.neoforge.ftbchunks.waystones;

import dev.ftb.mods.ftbxmodcompat.FTBXModCompat;
import com.mojang.logging.LogUtils;
import dev.ftb.mods.ftbxmodcompat.config.FTBXModConfig;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneData;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneMapIcon;
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystonesCommon;
import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.waystones.api.Waystone;
import net.blay09.mods.waystones.api.WaystoneVisibility;
import net.blay09.mods.waystones.api.WaystonesAPI;
import net.blay09.mods.waystones.api.event.*;
import net.minecraft.client.Minecraft;
import org.slf4j.Logger;

public class WaystonesCompat {
private static final Logger LOGGER = LogUtils.getLogger();

public static void init() {
Balm.getEvents().onEvent(WaystoneUpdatedEvent.class, WaystonesCompat::updateWaystone);
Balm.getEvents().onEvent(WaystoneRemoveReceivedEvent.class, WaystonesCompat::removeWaystone);
}

private static void removeWaystone(WaystoneRemoveReceivedEvent event) {
FTBXModCompat.LOGGER.info("waystone removed: " + event.getWaystoneId());
LOGGER.trace("Waystone removed: {}", event.getWaystoneId());
WaystonesCommon.removeWaystone(event.getWaystoneId());
}

private static void updateWaystone(WaystoneUpdatedEvent event) {
FTBXModCompat.LOGGER.info("waystone updated: " + event.getWaystone().getWaystoneUid());
LOGGER.trace("waystone updated: {} {}", event.getWaystone().getWaystoneUid(), event.getWaystone().getVisibility());
Waystone w = event.getWaystone();
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL)));
if (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(Minecraft.getInstance().player, w)) {
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL)));
}
}
}
7 changes: 6 additions & 1 deletion neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ modId = "luckperms"
type = "optional"
versionRange = "[5.4.112,)"
ordering = "AFTER"
side = "SERVER"
side = "SERVER"

[[dependencies.ftbxmodcompat]]
modId = "waystones"
type = "optional"
versionRange = "[${required_waystones_version},)"

0 comments on commit 2a03e61

Please sign in to comment.