Skip to content

Commit

Permalink
Option to share fairy grottos (#1072)
Browse files Browse the repository at this point in the history
* Option to share fairy grottos

* Update CrystalsLocationsManager
  • Loading branch information
kevinthegreat1 authored Dec 13, 2024
1 parent 911030d commit e0559a5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.mining.crystalsWaypoints.wishingCompassSolver = newValue)
.controller(ConfigUtils::createBooleanController)
.build())

.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.crystalsWaypoints.shareFairyGrotto"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.crystalsWaypoints.shareFairyGrotto.@Tooltip")))
.binding(defaults.mining.crystalsWaypoints.shareFairyGrotto,
() -> config.mining.crystalsWaypoints.shareFairyGrotto,
newValue -> config.mining.crystalsWaypoints.shareFairyGrotto = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//commission waypoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public static class CrystalsWaypoints {

@SerialEntry
public boolean wishingCompassSolver = true;

@SerialEntry
public boolean shareFairyGrotto = true;
}

public static class CommissionWaypoints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import org.slf4j.Logger;

import java.util.*;
Expand Down Expand Up @@ -68,7 +67,7 @@ public class CrystalsLocationsManager {

protected static Map<String, MiningLocationLabel> activeWaypoints = new HashMap<>();
protected static List<String> verifiedWaypoints = new ArrayList<>();
private static List<MiningLocationLabel.CrystalHollowsLocationsCategory> waypointsSent2Socket = new ArrayList<>();
private static final List<MiningLocationLabel.CrystalHollowsLocationsCategory> waypointsSent2Socket = new ArrayList<>();

@Init
public static void init() {
Expand Down Expand Up @@ -325,6 +324,7 @@ public static int removeWaypoint(String place) {

public static void addCustomWaypointFromSocket(MiningLocationLabel.CrystalHollowsLocationsCategory category, BlockPos pos) {
if (activeWaypoints.containsKey(category.getName())) return;
if (category == MiningLocationLabel.CrystalHollowsLocationsCategory.FAIRY_GROTTO && !SkyblockerConfigManager.get().mining.crystalsWaypoints.shareFairyGrotto) return;

removeUnknownNear(pos);
MiningLocationLabel waypoint = new MiningLocationLabel(category, pos);
Expand Down Expand Up @@ -396,9 +396,10 @@ private static void update() {
}

private static void trySendWaypoint2Socket(MiningLocationLabel.CrystalHollowsLocationsCategory category) {
if (!waypointsSent2Socket.contains(category)) {
WsMessageHandler.sendMessage(Service.CRYSTAL_WAYPOINTS, new CrystalsWaypointMessage(category, CLIENT.player.getBlockPos()));
waypointsSent2Socket.add(category);
}
if (waypointsSent2Socket.contains(category)) return;
if (category == MiningLocationLabel.CrystalHollowsLocationsCategory.FAIRY_GROTTO && !SkyblockerConfigManager.get().mining.crystalsWaypoints.shareFairyGrotto) return;

WsMessageHandler.sendMessage(Service.CRYSTAL_WAYPOINTS, new CrystalsWaypointMessage(category, CLIENT.player.getBlockPos()));
waypointsSent2Socket.add(category);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@
"skyblocker.config.mining.crystalsWaypoints.shareFail": "Can only share waypoints you have found.",
"skyblocker.config.mining.crystalsWaypoints.removeSuccess": "Removed waypoint for ",
"skyblocker.config.mining.crystalsWaypoints.removeFail": "Can only remove waypoints you have found.",
"skyblocker.config.mining.crystalsWaypoints.shareFairyGrotto": "Share Fairy Grotto",
"skyblocker.config.mining.crystalsWaypoints.shareFairyGrotto.@Tooltip": "Share Fairy Grotto locations to the web socket.",
"skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver": "Wishing Compass Solver",
"skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.@Tooltip": "Calculates and adds a waypoint at the location indicated by wishing compasses.",
"skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.enableTabMessage": "Enable crystals in the /tab to allow the compass to identify discovered items",
Expand Down

0 comments on commit e0559a5

Please sign in to comment.