diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-14 22:57:57 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-09-14 22:57:57 -0400 |
commit | 1e82de1cfd719c72f4c0c6ffc541fe6da5fad8ab (patch) | |
tree | 1dc3b0a395d80c74037a4101ba01265c4e7f4d43 /src/main/java/me | |
parent | 3198b59936c0221b258fa6e97edaf33eed336ee7 (diff) | |
download | SkyblockMod-1e82de1cfd719c72f4c0c6ffc541fe6da5fad8ab.tar.gz SkyblockMod-1e82de1cfd719c72f4c0c6ffc541fe6da5fad8ab.tar.bz2 SkyblockMod-1e82de1cfd719c72f4c0c6ffc541fe6da5fad8ab.zip |
Add expertise kills in fishing rod lore
Diffstat (limited to 'src/main/java/me')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 21 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DHelpCommand.java | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 12 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 10 |
5 files changed, 43 insertions, 4 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 8769bd3..925b5df 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -53,6 +53,7 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -1636,11 +1637,31 @@ public class TheMod final ToggleCommand tc = new ToggleCommand(); if (event.toolTip == null) return; + + ItemStack item = event.itemStack; if (tc.goldenToggled) { for (int i = 0; i < event.toolTip.size(); i++) { event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i))); } } + + if (tc.expertiseLoreToggled) { + if (item.hasTagCompound()) { + NBTTagCompound tags = item.getSubCompound("ExtraAttributes", false); + if (tags != null) { + if (tags.hasKey("expertise_kills")) { + int index = 4; + if (!Minecraft.getMinecraft().gameSettings.advancedItemTooltips) index -= 2; + + event.toolTip.add(event.toolTip.size() - index, ""); + event.toolTip.add(event.toolTip.size() - index, "Expertise Kills: " + EnumChatFormatting.RED + tags.getInteger("expertise_kills")); + if (Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) != -1) { + event.toolTip.add(event.toolTip.size() - index, Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) + " kills to tier up!"); + } + } + } + } + } } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index d71d1b3..0db8749 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + - EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/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 and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs> [winter/f(1-4)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 373aae4..c766165 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -26,6 +26,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean petColoursToggled; public static boolean dungeonTimerToggled; public static boolean golemAlertToggled; + public static boolean expertiseLoreToggled; @Override public String getCommandName() { @@ -34,7 +35,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/list>"; + return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/list>"; } @Override @@ -45,7 +46,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "list"); } return null; } @@ -112,6 +113,10 @@ public class ToggleCommand extends CommandBase implements ICommand { golemAlertToggled = !golemAlertToggled; cf.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golem spawn alerts has been set to " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("expertiselore")) { + expertiseLoreToggled = !expertiseLoreToggled; + cf.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Expertise in lore has been set to " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled + 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 + "\n" + @@ -125,7 +130,8 @@ public class ToggleCommand extends CommandBase implements ICommand { EnumChatFormatting.GREEN + " Spirit Sceptre messages: " + EnumChatFormatting.DARK_GREEN + sceptreMessages + "\n" + EnumChatFormatting.GREEN + " Pet colours: " + EnumChatFormatting.DARK_GREEN + petColoursToggled + "\n" + EnumChatFormatting.GREEN + " Dungeon timer: " + EnumChatFormatting.DARK_GREEN + dungeonTimerToggled + "\n" + - EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled)); + EnumChatFormatting.GREEN + " Golem spawn alerts: " + EnumChatFormatting.DARK_GREEN + golemAlertToggled + "\n" + + EnumChatFormatting.GREEN + " Expertise in lore: " + EnumChatFormatting.DARK_GREEN + expertiseLoreToggled)); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /" + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 127f178..3c38de6 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -184,6 +184,7 @@ public class ConfigHandler { if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); if (!hasKey("toggles", "GolemAlerts")) writeBooleanConfig("toggles", "GolemAlerts", false); + if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -320,6 +321,7 @@ public class ConfigHandler { tf.petColoursToggled = getBoolean("toggles", "PetColors"); tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); tf.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); + tf.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); final BlockSlayerCommand bs = new BlockSlayerCommand(); String onlySlayer = getString("toggles", "BlockSlayer"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 67f8439..3c213a9 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -26,6 +26,7 @@ public class Utils { 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000}; + static int[] expertiseKills = {50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000}; public static int getItems(String item) { Minecraft mc = Minecraft.getMinecraft(); @@ -187,4 +188,13 @@ public class Utils { return 50D; } + public static int expertiseKillsLeft(int kills) { + for (int i = 0; i < expertiseKills.length; i++) { + if (kills < expertiseKills[i]) { + return expertiseKills[i] - kills; + } + } + return -1; + } + } |