From cfb861de647e551a19096483a5d60fd10d676a63 Mon Sep 17 00:00:00 2001
From: olim <bobq4582@gmail.com>
Date: Mon, 17 Jun 2024 11:07:45 +0100
Subject: use named way-point for metal detector

---
 .../skyblocker/skyblock/dwarven/MetalDetector.java | 10 +++-------
 .../skyblock/dwarven/MiningLocationLabel.java      | 22 ----------------------
 2 files changed, 3 insertions(+), 29 deletions(-)

(limited to 'src/main/java')

diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java
index 9de636cc..ae45ff0b 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java
@@ -4,6 +4,7 @@ import de.hysky.skyblocker.config.SkyblockerConfigManager;
 import de.hysky.skyblocker.utils.Constants;
 import de.hysky.skyblocker.utils.Utils;
 import de.hysky.skyblocker.utils.render.RenderHelper;
+import de.hysky.skyblocker.utils.waypoint.NamedWaypoint;
 import de.hysky.skyblocker.utils.waypoint.Waypoint;
 import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
 import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
@@ -244,20 +245,15 @@ public class MetalDetector {
         //only one location render just that and guiding line to it
         if (possibleBlocks.size() == 1) {
             Vec3i block = possibleBlocks.getFirst().add(0, -1, 0); //the block you are taken to is one block above the chest
-            Waypoint waypoint = new Waypoint(new BlockPos(block.getX(), block.getY(), block.getZ()), SkyblockerConfigManager.get().uiAndVisuals.waypoints.waypointType, Color.yellow.getColorComponents(null));
-            MiningLocationLabel label = new MiningLocationLabel(MiningLocationLabel.CrystalHollowsOtherCategory.TREASURE, new Vec3d(block.getX() + 0.5, block.getY() + 1, block.getZ() + 0.5));
+            NamedWaypoint waypoint = new NamedWaypoint(new BlockPos(block.getX(), block.getY(), block.getZ()), Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.treasure").getString(), Color.yellow.getColorComponents(null));
             waypoint.render(context);
-            label.render(context);
             RenderHelper.renderLineFromCursor(context, Vec3d.ofCenter(block), LIGHT_GRAY, 1f, 5f);
             return;
         }
 
         for (Vec3i block : possibleBlocks) {
-
-            Waypoint waypoint = new Waypoint(new BlockPos(block.getX(), block.getY(), block.getZ()), SkyblockerConfigManager.get().uiAndVisuals.waypoints.waypointType, Color.white.getColorComponents(null));
-            MiningLocationLabel label = new MiningLocationLabel(MiningLocationLabel.CrystalHollowsOtherCategory.POSSIBLE_TREASURE, new Vec3d(block.getX() + 0.5, block.getY() + 1, block.getZ() + 0.5));
+            NamedWaypoint waypoint = new NamedWaypoint(new BlockPos(block.getX(), block.getY(), block.getZ()), Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possible").getString(), Color.white.getColorComponents(null));
             waypoint.render(context);
-            label.render(context);
         }
     }
 }
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
index 6cf5edcc..30f33aa2 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
@@ -193,26 +193,4 @@ public record MiningLocationLabel(Category category, Vec3d centerPos) implements
         }
     }
 
-    enum CrystalHollowsOtherCategory implements Category {
-        TREASURE(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.treasure") , Color.YELLOW),
-        POSSIBLE_TREASURE(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possible"), Color.WHITE);
-
-        public final Color color;
-        private final String name;
-
-        CrystalHollowsOtherCategory(Text name, Color color) {
-            this.name = name.getString();
-            this.color = color;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public int getColor() {
-            return this.color.getRGB();
-        }
-    }
 }
-- 
cgit