diff options
| author | Moulberry <jjenour@student.unimelb.edu.au> | 2021-09-02 14:09:31 +0930 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-02 14:09:31 +0930 |
| commit | 81eea6bf1f653fa194735d892b40614389975dd3 (patch) | |
| tree | a955e0d03401302332c743f6c396184e45c94c80 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java | |
| parent | 05428d1ccb15f58ccbdb4b14eb9e10b61b0477cc (diff) | |
| parent | 05d6207281e18980b8a28046621c741fa81c1606 (diff) | |
| download | notenoughupdates-81eea6bf1f653fa194735d892b40614389975dd3.tar.gz notenoughupdates-81eea6bf1f653fa194735d892b40614389975dd3.tar.bz2 notenoughupdates-81eea6bf1f653fa194735d892b40614389975dd3.zip | |
Merge pull request #226 from DoKM/master
Pre31 update
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java | 134 |
1 files changed, 73 insertions, 61 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 5fe5938b..05591e81 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; @@ -16,6 +17,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.util.*; +import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; @@ -292,77 +294,87 @@ public class FairySouls { GlStateManager.enableDepth(); } + public static class FairySoulsCommandAlt extends SimpleCommand { + public FairySoulsCommandAlt() { + super("fairysouls", fairysoulRunnable); + } + } + public static class FairySoulsCommand extends SimpleCommand { public FairySoulsCommand() { - super("neusouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - printHelp(); - return; + super("neusouls", fairysoulRunnable); + } + } + + private static SimpleCommand.ProcessCommandRunnable fairysoulRunnable = new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + printHelp(); + return; + } + String subcommand = args[0].toLowerCase(); + + switch (subcommand) { + case "help": + printHelp(); + return; + case "on": + case "enable": + print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); + enabled = true; + return; + case "off": + case "disable": + print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); + enabled = false; + return; + case "clear": { + String location = SBInfo.getInstance().getLocation(); + if(currentSoulList == null || location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + for(int i=0; i<currentSoulList.size(); i++) { + found.add(i); + } + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); } - String subcommand = args[0].toLowerCase(); - - switch (subcommand) { - case "help": - printHelp(); - return; - case "on": - case "enable": - print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); - enabled = true; - return; - case "off": - case "disable": - print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); - enabled = false; - return; - case "clear": { - String location = SBInfo.getInstance().getLocation(); - if(currentSoulList == null || location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - for(int i=0; i<currentSoulList.size(); i++) { - found.add(i); - } - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); - } - } - return; - case "unclear": - String location = SBInfo.getInstance().getLocation(); - if(location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); - foundSouls.remove(location); - } - return; + } + return; + case "unclear": + String location = SBInfo.getInstance().getLocation(); + if(location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); + foundSouls.remove(location); } + return; + } - print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); - } - }); + print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); } + }; - private static void print(String s) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); - } + private static void print(String s) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); + } - private static void printHelp() { - print(""); - print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); - print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); - print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); - print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); - print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); - print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); - print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); - print(""); + private static void printHelp() { + print(""); + print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); + print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); + print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { + print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.OBFUSCATED + "Ab"); } - + print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); + print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); + print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); + print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); + print(""); } } |
