Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.util.Mth;
import org.jspecify.annotations.Nullable;

@RegisterWidget
public class CrystalsHudWidget extends HudWidget {
private static final Minecraft CLIENT = Minecraft.getInstance();
protected static final Identifier MAP_TEXTURE = SkyblockerMod.id("textures/gui/crystals_map.png");
private static final Identifier MAP_ICON = Identifier.withDefaultNamespace("textures/map/decorations/player.png");
private static final List<String> SMALL_LOCATIONS = List.of("Fairy Grotto", "King Yolkar", "Corleone", "Odawa", "Key Guardian", "Unknown");
private static final List<String> SMALL_LOCATIONS = List.of("Fairy Grotto", "King Yolkar", "Corleone", "Odawa", "Key Guardian", "Xalx", "Unknown");
private static final Set<Location> AVAILABLE_LOCATIONS = Set.of(Location.CRYSTAL_HOLLOWS);

private static CrystalsHudWidget instance = null;
private static @Nullable CrystalsHudWidget instance = null;

@SuppressWarnings("unused")
public static CrystalsHudWidget getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* Manager for Crystal Hollows waypoints that handles {@link #update() location detection},
* {@link #extractLocationFromMessage(Component, Boolean) waypoints receiving}, {@link #shareWaypoint(String) sharing},
* {@link #registerWaypointLocationCommands(CommandDispatcher, CommandBuildContext) commands}, and
* {@link #extractRendering(PrimitiveCollection) render extraction}.
* {@link #extractRendering(PrimitiveCollector) render extraction}.
*/
public class CrystalsLocationsManager {
private static final Logger LOGGER = LogUtils.getLogger();
Expand Down Expand Up @@ -141,7 +141,7 @@ private static boolean extractLocationFromMessage(Component message, Boolean ove
for (MiningLocationLabel.CrystalHollowsLocationsCategory waypointLocation : WAYPOINT_LOCATIONS.values()) {
String waypointLinkedMessage = waypointLocation.getLinkedMessage();
String waypointName = waypointLocation.getName();
if (waypointLinkedMessage != null && text.contains(waypointLinkedMessage) && !verifiedWaypoints.contains(waypointName)) {
if (waypointLinkedMessage != null && text.startsWith(waypointLinkedMessage) && !verifiedWaypoints.contains(waypointName)) {
addCustomWaypoint(waypointLocation.getName(), CLIENT.player.blockPosition());
verifiedWaypoints.add(waypointName);
trySendWaypoint2Socket(waypointLocation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.mojang.serialization.Codec;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.waypoint.DistancedNamedWaypoint;
import org.jspecify.annotations.Nullable;

public class MiningLocationLabel extends DistancedNamedWaypoint {
private final Category category;
Expand Down Expand Up @@ -158,30 +159,34 @@ public int getColor() {
}
}

private static final String CRYSTALS_SPACER = " ";

/**
* enum for the different waypoints used int the crystals hud each with a {@link CrystalHollowsLocationsCategory#name} and associated {@link CrystalHollowsLocationsCategory#color}
*/
public enum CrystalHollowsLocationsCategory implements Category, StringRepresentable {
UNKNOWN("Unknown", Color.WHITE, null), //used when a location is known but what's at the location is not known
JUNGLE_TEMPLE("Jungle Temple", new Color(DyeColor.PURPLE.getTextColor()), "[NPC] Kalhuiki Door Guardian:"),
MINES_OF_DIVAN("Mines of Divan", Color.GREEN, " Jade Crystal"),
GOBLIN_QUEENS_DEN("Goblin Queen's Den", new Color(DyeColor.ORANGE.getTextColor()), " Amber Crystal"),
LOST_PRECURSOR_CITY("Lost Precursor City", Color.CYAN, " Sapphire Crystal"),
KHAZAD_DUM("Khazad-dûm", Color.YELLOW, " Topaz Crystal"),
MINES_OF_DIVAN("Mines of Divan", Color.GREEN, CRYSTALS_SPACER + "Jade Crystal"),
GOBLIN_QUEENS_DEN("Goblin Queen's Den", new Color(DyeColor.ORANGE.getTextColor()), CRYSTALS_SPACER + "Amber Crystal"),
LOST_PRECURSOR_CITY("Lost Precursor City", Color.CYAN, CRYSTALS_SPACER + "Sapphire Crystal"),
KHAZAD_DUM("Khazad-dûm", Color.YELLOW, CRYSTALS_SPACER + "Topaz Crystal"),
FAIRY_GROTTO("Fairy Grotto", Color.PINK, null),
DRAGONS_LAIR("Dragon's Lair", Color.BLACK, null),
DRAGONS_LAIR("Dragon's Lair", Color.BLACK, "[NPC] Golden Dragon:"),
CORLEONE("Corleone", Color.WHITE, null),
KING_YOLKAR("King Yolkar", Color.RED, "[NPC] King Yolkar:"),
ODAWA("Odawa", Color.MAGENTA, "[NPC] Odawa:"),
KEY_GUARDIAN("Key Guardian", Color.LIGHT_GRAY, null);
KEY_GUARDIAN("Key Guardian", Color.LIGHT_GRAY, null),
XALX("Xalx", Color.GREEN, "[NPC] Xalx:");


public static final Codec<CrystalHollowsLocationsCategory> CODEC = StringRepresentable.fromValues(CrystalHollowsLocationsCategory::values);

public final Color color;
private final String name;
private final String linkedMessage;
private final @Nullable String linkedMessage;

CrystalHollowsLocationsCategory(String name, Color color, String linkedMessage) {
CrystalHollowsLocationsCategory(String name, Color color, @Nullable String linkedMessage) {
this.name = name;
this.color = color;
this.linkedMessage = linkedMessage;
Expand All @@ -197,7 +202,7 @@ public int getColor() {
return this.color.getRGB();
}

public String getLinkedMessage() {
public @Nullable String getLinkedMessage() {
return this.linkedMessage;
}

Expand Down