aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
diff options
context:
space:
mode:
authorolim <bobq4582@gmail.com>2024-05-06 11:14:56 +0100
committerolim <bobq4582@gmail.com>2024-05-09 22:58:16 +0100
commitb47ebd85b5ecb2c9b2adbbcd80f750ca15fd433e (patch)
treec1f85f586490264d22cef0c4371484892843e59a /src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
parenta01ebfa0b30c6d7c8bd31057d31062106bc52e39 (diff)
downloadSkyblocker-b47ebd85b5ecb2c9b2adbbcd80f750ca15fd433e.tar.gz
Skyblocker-b47ebd85b5ecb2c9b2adbbcd80f750ca15fd433e.tar.bz2
Skyblocker-b47ebd85b5ecb2c9b2adbbcd80f750ca15fd433e.zip
rework to use labels instead of trying to use crystal waypoints
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
new file mode 100644
index 00000000..f3e8e935
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
@@ -0,0 +1,69 @@
+package de.hysky.skyblocker.skyblock.dwarven;
+
+import de.hysky.skyblocker.utils.Utils;
+import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
+import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
+import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
+import net.minecraft.text.Text;
+import net.minecraft.util.math.BlockPos;
+
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class CommissionLabels {
+
+ private static final Map<String, MiningLocationLabels.dwarvenCategory> DWARVEN_LOCATIONS = Arrays.stream(MiningLocationLabels.dwarvenCategory.values()).collect(Collectors.toMap(MiningLocationLabels.dwarvenCategory::toString, Function.identity()));
+ private static final Map<String, MiningLocationLabels.glaciteCategory> GLACITE_LOCATIONS = Arrays.stream(MiningLocationLabels.glaciteCategory.values()).collect(Collectors.toMap(MiningLocationLabels.glaciteCategory::toString, Function.identity()));
+
+
+ protected static List<MiningLocationLabels> activeWaypoints = new ArrayList<>();
+
+ public static void init() {
+ WorldRenderEvents.AFTER_TRANSLUCENT.register(CommissionLabels::render);
+ ClientPlayConnectionEvents.JOIN.register((_handler, _sender, _client) -> reset());
+ }
+
+ protected static void update(List<String> newCommissions) {
+ System.out.println(newCommissions);
+ activeWaypoints.clear();
+ String location = Utils.getIslandArea().substring(2);
+ //find commission locations in glacite
+ if (location.equals("Dwarven Base Camp") || location.equals("Glacite Tunnels")) {
+ for (String commission : newCommissions) {
+ for (Map.Entry<String, MiningLocationLabels.glaciteCategory> glaciteLocation : GLACITE_LOCATIONS.entrySet()) {
+ if (commission.contains(glaciteLocation.getKey())) {
+ MiningLocationLabels.glaciteCategory category = glaciteLocation.getValue();
+ for (BlockPos gemstoneLocation : category.getLocations()) {
+ activeWaypoints.add(new MiningLocationLabels(category, Text.of(category.getName()), gemstoneLocation));
+ }
+ }
+ }
+ }
+ return;
+ }
+ //find commission locations in dwarven mines
+ for (String commission : newCommissions) {
+ for (Map.Entry<String, MiningLocationLabels.dwarvenCategory> dwarvenLocation : DWARVEN_LOCATIONS.entrySet()) {
+ if (commission.contains(dwarvenLocation.getKey())) {
+ MiningLocationLabels.dwarvenCategory category = dwarvenLocation.getValue();
+ activeWaypoints.add(new MiningLocationLabels(category, Text.of(category.getName()), category.getLocation()));
+ }
+ }
+ }
+ }
+
+ private static void render(WorldRenderContext context) {
+ if (!Utils.isInDwarvenMines()) {
+ return;
+ }
+ for (MiningLocationLabels MiningLocationLabels : activeWaypoints) {
+ MiningLocationLabels.render(context);
+ }
+
+ }
+
+ private static void reset() {
+
+ }
+}