diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-04-28 01:17:00 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-04-28 01:17:00 -0400 |
commit | 852777345060b09ab34945cff65a095aa8cb1aa9 (patch) | |
tree | 3fd0879eaa45579b15321e7c14898fe388999499 /src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java | |
parent | b3cb573fcfb7afbb0206d29b71432ab68c82a876 (diff) | |
download | SkyblockMod-852777345060b09ab34945cff65a095aa8cb1aa9.tar.gz SkyblockMod-852777345060b09ab34945cff65a095aa8cb1aa9.tar.bz2 SkyblockMod-852777345060b09ab34945cff65a095aa8cb1aa9.zip |
Add Skytils waypoint support
Diffstat (limited to 'src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java')
-rw-r--r-- | src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java b/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java index f5dea9b..4eaf2d6 100644 --- a/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java +++ b/src/main/java/me/Danker/commands/CrystalHollowWaypointCommand.java @@ -1,14 +1,11 @@ package me.Danker.commands; -import me.Danker.DankersSkyblockMod; import me.Danker.features.CrystalHollowWaypoints; -import net.minecraft.client.Minecraft; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; + +import java.util.Arrays; public class CrystalHollowWaypointCommand extends CommandBase { @@ -30,34 +27,12 @@ public class CrystalHollowWaypointCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { if (arg1.length == 0) return; - addWaypoints(String.join(" ", arg1), false); - } - - public static void addWaypoints(String list, boolean auto) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - String[] waypoints = list.split("\\\\n"); - - for (String waypoint : waypoints) { - String[] parts = waypoint.split("@-"); - String[] coords = parts[1].split(","); - - String location = parts[0]; - BlockPos pos = new BlockPos(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])); - CrystalHollowWaypoints.Waypoint newWaypoint = new CrystalHollowWaypoints.Waypoint(location, pos); - - if (auto) { - boolean contains = false; - for (CrystalHollowWaypoints.Waypoint existing : CrystalHollowWaypoints.waypoints) { - if (existing.location.equals(location)) { - contains = true; - break; - } - } - if (contains) continue; - } - CrystalHollowWaypoints.waypoints.add(newWaypoint); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Added " + newWaypoint.location + " @ " + newWaypoint.getPos())); + if (arg1.length > 4 && arg1[0].equals("st")) { + String name = String.join(" ", Arrays.copyOfRange(arg1, 4, arg1.length)); + CrystalHollowWaypoints.addWaypoint(name, arg1[1], arg1[2], arg1[3]); + } else { + CrystalHollowWaypoints.addDSMWaypoints(String.join(" ", arg1), false); } } |