From 4434668d70d7c63b176a811c2f710c0bcae1db87 Mon Sep 17 00:00:00 2001 From: Kevin <92656833+kevinthegreat1@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:07:13 -0500 Subject: [PATCH] Accept integer names (#1110) --- .../utils/waypoint/NamedWaypoint.java | 5 +- .../utils/waypoint/WaypointsTest.java | 51 +++++++++++++++++-- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/utils/waypoint/NamedWaypoint.java b/src/main/java/de/hysky/skyblocker/utils/waypoint/NamedWaypoint.java index 2b9cb26ede..ee3a098be5 100644 --- a/src/main/java/de/hysky/skyblocker/utils/waypoint/NamedWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/utils/waypoint/NamedWaypoint.java @@ -19,6 +19,7 @@ import java.util.Objects; import java.util.Optional; import java.util.OptionalDouble; +import java.util.function.Function; import java.util.function.Supplier; public class NamedWaypoint extends Waypoint { @@ -36,7 +37,7 @@ public class NamedWaypoint extends Waypoint { Codec.INT.fieldOf("x").forGetter(waypoint -> waypoint.pos.getX()), Codec.INT.fieldOf("y").forGetter(waypoint -> waypoint.pos.getY()), Codec.INT.fieldOf("z").forGetter(waypoint -> waypoint.pos.getZ()), - Codec.either(Codec.STRING, Codec.INT).xmap(either -> either.map(str -> str, Object::toString), Either::left).fieldOf("name").forGetter(waypoint -> waypoint.name.getString()), + Codec.either(Codec.STRING, Codec.INT).xmap(either -> either.map(Function.identity(), Object::toString), Either::left).fieldOf("name").forGetter(waypoint -> waypoint.name.getString()), Codec.INT.optionalFieldOf("color", ColorHelper.getArgb(128, 0, 255, 0)).forGetter(waypoint -> (int) (waypoint.alpha * 255) << 24 | (int) (waypoint.colorComponents[0] * 255) << 16 | (int) (waypoint.colorComponents[1] * 255) << 8 | (int) (waypoint.colorComponents[2] * 255)), Codec.BOOL.fieldOf("enabled").forGetter(Waypoint::isEnabled) ).apply(instance, NamedWaypoint::fromSkytils)); @@ -159,7 +160,7 @@ public boolean equals(Object obj) { private record ColeweightOptions(Optional name) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.STRING.optionalFieldOf("name").forGetter(ColeweightOptions::name) + Codec.either(Codec.STRING, Codec.INT).xmap(either -> either.map(Function.identity(), Object::toString), Either::left).optionalFieldOf("name").forGetter(ColeweightOptions::name) ).apply(instance, ColeweightOptions::new)); } } diff --git a/src/test/java/de/hysky/skyblocker/utils/waypoint/WaypointsTest.java b/src/test/java/de/hysky/skyblocker/utils/waypoint/WaypointsTest.java index 5e0a1dc67f..200f391ed7 100644 --- a/src/test/java/de/hysky/skyblocker/utils/waypoint/WaypointsTest.java +++ b/src/test/java/de/hysky/skyblocker/utils/waypoint/WaypointsTest.java @@ -12,7 +12,7 @@ import java.util.List; public class WaypointsTest { - private static final WaypointGroup SAPPHIRE_WAYOINTS = new WaypointGroup("Coleweight", Location.CRYSTAL_HOLLOWS, List.of( + private static final WaypointGroup SAPPHIRE_WAYPOINTS = new WaypointGroup("Coleweight", Location.CRYSTAL_HOLLOWS, List.of( new OrderedNamedWaypoint(new BlockPos(821, 137, 809), "1", new float[]{0, 1, 0}), new OrderedNamedWaypoint(new BlockPos(821, 143, 809), "2", new float[]{0, 1, 0}), new OrderedNamedWaypoint(new BlockPos(812, 154, 798), "3", new float[]{0, 1, 0}), @@ -359,21 +359,64 @@ void testFromColeweightJsonSapphire() { String coleweightJson = "[{\"x\":821,\"y\":137,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"1\"}},{\"x\":821,\"y\":143,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"2\"}},{\"x\":812,\"y\":154,\"z\":798,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"3\"}},{\"x\":817,\"y\":159,\"z\":803,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"4\"}},{\"x\":814,\"y\":168,\"z\":798,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"5\"}},{\"x\":814,\"y\":171,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"6\"}},{\"x\":810,\"y\":177,\"z\":821,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"7\"}},{\"x\":803,\"y\":183,\"z\":821,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"8\"}},{\"x\":802,\"y\":178,\"z\":817,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"9\"}},{\"x\":803,\"y\":175,\"z\":811,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"10\"}},{\"x\":800,\"y\":167,\"z\":799,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"11\"}},{\"x\":787,\"y\":174,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"12\"}},{\"x\":783,\"y\":177,\"z\":820,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"13\"}},{\"x\":766,\"y\":177,\"z\":822,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"14\"}},{\"x\":769,\"y\":175,\"z\":811,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"15\"}},{\"x\":775,\"y\":170,\"z\":810,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"16\"}},{\"x\":778,\"y\":161,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"17\"}},{\"x\":787,\"y\":155,\"z\":792,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"18\"}},{\"x\":778,\"y\":153,\"z\":801,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"19\"}},{\"x\":789,\"y\":154,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"20\"}},{\"x\":794,\"y\":159,\"z\":823,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"21\"}},{\"x\":804,\"y\":163,\"z\":816,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"22\"}},{\"x\":794,\"y\":164,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"23\"}},{\"x\":801,\"y\":168,\"z\":795,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"24\"}},{\"x\":806,\"y\":161,\"z\":783,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"25\"}},{\"x\":801,\"y\":157,\"z\":778,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"26\"}},{\"x\":791,\"y\":161,\"z\":781,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"27\"}},{\"x\":796,\"y\":164,\"z\":776,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"28\"}},{\"x\":798,\"y\":167,\"z\":774,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"29\"}},{\"x\":803,\"y\":161,\"z\":764,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"30\"}},{\"x\":810,\"y\":159,\"z\":762,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"31\"}},{\"x\":817,\"y\":156,\"z\":767,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"32\"}},{\"x\":821,\"y\":149,\"z\":754,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"33\"}},{\"x\":814,\"y\":139,\"z\":742,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"34\"}},{\"x\":818,\"y\":137,\"z\":736,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"35\"}},{\"x\":818,\"y\":143,\"z\":736,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"36\"}},{\"x\":802,\"y\":140,\"z\":739,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"37\"}},{\"x\":804,\"y\":131,\"z\":730,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"38\"}},{\"x\":792,\"y\":121,\"z\":726,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"39\"}},{\"x\":788,\"y\":127,\"z\":727,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"40\"}},{\"x\":792,\"y\":127,\"z\":726,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"41\"}},{\"x\":783,\"y\":123,\"z\":731,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"42\"}},{\"x\":786,\"y\":122,\"z\":717,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"43\"}},{\"x\":785,\"y\":124,\"z\":707,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"44\"}},{\"x\":769,\"y\":129,\"z\":709,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"45\"}},{\"x\":764,\"y\":131,\"z\":716,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"46\"}},{\"x\":757,\"y\":131,\"z\":717,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"47\"}},{\"x\":755,\"y\":139,\"z\":727,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"48\"}},{\"x\":753,\"y\":134,\"z\":723,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"49\"}},{\"x\":768,\"y\":126,\"z\":723,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"50\"}},{\"x\":770,\"y\":122,\"z\":720,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"51\"}},{\"x\":777,\"y\":116,\"z\":720,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"52\"}},{\"x\":779,\"y\":113,\"z\":725,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"53\"}},{\"x\":786,\"y\":116,\"z\":742,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"54\"}},{\"x\":783,\"y\":123,\"z\":752,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"55\"}},{\"x\":778,\"y\":125,\"z\":762,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"56\"}},{\"x\":784,\"y\":131,\"z\":754,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"57\"}},{\"x\":789,\"y\":135,\"z\":760,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"58\"}},{\"x\":792,\"y\":138,\"z\":758,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"59\"}},{\"x\":802,\"y\":138,\"z\":769,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"60\"}},{\"x\":807,\"y\":142,\"z\":780,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"61\"}},{\"x\":805,\"y\":132,\"z\":775,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"62\"}},{\"x\":820,\"y\":123,\"z\":772,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"63\"}},{\"x\":813,\"y\":131,\"z\":766,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"64\"}},{\"x\":812,\"y\":127,\"z\":763,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"65\"}},{\"x\":804,\"y\":126,\"z\":753,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"66\"}},{\"x\":810,\"y\":125,\"z\":750,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"67\"}},{\"x\":821,\"y\":127,\"z\":751,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"68\"}},{\"x\":815,\"y\":124,\"z\":742,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"69\"}},{\"x\":815,\"y\":120,\"z\":732,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"70\"}},{\"x\":806,\"y\":115,\"z\":732,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"71\"}},{\"x\":796,\"y\":125,\"z\":741,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"72\"}},{\"x\":798,\"y\":119,\"z\":757,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"73\"}},{\"x\":799,\"y\":112,\"z\":763,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"74\"}},{\"x\":783,\"y\":110,\"z\":765,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"75\"}},{\"x\":804,\"y\":116,\"z\":777,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"76\"}},{\"x\":801,\"y\":116,\"z\":788,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"77\"}},{\"x\":793,\"y\":110,\"z\":798,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"78\"}},{\"x\":795,\"y\":107,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"79\"}},{\"x\":805,\"y\":100,\"z\":803,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"80\"}},{\"x\":821,\"y\":105,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"81\"}},{\"x\":818,\"y\":96,\"z\":816,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"82\"}},{\"x\":803,\"y\":92,\"z\":802,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"83\"}},{\"x\":793,\"y\":97,\"z\":813,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"84\"}},{\"x\":791,\"y\":94,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"85\"}},{\"x\":787,\"y\":94,\"z\":810,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"86\"}},{\"x\":775,\"y\":92,\"z\":802,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"87\"}},{\"x\":771,\"y\":91,\"z\":799,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"88\"}},{\"x\":763,\"y\":89,\"z\":805,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"89\"}},{\"x\":768,\"y\":101,\"z\":806,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"90\"}},{\"x\":785,\"y\":105,\"z\":808,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"91\"}},{\"x\":791,\"y\":101,\"z\":805,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"92\"}},{\"x\":791,\"y\":103,\"z\":784,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"93\"}},{\"x\":771,\"y\":102,\"z\":778,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"94\"}},{\"x\":764,\"y\":99,\"z\":781,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"95\"}},{\"x\":758,\"y\":97,\"z\":792,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"96\"}},{\"x\":762,\"y\":93,\"z\":783,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"97\"}},{\"x\":778,\"y\":92,\"z\":775,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"98\"}},{\"x\":786,\"y\":90,\"z\":784,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"99\"}},{\"x\":790,\"y\":88,\"z\":792,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"100\"}},{\"x\":792,\"y\":82,\"z\":815,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"101\"}},{\"x\":783,\"y\":76,\"z\":811,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"102\"}},{\"x\":795,\"y\":69,\"z\":821,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"103\"}},{\"x\":800,\"y\":66,\"z\":807,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"104\"}},{\"x\":810,\"y\":65,\"z\":811,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"105\"}},{\"x\":817,\"y\":75,\"z\":813,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"106\"}},{\"x\":815,\"y\":75,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"107\"}},{\"x\":822,\"y\":85,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"108\"}},{\"x\":822,\"y\":85,\"z\":785,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"109\"}},{\"x\":811,\"y\":88,\"z\":778,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"110\"}},{\"x\":804,\"y\":86,\"z\":792,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"111\"}},{\"x\":792,\"y\":78,\"z\":790,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"112\"}},{\"x\":790,\"y\":77,\"z\":793,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"113\"}},{\"x\":785,\"y\":68,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"114\"}},{\"x\":773,\"y\":75,\"z\":797,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"115\"}},{\"x\":773,\"y\":78,\"z\":794,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"116\"}},{\"x\":757,\"y\":83,\"z\":797,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"117\"}},{\"x\":742,\"y\":84,\"z\":791,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"118\"}},{\"x\":737,\"y\":85,\"z\":797,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"119\"}},{\"x\":731,\"y\":75,\"z\":813,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"120\"}},{\"x\":731,\"y\":81,\"z\":816,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"121\"}},{\"x\":743,\"y\":82,\"z\":821,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"122\"}},{\"x\":746,\"y\":96,\"z\":798,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"123\"}},{\"x\":742,\"y\":110,\"z\":788,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"124\"}},{\"x\":745,\"y\":110,\"z\":807,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"125\"}},{\"x\":752,\"y\":113,\"z\":805,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"126\"}},{\"x\":742,\"y\":123,\"z\":801,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"127\"}},{\"x\":736,\"y\":129,\"z\":801,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"128\"}},{\"x\":733,\"y\":138,\"z\":795,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"129\"}},{\"x\":737,\"y\":134,\"z\":792,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"130\"}},{\"x\":741,\"y\":131,\"z\":799,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"131\"}},{\"x\":743,\"y\":129,\"z\":802,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"132\"}},{\"x\":753,\"y\":134,\"z\":804,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"133\"}},{\"x\":755,\"y\":139,\"z\":808,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"134\"}},{\"x\":757,\"y\":131,\"z\":798,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"135\"}},{\"x\":772,\"y\":140,\"z\":803,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"136\"}},{\"x\":773,\"y\":144,\"z\":797,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"137\"}},{\"x\":784,\"y\":142,\"z\":797,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"138\"}},{\"x\":785,\"y\":141,\"z\":795,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"139\"}},{\"x\":793,\"y\":147,\"z\":801,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"140\"}},{\"x\":785,\"y\":137,\"z\":810,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"141\"}},{\"x\":790,\"y\":133,\"z\":800,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"142\"}},{\"x\":806,\"y\":131,\"z\":803,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"143\"}},{\"x\":803,\"y\":131,\"z\":809,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":\"144\"}}]"; WaypointGroup waypointGroup = Waypoints.fromColeweightJson(coleweightJson, Location.CRYSTAL_HOLLOWS); - Assertions.assertEquals(SAPPHIRE_WAYOINTS, waypointGroup); + Assertions.assertEquals(SAPPHIRE_WAYPOINTS, waypointGroup); + } + + @Test + void testFromColeweightJsonMineshaftAmber() { + String coleweightJson = "[{\"x\":-174,\"y\":10,\"z\":-190,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":1}},{\"x\":-166,\"y\":8,\"z\":-177,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":2}},{\"x\":-181,\"y\":8,\"z\":-162,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":3}},{\"x\":-176,\"y\":8,\"z\":-159,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":4}},{\"x\":-162,\"y\":10,\"z\":-159,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":5}},{\"x\":-164,\"y\":8,\"z\":-164,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":6}},{\"x\":-157,\"y\":8,\"z\":-166,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":7}},{\"x\":-152,\"y\":7,\"z\":-166,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":8}},{\"x\":-155,\"y\":10,\"z\":-182,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":9}},{\"x\":-150,\"y\":10,\"z\":-187,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":10}},{\"x\":-144,\"y\":12,\"z\":-188,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":11}},{\"x\":-141,\"y\":10,\"z\":-181,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":12}},{\"x\":-130,\"y\":7,\"z\":-178,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":13}},{\"x\":-125,\"y\":8,\"z\":-192,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":14}},{\"x\":-121,\"y\":8,\"z\":-192,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":15}},{\"x\":-114,\"y\":7,\"z\":-182,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":16}},{\"x\":-110,\"y\":7,\"z\":-178,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":17}},{\"x\":-106,\"y\":28,\"z\":-162,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":18}},{\"x\":-113,\"y\":22,\"z\":-152,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":19}},{\"x\":-154,\"y\":25,\"z\":-162,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":20}},{\"x\":-155,\"y\":25,\"z\":-168,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":21}},{\"x\":-155,\"y\":26,\"z\":-186,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":22}},{\"x\":-160,\"y\":24,\"z\":-190,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":23}},{\"x\":-170,\"y\":21,\"z\":-189,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":24}},{\"x\":-175,\"y\":24,\"z\":-175,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":25}},{\"x\":-162,\"y\":24,\"z\":-177,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":26}},{\"x\":-174,\"y\":27,\"z\":-164,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":27}},{\"x\":-168,\"y\":26,\"z\":-153,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":28}},{\"x\":-174,\"y\":23,\"z\":-158,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":29}},{\"x\":-178,\"y\":17,\"z\":-154,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":30}},{\"x\":-185,\"y\":17,\"z\":-164,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":31}},{\"x\":-194,\"y\":9,\"z\":-181,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":32}},{\"x\":-193,\"y\":6,\"z\":-196,\"r\":0,\"g\":1,\"b\":0,\"options\":{\"name\":33}}]"; + WaypointGroup waypointGroup = Waypoints.fromColeweightJson(coleweightJson, Location.GLACITE_MINESHAFT); + WaypointGroup expectedWaypointGroup = new WaypointGroup("Coleweight", Location.GLACITE_MINESHAFT, List.of( + new OrderedNamedWaypoint(new BlockPos(-174, 10, -190), "1", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-166, 8, -177), "2", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-181, 8, -162), "3", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-176, 8, -159), "4", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-162, 10, -159), "5", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-164, 8, -164), "6", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-157, 8, -166), "7", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-152, 7, -166), "8", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-155, 10, -182), "9", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-150, 10, -187), "10", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-144, 12, -188), "11", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-141, 10, -181), "12", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-130, 7, -178), "13", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-125, 8, -192), "14", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-121, 8, -192), "15", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-114, 7, -182), "16", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-110, 7, -178), "17", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-106, 28, -162), "18", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-113, 22, -152), "19", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-154, 25, -162), "20", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-155, 25, -168), "21", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-155, 26, -186), "22", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-160, 24, -190), "23", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-170, 21, -189), "24", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-175, 24, -175), "25", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-162, 24, -177), "26", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-174, 27, -164), "27", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-168, 26, -153), "28", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-174, 23, -158), "29", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-178, 17, -154), "30", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-185, 17, -164), "31", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-194, 9, -181), "32", new float[]{0, 1, 0}), + new OrderedNamedWaypoint(new BlockPos(-193, 6, -196), "33", new float[]{0, 1, 0}) + ), true); + + Assertions.assertEquals(expectedWaypointGroup, waypointGroup); } @Test void testFromSkyblocker() { String waypointGroupsSkyblocker = "[Skyblocker-Waypoint-Data-V1]H4sIAAAAAAAA/92dQWscORCF7/4VZs4hSOqWStpr/sFeQ1iGeFgbJtNm7GDCkv++7ZD1znsTqujjSyCHcTtuv0gqfVUqVX28ub39Z/17e7t72X97XB5Oz0+7P24//vjSf49+PP68HJfzh+XL43I64De9/knv07uLjxk/rk/fPn36/8Fuf3y8368/Kb2vF199ul++Hu/+PJzuDuf14fP56+Hi6ePC7+4lw7snu/zY0/jlu0/7L4f1B+3y7ufXvr9TFj1PW0QXUdG5wLvrfPnRRndFT6qiDUUPHOnJFT2rioahza1vGen6e4i2jCPtr+mmKhrfbWi9S3ZFm6joBOY692mL6K4qGq23wZpezZwreqiKxpG2iqL9kc5JVTW+u8GithEgmSiTWced2sCchyAqCmXWaYaTAf/1u99Ui1KZteaqLr5qUSyzNlD1NmsmymWGMrMlVB3McFEwM9yfcyMaDVSLkhnb8ApDbyNY16JoxmNdKZoQrGtRNrOO1qxu2q+LKJvZQC+T4gnFjycUUTbriQIKOMNz81WrshmNdaMZ7tvwIspmq71C1RQ8qr5qUTbrCYkU9+uV0n3VomzGY13R0zQ/UFhU2Wxkd6z9/bqostmgGY7hfwtsuCqbDeJwmuGzr1qUzThuRjO8+aonUTbjYDiymTXf+5hU2YxPuBqq9gPDkyibXZ3g4ljXYIarshmdcU2oeg5muCqbZbThmKJgk79zTapsRqoxRyFULcpmfMw1J1TtRxUmUTZj/3rC/XryPc1Jls1wrNGkWwlmuCibWcd1XdCaFX+/nkXZ7GqsbctYz6Jsxqd7hWy472nOomxmHT3NAkNvQarCLMpm1vGcq6B/nQLVomzGZ5oFiTQ4BZhF2cyau18H8fBZlM0Mw4NXqoMZLspmhoeY7HNF+7Uqm+EhZp7QmgXnXLMqmzVis7ZFdVVlM0zJ4P06yEGqqmyGSUc5t02qVdnMcL/OSKTFP92rsmzWvLEO4mZVl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mnE5KptAcy8AvnRda6s2heAQod5pg0sYHLVxgBc1o3KP4WyVSmNMsVnWtsBpcm2BqBruTNdUA2YXLY3AI02xVCjDsGyzQHwvC9P5HhGskUpjaumUBQ12sBU2wNwSzaWHbgiF/0Bbi6+abec1/cf7uA3ePtXH5bj4eXw8Pf98+7nk4en4/70+t27z+dvT8/741/3y/G4vDy9/vTvN5/+BQTM0qPSigAA"; List waypointGroups = Waypoints.fromSkyblocker(waypointGroupsSkyblocker); - List expectedWaypointGroups = List.of(SAPPHIRE_WAYOINTS); + List expectedWaypointGroups = List.of(SAPPHIRE_WAYPOINTS); Assertions.assertEquals(expectedWaypointGroups, waypointGroups); } @Test void testToSkyblocker() { - String waypointGroupsSkyblocker = Waypoints.toSkyblocker(List.of(SAPPHIRE_WAYOINTS)); + String waypointGroupsSkyblocker = Waypoints.toSkyblocker(List.of(SAPPHIRE_WAYPOINTS)); String expectedWaypointGroupsSkyblocker = "[Skyblocker-Waypoint-Data-V1]H4sIAAAAAAAA/92dQWscORCF7/4VZs4hSOqWStpr/sFeQ1iGeFgbJtNm7GDCkv++7ZD1znsTqujjSyCHcTtuv0gqfVUqVX28ub39Z/17e7t72X97XB5Oz0+7P24//vjSf49+PP68HJfzh+XL43I64De9/knv07uLjxk/rk/fPn36/8Fuf3y8368/Kb2vF199ul++Hu/+PJzuDuf14fP56+Hi6ePC7+4lw7snu/zY0/jlu0/7L4f1B+3y7ufXvr9TFj1PW0QXUdG5wLvrfPnRRndFT6qiDUUPHOnJFT2rioahza1vGen6e4i2jCPtr+mmKhrfbWi9S3ZFm6joBOY692mL6K4qGq23wZpezZwreqiKxpG2iqL9kc5JVTW+u8GithEgmSiTWced2sCchyAqCmXWaYaTAf/1u99Ui1KZteaqLr5qUSyzNlD1NmsmymWGMrMlVB3McFEwM9yfcyMaDVSLkhnb8ApDbyNY16JoxmNdKZoQrGtRNrOO1qxu2q+LKJvZQC+T4gnFjycUUTbriQIKOMNz81WrshmNdaMZ7tvwIspmq71C1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vLYhkwd6PqdZFqUSyjgspYfLYHNzNzEsUySjtqG2tni3IZlcPhGrs+ouQkCmaUgEOqo2qzSZTMOt5U6xtVi6KZq9p6tF+LstlqsBw2CzzrrNsKAMP9mJ0QEalsKwDysYjDg3Ut2wqAnCyKKAQ7l2wrALRfGBgPbbhsKwCju5g41gGR6rYCoIARqvaDClm2FQCWzSC/MxxrUTYzvKnWqdlc4H3ItgKg9okb17UomxnfNt7kc8m2AkDVnT75Z7hZtRWAUa9Mih0G61q2FcCM4XDi8MD7UG0FQDac04SD5Ois2gvA5urIDuOFqs0ArNJoUxubILAg2w2AJnnZ1r1Hth3ARNe4xjbZsoBGt803dTfJqg0BiEu5nFsUSFLtCGAzNTfflFKZVVsCEKNdre1otFUhza1Z2FMQX1BtCuAXqIzSKrNqV4CgGmnE5KptAcy8AvnRda6s2heAQod5pg0sYHLVxgBc1o3KP4WyVSmNMsVnWtsBpcm2BqBruTNdUA2YXLY3AI02xVCjDsGyzQHwvC9P5HhGskUpjaumUBQ12sBU2wNwSzaWHbgiF/0Bbi6+abec1/cf7uA3ePtXH5bj4eXw8Pf98+7nk4en4/70+t27z+dvT8/741/3y/G4vDy9/vTvN5/+BQTM0qPSigAA"; Assertions.assertEquals(expectedWaypointGroupsSkyblocker, waypointGroupsSkyblocker);