diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | me/Danker/TheMod.java | 64 | ||||
-rw-r--r-- | me/Danker/commands/DHelpCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 14 | ||||
-rw-r--r-- | me/Danker/handlers/ConfigHandler.java | 2 |
5 files changed, 79 insertions, 8 deletions
@@ -4,12 +4,13 @@ QOL changes that enhances your Hypixel Skyblock experience. Created to add featu ## Current features - Guild party desktop notifications (toggleable) - Coordinate and angle display (toggleable) +- Golden T6/T4 enchant display (toggleable) - Slayer item tracker (with GUI display) - API commands ## Commands - /dhelp - Returns this message in-game. -- /toggle <gparty/coords/list> - Toggles features. /toggle list returns values of every toggle. +- /toggle <gparty/coords/golden/list> - Toggles features. /toggle list returns values of every toggle. - /setkey <key> - Sets API key. - /getkey - Returns key set with /setkey. - /loot <zombie/spider/wolf> - Returns loot received from slayer quests. diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java index c904886..83a77a4 100644 --- a/me/Danker/TheMod.java +++ b/me/Danker/TheMod.java @@ -5,7 +5,11 @@ import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.text.NumberFormat; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import me.Danker.commands.ArmourCommand; import me.Danker.commands.BankCommand; @@ -35,6 +39,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -47,10 +52,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.5.3"; + public static final String VERSION = "1.5.4"; static int checkItemsNow = 0; static int itemsChecked = 0; + static Map<String, String> t6Enchants = new HashMap<String, String>(); + static Pattern pattern = Pattern.compile(""); @EventHandler public void init(FMLInitializationEvent event) @@ -60,6 +67,37 @@ public class TheMod final ConfigHandler cf = new ConfigHandler(); cf.reloadConfig(); + + // For golden enchants + t6Enchants.put("Bane of Arthropods VI", EnumChatFormatting.GOLD + "Bane of Arthropods VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Critical VI", EnumChatFormatting.GOLD + "Critical VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Dragon Hunter V", EnumChatFormatting.GOLD + "Dragon Hunter V" + EnumChatFormatting.BLUE); + t6Enchants.put("Ender Slayer VI", EnumChatFormatting.GOLD + "Ender Slayer VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Experience IV", EnumChatFormatting.GOLD + "Experience IV" + EnumChatFormatting.BLUE); + t6Enchants.put("Giant Killer VI", EnumChatFormatting.GOLD + "Giant Killer VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Life Steal IV", EnumChatFormatting.GOLD + "Life Steal IV" + EnumChatFormatting.BLUE); + t6Enchants.put("Looting IV", EnumChatFormatting.GOLD + "Looting IV" + EnumChatFormatting.BLUE); + t6Enchants.put("Luck VI", EnumChatFormatting.GOLD + "Luck VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Scavenger IV", EnumChatFormatting.GOLD + "Scavenger IV" + EnumChatFormatting.BLUE); + t6Enchants.put("Scavenger V", EnumChatFormatting.GOLD + "Scavenger V" + EnumChatFormatting.BLUE); + t6Enchants.put("Sharpness VI", EnumChatFormatting.GOLD + "Sharpness VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Smite VI", EnumChatFormatting.GOLD + "Smite VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Smite VI", EnumChatFormatting.GOLD + "Smite VII" + EnumChatFormatting.BLUE); + t6Enchants.put("Vampirism VI", EnumChatFormatting.GOLD + "Vampirism VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Power VI", EnumChatFormatting.GOLD + "Power VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Growth VI", EnumChatFormatting.GOLD + "Growth VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Protection VI", EnumChatFormatting.GOLD + "Protection VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Efficiency VI", EnumChatFormatting.GOLD + "Efficieny VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Angler VI", EnumChatFormatting.GOLD + "Angler VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Caster VI", EnumChatFormatting.GOLD + "Caster VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Frail VI", EnumChatFormatting.GOLD + "Frail VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Luck of the Sea VI", EnumChatFormatting.GOLD + "Luck of the Sea VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Lure VI", EnumChatFormatting.GOLD + "Lure VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Magnet VI", EnumChatFormatting.GOLD + "Magnet VI" + EnumChatFormatting.BLUE); + t6Enchants.put("Spiked Hook VI", EnumChatFormatting.GOLD + "Spiked Hook VI" + EnumChatFormatting.BLUE); + + String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; + pattern = Pattern.compile(patternString); } @EventHandler @@ -450,6 +488,18 @@ public class TheMod } } + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + final ToggleCommand tc = new ToggleCommand(); + + if (event.toolTip == null) return; + if (tc.goldenToggled) { + for (int i = 0; i < event.toolTip.size(); i++) { + event.toolTip.set(i, returnGoldenEnchants(event.toolTip.get(i))); + } + } + } + public int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; @@ -468,4 +518,16 @@ public class TheMod return 0; } + public String returnGoldenEnchants(String line) { + Matcher matcher = pattern.matcher(line); + StringBuffer out = new StringBuffer(); + + while (matcher.find()) { + matcher.appendReplacement(out, t6Enchants.get(matcher.group(1))); + } + matcher.appendTail(out); + + return out.toString(); + } + } diff --git a/me/Danker/commands/DHelpCommand.java b/me/Danker/commands/DHelpCommand.java index e086813..9c064d7 100644 --- a/me/Danker/commands/DHelpCommand.java +++ b/me/Danker/commands/DHelpCommand.java @@ -28,10 +28,10 @@ public class DHelpCommand extends CommandBase { public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { EntityPlayer player = (EntityPlayer) arg0; - player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " Danker's Skyblock Mod Version 1.5.3\n" + + player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " Danker's Skyblock Mod Version 1.5.4\n" + EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle <gparty/coords/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" + EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf>" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests.\n" + diff --git a/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java index 6baa7af..0e893c4 100644 --- a/me/Danker/commands/ToggleCommand.java +++ b/me/Danker/commands/ToggleCommand.java @@ -12,6 +12,7 @@ import net.minecraft.util.EnumChatFormatting; public class ToggleCommand extends CommandBase implements ICommand { public static boolean gpartyToggled; public static boolean coordsToggled; + public static boolean goldenToggled; @Override public String getCommandName() { @@ -20,7 +21,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <gparty/coords/list>"; + return getCommandName() + " <gparty/coords/golden/list>"; } @Override @@ -34,7 +35,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/list>")); return; } @@ -46,11 +47,16 @@ public class ToggleCommand extends CommandBase implements ICommand { coordsToggled = !coordsToggled; cf.writeBooleanConfig("toggles", "Coords", coordsToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coord/Angle display has been set to " + EnumChatFormatting.DARK_GREEN + coordsToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("golden")) { + goldenToggled = !goldenToggled; + cf.writeBooleanConfig("toggles", "Golden", goldenToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golden T6 enchants has been set to " + EnumChatFormatting.DARK_GREEN + goldenToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + - EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled)); + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" + + EnumChatFormatting.GREEN + " Golden T6 enchants: " + EnumChatFormatting.DARK_GREEN + goldenToggled)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/list>")); } } } diff --git a/me/Danker/handlers/ConfigHandler.java b/me/Danker/handlers/ConfigHandler.java index 9de284f..4900777 100644 --- a/me/Danker/handlers/ConfigHandler.java +++ b/me/Danker/handlers/ConfigHandler.java @@ -127,6 +127,7 @@ public class ConfigHandler { // Config init if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", false); if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", false); + if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); // Wolf Loot @@ -179,6 +180,7 @@ public class ConfigHandler { final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); tf.coordsToggled = getBoolean("toggles", "Coords"); + tf.goldenToggled = getBoolean("toggles", "Golden"); final LootCommand lc = new LootCommand(); // Wolf |