diff options
Diffstat (limited to 'src')
39 files changed, 1592 insertions, 902 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 9f0e935..2c75a0e 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -1,65 +1,19 @@ package me.Danker; -import java.awt.Image; -import java.awt.SystemTray; -import java.awt.Toolkit; -import java.awt.TrayIcon; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.regex.Pattern; - -import org.apache.commons.lang3.time.StopWatch; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - import com.google.gson.JsonObject; - -import me.Danker.commands.ArmourCommand; -import me.Danker.commands.BankCommand; -import me.Danker.commands.BlockSlayerCommand; -import me.Danker.commands.DHelpCommand; -import me.Danker.commands.DankerGuiCommand; -import me.Danker.commands.DisplayCommand; -import me.Danker.commands.DungeonsCommand; -import me.Danker.commands.GetkeyCommand; -import me.Danker.commands.GuildOfCommand; -import me.Danker.commands.ImportFishingCommand; -import me.Danker.commands.LobbySkillsCommand; -import me.Danker.commands.LootCommand; -import me.Danker.commands.MoveCommand; -import me.Danker.commands.PetsCommand; -import me.Danker.commands.ReloadConfigCommand; -import me.Danker.commands.ResetLootCommand; -import me.Danker.commands.ScaleCommand; -import me.Danker.commands.SetkeyCommand; -import me.Danker.commands.SkillTrackerCommand; -import me.Danker.commands.SkillsCommand; -import me.Danker.commands.SkyblockPlayersCommand; -import me.Danker.commands.SlayerCommand; -import me.Danker.commands.ToggleCommand; -import me.Danker.gui.DankerGui; -import me.Danker.gui.DisplayGui; -import me.Danker.gui.EditLocationsGui; -import me.Danker.gui.OnlySlayerGui; -import me.Danker.gui.PuzzleSolversGui; -import me.Danker.gui.SkillTrackerGui; -import me.Danker.handlers.APIHandler; -import me.Danker.handlers.ConfigHandler; -import me.Danker.handlers.PacketHandler; -import me.Danker.handlers.ScoreboardHandler; -import me.Danker.handlers.TextRenderer; +import me.Danker.commands.*; +import me.Danker.gui.*; +import me.Danker.handlers.*; +import me.Danker.utils.TicTacToeUtils; import me.Danker.utils.Utils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItemFrame; @@ -73,22 +27,16 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StringUtils; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.client.GuiIngameForge; +import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -110,16 +58,26 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; +import org.apache.commons.lang3.time.StopWatch; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.text.NumberFormat; +import java.util.List; +import java.util.*; +import java.util.regex.Pattern; -@Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true) -public class TheMod +@Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) +public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.3"; + public static final String VERSION = "1.8.4"; static double checkItemsNow = 0; static double itemsChecked = 0; - public static Map<String, String> t6Enchants = new HashMap<String, String>(); + public static Map<String, String> t6Enchants = new HashMap<>(); public static Pattern pattern = Pattern.compile(""); static boolean updateChecked = false; public static int titleTimer = -1; @@ -133,7 +91,6 @@ public class TheMod static String lastMaddoxCommand = "/cb placeholder"; static double lastMaddoxTime = 0; static KeyBinding[] keyBindings = new KeyBinding[2]; - static int lastMouse = -1; static boolean usingLabymod = false; public static String guiToOpen = null; static boolean foundLivid = false; @@ -145,7 +102,7 @@ public class TheMod static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", "The reward isn't in any of our chests", "Both of them are telling the truth."}; - static Map<String, String[]> triviaSolutions = new HashMap<String, String[]>(); + static Map<String, String[]> triviaSolutions = new HashMap<>(); static String[] triviaAnswers = null; static Entity highestBlaze = null; static Entity lowestBlaze = null; @@ -153,11 +110,21 @@ public class TheMod static final int[] CREEPER_COLOURS = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; static boolean drawCreeperLines = false; static Vec3 creeperLocation = new Vec3(0, 0, 0); - static List<Vec3[]> creeperLines = new ArrayList<Vec3[]>(); + static List<Vec3[]> creeperLines = new ArrayList<>(); static boolean prevInWaterRoom = false; static boolean inWaterRoom = false; - - static double dungeonStartTime = 0; + static String waterAnswers = null; + static AxisAlignedBB correctTicTacToeButton = null; + static Slot[] clickInOrderSlots = new Slot[36]; + static int lastChronomatronRound = 0; + static List<String> chronomatronPattern = new ArrayList<>(); + static int chronomatronMouseClicks = 0; + static int lastUltraSequencerClicked = 0; + static ItemStack[] experimentTableSlots = new ItemStack[54]; + static int pickBlockBind; + static boolean pickBlockBindSwapped = false; + + static double dungeonStartTime = 0; static double bloodOpenTime = 0; static double watcherClearTime = 0; static double bossClearTime = 0; @@ -283,9 +250,9 @@ public class TheMod keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); keyBindings[1] = new KeyBinding("Start/Stop Skill Tracker", Keyboard.KEY_NUMPAD5, "Danker's Skyblock Mod"); - - for (int i = 0; i < keyBindings.length; i++) { - ClientRegistry.registerKeyBinding(keyBindings[i]); + + for (KeyBinding keyBinding : keyBindings) { + ClientRegistry.registerKeyBinding(keyBinding); } } @@ -332,7 +299,7 @@ public class TheMod new Thread(() -> { EntityPlayer player = Minecraft.getMinecraft().thePlayer; - System.err.println("Checking for updates..."); + System.out.println("Checking for updates..."); JsonObject latestRelease = APIHandler.getResponse("https://api.github.com/repos/bowser0000/SkyblockMod/releases/latest"); String latestTag = latestRelease.get("tag_name").getAsString(); @@ -348,7 +315,7 @@ public class TheMod try { Thread.sleep(2000); } catch (InterruptedException ex) { - System.err.println(ex); + ex.printStackTrace(); } player.addChatMessage(new ChatComponentText(ERROR_COLOUR + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); } @@ -375,77 +342,62 @@ public class TheMod for (String section : actionBarSections) { if (section.contains("+") && section.contains("/") && section.contains("(")) { if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { - int limit = section.contains("Farming") ? 60 : 50; + int limit = section.contains("Farming") || section.contains("Enchanting") ? 60 : 50; double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); xpLeft = xpToLevelUp - currentXP; int previousXP = Utils.getPastXpEarned(xpToLevelUp, limit); double totalXP = currentXP + previousXP; - double xpGained = Double.parseDouble(section.substring(section.indexOf("+") + 1, section.indexOf(" ")).replace(",", "")); String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); switch (skill) { case "Farming": lastSkill = "Farming"; - if (farmingXP == 0) { - farmingXP = totalXP; - } else { + if (farmingXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; - farmingXP = totalXP; } + farmingXP = totalXP; break; case "Mining": lastSkill = "Mining"; - if (miningXP == 0) { - miningXP = totalXP; - } else { + if (miningXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; - miningXP = totalXP; } + miningXP = totalXP; break; case "Combat": lastSkill = "Combat"; - if (combatXP == 0) { - combatXP = totalXP; - } else { + if (combatXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; - combatXP = totalXP; } + combatXP = totalXP; break; case "Foraging": lastSkill = "Foraging"; - if (foragingXP == 0) { - foragingXP = totalXP; - } else { + if (foragingXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; - foragingXP = totalXP; } + foragingXP = totalXP; break; case "Fishing": lastSkill = "Fishing"; - if (fishingXP == 0) { - fishingXP = totalXP; - } else { + if (fishingXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; - fishingXP = totalXP; } + fishingXP = totalXP; break; case "Enchanting": lastSkill = "Enchanting"; - if (enchantingXP == 0) { - enchantingXP = totalXP; - } else { + if (enchantingXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; - enchantingXP = totalXP; } + enchantingXP = totalXP; break; case "Alchemy": lastSkill = "Alchemy"; - if (alchemyXP == 0) { - alchemyXP = totalXP; - } else { + if (alchemyXP != 0) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; - alchemyXP = totalXP; } + alchemyXP = totalXP; break; default: System.err.println("Unknown skill."); @@ -457,7 +409,7 @@ public class TheMod double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int limit; int totalXp; - if (section.contains("Farming")) { + if (section.contains("Farming") || section.contains("Enchanting")) { limit = 60; totalXp = 111672425; } else { @@ -465,7 +417,7 @@ public class TheMod totalXp = 55172425; } int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); - double percentage = (double) Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; + double percentage = Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); skillTimer = SKILL_TIME; @@ -512,6 +464,13 @@ public class TheMod event.setCanceled(true); return; } + + if (!ToggleCommand.implosionMessages) { + if (message.contains("Your Implosion hit ") || message.contains("There are blocks in the way")) { + event.setCanceled(true); + return; + } + } if (ToggleCommand.oruoToggled && Utils.inDungeons) { // Don't set every answer to wrong with this question @@ -528,11 +487,14 @@ public class TheMod if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { boolean isSolution = false; for (String solution : triviaAnswers) { - if (message.contains(solution)) isSolution = true; + if (message.contains(solution)) { + isSolution = true; + break; + } } if (!isSolution) { char letter = message.charAt(5); - String option = message.substring(6, message.length()); + String option = message.substring(6); event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); return; } @@ -551,7 +513,7 @@ public class TheMod trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO); tray.remove(trayIcon); } catch (Exception ex) { - System.err.print(ex); + ex.printStackTrace(); } } } @@ -1206,7 +1168,7 @@ public class TheMod @SubscribeEvent public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) { - if (usingLabymod) return; + if (usingLabymod && !(Minecraft.getMinecraft().ingameGUI instanceof GuiIngameForge)) return; if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE && event.type != RenderGameOverlayEvent.ElementType.JUMPBAR) return; renderEverything(); } @@ -1259,7 +1221,7 @@ public class TheMod if (ToggleCommand.cakeTimerToggled && Utils.inSkyblock) { double scale = ScaleCommand.cakeTimerScale; - double scaleReset = (double) Math.pow(scale, -1); + double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); double timeNow = System.currentTimeMillis() / 1000; @@ -1278,7 +1240,7 @@ public class TheMod } if (showSkillTracker && Utils.inSkyblock) { - int xpPerHour = 0; + int xpPerHour; double xpToShow = 0; switch (lastSkill) { case "Farming": @@ -1319,14 +1281,18 @@ public class TheMod new TextRenderer(mc, skillTrackerText, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale); } - + + if (ToggleCommand.waterToggled && Utils.inDungeons && waterAnswers != null) { + new TextRenderer(mc, waterAnswers, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], ScaleCommand.waterAnswerScale); + } + if (!DisplayCommand.display.equals("off")) { String dropsText = ""; String countText = ""; - String dropsTextTwo = ""; - String countTextTwo = ""; - String timeBetween = "Never"; - String bossesBetween = "Never"; + String dropsTextTwo; + String countTextTwo; + String timeBetween; + String bossesBetween; String drop20; double timeNow = System.currentTimeMillis() / 1000; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); @@ -2262,6 +2228,9 @@ public class TheMod if (event.toolTip == null) return; ItemStack item = event.itemStack; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + if (ToggleCommand.goldenToggled) { for (int i = 0; i < event.toolTip.size(); i++) { event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i))); @@ -2285,16 +2254,42 @@ public class TheMod } } } + + if (mc.currentScreen instanceof GuiChest) { + ContainerChest chest = (ContainerChest) player.openContainer; + IInventory inv = chest.getLowerChestInventory(); + String chestName = inv.getDisplayName().getUnformattedText(); + if (ToggleCommand.superpairsToggled && chestName.contains("Superpairs (")) { + if (Item.getIdFromItem(item.getItem()) != 95) return; + if (item.getDisplayName().contains("Click any button") || item.getDisplayName().contains("Click a second button") || item.getDisplayName().contains("Next button is instantly rewarded") || item.getDisplayName().contains("Stained Glass")) { + Slot slot = ((GuiChest) mc.currentScreen).getSlotUnderMouse(); + ItemStack itemStack = experimentTableSlots[slot.getSlotIndex()]; + if (itemStack == null) return; + String itemName = itemStack.getDisplayName(); + + if (event.toolTip.stream().anyMatch(x->StringUtils.stripControlCodes(x).equals(StringUtils.stripControlCodes(itemName)))) return; + event.toolTip.removeIf(x -> { + x = StringUtils.stripControlCodes(x); + if (x.equals("minecraft:stained_glass")) return true; + return x.startsWith("NBT: "); + }); + event.toolTip.add(itemName); + event.toolTip.add(itemStack.getItem().getRegistryName()); + } + + } + } + } - + @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { if (event.phase != Phase.START) return; - + Minecraft mc = Minecraft.getMinecraft(); World world = mc.theWorld; EntityPlayerSP player = mc.thePlayer; - + // Checks every second tickAmount++; if (tickAmount % 20 == 0) { @@ -2302,8 +2297,8 @@ public class TheMod Utils.checkForSkyblock(); Utils.checkForDungeons(); } - - if (DisplayCommand.auto && mc != null && world != null && player != null) { + + if (DisplayCommand.auto && world != null && player != null) { List<String> scoreboard = ScoreboardHandler.getSidebarLines(); boolean found = false; for (String s : scoreboard) { @@ -2347,8 +2342,8 @@ public class TheMod if (!found) DisplayCommand.display = "off"; ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); } - - if (ToggleCommand.creeperToggled && Utils.inDungeons && world != null) { + + if (ToggleCommand.creeperToggled && Utils.inDungeons && world != null && player != null) { double x = player.posX; double y = player.posY; double z = player.posZ; @@ -2384,8 +2379,8 @@ public class TheMod drawCreeperLines = false; } } - - if (ToggleCommand.waterToggled && Utils.inDungeons && world != null) { + + if (ToggleCommand.waterToggled && Utils.inDungeons && world != null && player != null) { // multi thread block checking new Thread(() -> { prevInWaterRoom = inWaterRoom; @@ -2402,20 +2397,20 @@ public class TheMod } if (foundPiston) break; } - + if (foundPiston) { for (int x = (int) (player.posX - 25); x <= player.posX + 25; x++) { for (int z = (int) (player.posZ - 25); z <= player.posZ + 25; z++) { BlockPos blockPos = new BlockPos(x, 82, z); if (world.getBlockState(blockPos).getBlock() == Blocks.piston_head) { inWaterRoom = true; - if (!prevInWaterRoom && inWaterRoom) { + if (!prevInWaterRoom) { boolean foundGold = false; boolean foundClay = false; boolean foundEmerald = false; boolean foundQuartz = false; boolean foundDiamond = false; - + // Detect first blocks near water stream BlockPos scan1 = new BlockPos(x + 1, 78, z + 1); BlockPos scan2 = new BlockPos(x - 1, 77, z - 1); @@ -2434,7 +2429,7 @@ public class TheMod foundDiamond = true; } } - + int variant = 0; if (foundGold && foundClay) { variant = 1; @@ -2445,13 +2440,13 @@ public class TheMod } else if (foundGold && foundQuartz) { variant = 4; } - + // Return solution - String purple = ""; - String orange = ""; - String blue = ""; - String green = ""; - String red = ""; + String purple; + String orange; + String blue; + String green; + String red; switch (variant) { case 1: purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.RED + "Clay"; @@ -2485,28 +2480,28 @@ public class TheMod purple = orange = blue = green = red = ERROR_COLOUR + "Error detecting water puzzle variant."; break; } - player.addChatMessage(new ChatComponentText(DELIMITER_COLOUR + EnumChatFormatting.BOLD + "-------------------\n" + - MAIN_COLOUR + " The following levers must be down:\n " + - EnumChatFormatting.DARK_PURPLE + "Purple: " + purple + "\n " + - EnumChatFormatting.GOLD + "Orange: " + orange + "\n " + - EnumChatFormatting.BLUE + "Blue: " + blue + "\n " + - EnumChatFormatting.GREEN + "Green: " + green + "\n " + - EnumChatFormatting.RED + "Red: " + red + "\n" + - DELIMITER_COLOUR + EnumChatFormatting.BOLD + " -------------------")); + waterAnswers = MAIN_COLOUR + "The following levers must be down:\n" + + EnumChatFormatting.DARK_PURPLE + "Purple: " + purple + "\n" + + EnumChatFormatting.GOLD + "Orange: " + orange + "\n" + + EnumChatFormatting.BLUE + "Blue: " + blue + "\n" + + EnumChatFormatting.GREEN + "Green: " + green + "\n" + + EnumChatFormatting.RED + "Red: " + red; done = true; - break; + break; } } } if (done) break; - } - } + } + } else { + waterAnswers = null; + } }).start(); } - + if (ToggleCommand.lividSolverToggled && Utils.inDungeons && !foundLivid && world != null) { boolean inF5 = false; - + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); @@ -2515,9 +2510,9 @@ public class TheMod break; } } - + if (inF5) { - List<Entity> loadedLivids = new ArrayList<Entity>(); + List<Entity> loadedLivids = new ArrayList<>(); List<Entity> entities = world.getLoadedEntityList(); for (Entity entity : entities) { String name = entity.getName(); @@ -2531,54 +2526,180 @@ public class TheMod } } } - + + if (ToggleCommand.ticTacToeToggled && Utils.inDungeons && world != null && player != null) { + correctTicTacToeButton = null; + AxisAlignedBB aabb = new AxisAlignedBB(player.posX - 6, player.posY - 6, player.posZ - 6, player.posX + 6, player.posY + 6, player.posZ + 6); + List<EntityItemFrame> itemFrames = world.getEntitiesWithinAABB(EntityItemFrame.class, aabb); + List<EntityItemFrame> itemFramesWithMaps = new ArrayList<>(); + // Find how many item frames have maps already placed + for (EntityItemFrame itemFrame : itemFrames) { + ItemStack item = itemFrame.getDisplayedItem(); + if (item == null || !(item.getItem() instanceof ItemMap)) continue; + MapData mapData = ((ItemMap) item.getItem()).getMapData(item, world); + if (mapData == null) continue; + + itemFramesWithMaps.add(itemFrame); + } + + // Only run when it's your turn + if (itemFramesWithMaps.size() != 9 && itemFramesWithMaps.size() % 2 == 1) { + char[][] board = new char[3][3]; + BlockPos leftmostRow = null; + int sign = 1; + char facing = 'X'; + for (EntityItemFrame itemFrame : itemFramesWithMaps) { + ItemStack map = itemFrame.getDisplayedItem(); + MapData mapData = ((ItemMap) map.getItem()).getMapData(map, world); + + // Find position on board + int row = 0; + int column; + sign = 1; + + if (itemFrame.facingDirection == EnumFacing.SOUTH || itemFrame.facingDirection == EnumFacing.WEST) { + sign = -1; + } + + BlockPos itemFramePos = new BlockPos(itemFrame.posX, Math.floor(itemFrame.posY), itemFrame.posZ); + for (int i = 2; i >= 0; i--) { + int realI = i * sign; + BlockPos blockPos = itemFramePos; + if (itemFrame.posX % 0.5 == 0) { + blockPos = itemFramePos.add(realI, 0, 0); + } else if (itemFrame.posZ % 0.5 == 0) { + blockPos = itemFramePos.add(0, 0, realI); + facing = 'Z'; + } + Block block = world.getBlockState(blockPos).getBlock(); + if (block == Blocks.air || block == Blocks.stone_button) { + leftmostRow = blockPos; + row = i; + break; + } + } + + if (itemFrame.posY == 72.5) { + column = 0; + } else if (itemFrame.posY == 71.5) { + column = 1; + } else if (itemFrame.posY == 70.5) { + column = 2; + } else { + continue; + } + + // Get colour + // Middle pixel = 64*128 + 64 = 8256 + int colourInt = mapData.colors[8256] & 255; + if (colourInt == 114) { + board[column][row] = 'X'; + } else if (colourInt == 33) { + board[column][row] = 'O'; + } + } + System.out.println("Board: " + Arrays.deepToString(board)); + + // Draw best move + int bestMove = TicTacToeUtils.getBestMove(board) - 1; + System.out.println("Best move slot: " + bestMove); + if (leftmostRow != null) { + double drawX = facing == 'X' ? leftmostRow.getX() - sign * (bestMove % 3) : leftmostRow.getX(); + double drawY = 72 - Math.floor(bestMove / 3); + double drawZ = facing == 'Z' ? leftmostRow.getZ() - sign * (bestMove % 3) : leftmostRow.getZ(); + + correctTicTacToeButton = new AxisAlignedBB(drawX, drawY, drawZ, drawX + 1, drawY + 1, drawZ + 1); + } + } + } + tickAmount = 0; } - + // Checks 5 times per second if (tickAmount % 4 == 0) { if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { - List<Entity> entities = world.getLoadedEntityList(); - int highestHealth = 0; - highestBlaze = null; - int lowestHealth = 99999999; - lowestBlaze = null; - - for (Entity entity : entities) { - if (entity.getName().contains("Blaze") && entity.getName().contains("/")) { - String blazeName = StringUtils.stripControlCodes(entity.getName()); - try { - int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1)); - if (health > highestHealth) { - highestHealth = health; - highestBlaze = entity; - } - if (health < lowestHealth) { - lowestHealth = health; - lowestBlaze = entity; - } - } catch (NumberFormatException ex) { - System.err.println(ex); - } - } - } - } + List<Entity> entities = world.getLoadedEntityList(); + int highestHealth = 0; + highestBlaze = null; + int lowestHealth = 99999999; + lowestBlaze = null; + + for (Entity entity : entities) { + if (entity.getName().contains("Blaze") && entity.getName().contains("/")) { + String blazeName = StringUtils.stripControlCodes(entity.getName()); + try { + int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1)); + if (health > highestHealth) { + highestHealth = health; + highestBlaze = entity; + } + if (health < lowestHealth) { + lowestHealth = health; + lowestBlaze = entity; + } + } catch (NumberFormatException ex) { + ex.printStackTrace(); + } + } + } + } } - + // Checks 10 times per second if (tickAmount % 2 == 0) { if (ToggleCommand.lowHealthNotifyToggled && Utils.inDungeons && world != null) { List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String score : scoreboard) { if (score.endsWith("❤") && score.matches(".*§c\\d.*")) { - Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!", 1); + String name = score.substring(score.indexOf(" ") + 1); + Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!\n" + name, 1); break; } } } } - - if (titleTimer >= 0) { + + // Runs 20 times per second + if (mc.currentScreen instanceof GuiChest) { + if (player == null) return; + ContainerChest chest = (ContainerChest) player.openContainer; + List<Slot> invSlots = ((GuiChest) mc.currentScreen).inventorySlots.inventorySlots; + String chestName = chest.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); + + if (ToggleCommand.ultrasequencerToggled && chestName.startsWith("Ultrasequencer (")) { + if (invSlots.get(49).getStack() != null && invSlots.get(49).getStack().getDisplayName().equals("§aRemember the pattern!")) { + for (int i = 9; i <= 44; i++) { + if (invSlots.get(i) == null || invSlots.get(i).getStack() == null) continue; + String itemName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()); + if (itemName.matches("\\d+")) { + int number = Integer.parseInt(itemName); + clickInOrderSlots[number - 1] = invSlots.get(i); + } + } + } + } + + if (ToggleCommand.superpairsToggled && chestName.startsWith("Superpairs (")) { + for (int i = 0; i < 53; i++) { + ItemStack itemStack = invSlots.get(i).getStack(); + if (itemStack == null) continue; + String itemName = itemStack.getDisplayName(); + if (Item.getIdFromItem(itemStack.getItem()) == 95 || Item.getIdFromItem(itemStack.getItem()) == 160) continue; + if (itemName.contains("Instant Find") || itemName.contains("Gained +")) continue; + if (itemName.contains("Enchanted Book")) { + itemName = itemStack.getTooltip(mc.thePlayer, false).get(3); + } + if (itemStack.stackSize > 1) { + itemName = itemStack.stackSize + " " + itemName; + } + if (experimentTableSlots[i] != null) continue; + experimentTableSlots[i] = itemStack.copy().setStackDisplayName(itemName); + } + } + } + + if (titleTimer >= 0) { if (titleTimer == 0) { showTitle = false; } @@ -2591,7 +2712,7 @@ public class TheMod skillTimer--; } } - + // Delay GUI by 1 tick @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent event) { @@ -2614,6 +2735,9 @@ public class TheMod case "puzzlesolvers": mc.displayGuiScreen(new PuzzleSolversGui(1)); break; + case "experimentsolvers": + mc.displayGuiScreen(new ExperimentsGui()); + break; case "skilltracker": mc.displayGuiScreen(new SkillTrackerGui()); break; @@ -2622,7 +2746,7 @@ public class TheMod guiToOpen = null; } } - + @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.blazeToggled) { @@ -2644,14 +2768,17 @@ public class TheMod Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], event.partialTicks); } } + if (ToggleCommand.ticTacToeToggled && correctTicTacToeButton != null) { + Utils.draw3DBox(correctTicTacToeButton, 0x40FF40, event.partialTicks); + } } - + @SubscribeEvent public void onInteract(PlayerInteractEvent event) { if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; ItemStack item = event.entityPlayer.getHeldItem(); if (item == null) return; - + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { event.setCanceled(true); @@ -2660,18 +2787,69 @@ public class TheMod event.setCanceled(true); } } + + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + ArrayList<Block> interactables = new ArrayList<>(Arrays.asList( + Blocks.acacia_door, + Blocks.anvil, + Blocks.beacon, + Blocks.bed, + Blocks.birch_door, + Blocks.brewing_stand, + Blocks.command_block, + Blocks.crafting_table, + Blocks.chest, + Blocks.dark_oak_door, + Blocks.daylight_detector, + Blocks.daylight_detector_inverted, + Blocks.dispenser, + Blocks.dropper, + Blocks.enchanting_table, + Blocks.ender_chest, + Blocks.furnace, + Blocks.hopper, + Blocks.jungle_door, + Blocks.lever, + Blocks.noteblock, + Blocks.powered_comparator, + Blocks.unpowered_comparator, + Blocks.powered_repeater, + Blocks.unpowered_repeater, + Blocks.standing_sign, + Blocks.wall_sign, + Blocks.trapdoor, + Blocks.trapped_chest, + Blocks.wooden_button, + Blocks.stone_button, + Blocks.oak_door, + Blocks.skull + )); + if (Utils.inDungeons) { + interactables.add(Blocks.coal_block); + interactables.add(Blocks.stained_hardened_clay); + } + if (!interactables.contains(block)) { + if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { + event.setCanceled(true); + } + if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { + event.setCanceled(true); + } + } + } } - + @SubscribeEvent public void onEntityInteract(EntityInteractEvent event) { Minecraft mc = Minecraft.getMinecraft(); if (mc.thePlayer != event.entityPlayer) return; - + if (ToggleCommand.itemFrameOnSeaLanternsToggled && Utils.inDungeons && event.target instanceof EntityItemFrame) { EntityItemFrame itemFrame = (EntityItemFrame) event.target; ItemStack item = itemFrame.getDisplayedItem(); if (item == null || item.getItem() != Items.arrow) return; - BlockPos blockPos = Utils.getBlockUnderItemFrame(mc.theWorld, itemFrame); + BlockPos blockPos = Utils.getBlockUnderItemFrame(itemFrame); if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { event.setCanceled(true); } @@ -2681,7 +2859,7 @@ public class TheMod @SubscribeEvent public void onKey(KeyInputEvent event) { if (!Utils.inSkyblock) return; - + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (keyBindings[0].isPressed()) { player.sendChatMessage(lastMaddoxCommand); @@ -2699,13 +2877,13 @@ public class TheMod } } } - + @SubscribeEvent public void onGuiMouseInputPre(GuiScreenEvent.MouseInputEvent.Pre event) { if (!Utils.inSkyblock) return; - if (Mouse.getEventButton() == lastMouse) return; - if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1) return; // Left click or right click - + if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1 && Mouse.getEventButton() != 2) return; // Left click, middle click or right click + if (!Mouse.getEventButtonState()) return; + if (event.gui instanceof GuiChest) { Container containerChest = ((GuiChest) event.gui).inventorySlots; if (containerChest instanceof ContainerChest) { @@ -2713,11 +2891,28 @@ public class TheMod GuiChest chest = (GuiChest) event.gui; IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); Slot mouseSlot = chest.getSlotUnderMouse(); - if (mouseSlot == null || mouseSlot.getStack() == null) return; + if (mouseSlot == null) return; ItemStack item = mouseSlot.getStack(); String inventoryName = inventory.getDisplayName().getUnformattedText(); - - if (inventoryName.endsWith(" Chest") && item.getDisplayName().contains("Open Reward Chest")) { + + if (ToggleCommand.stopSalvageStarredToggled && inventoryName.startsWith("Salvage")) { + if (item == null) return; + boolean inSalvageGui = false; + if (item.getDisplayName().contains("Salvage") || item.getDisplayName().contains("Essence")) { + ItemStack salvageItem = inventory.getStackInSlot(13); + if (salvageItem == null) return; + item = salvageItem; + inSalvageGui = true; + } + if (item.getDisplayName().contains("✪") && (mouseSlot.slotNumber > 53 || inSalvageGui)) { + Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, 0.5f); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from salvaging that item!")); + event.setCanceled(true); + return; + } + } + + if (inventoryName.endsWith(" Chest") && item != null && item.getDisplayName().contains("Open Reward Chest")) { List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); for (String lineUnclean : tooltip) { String line = StringUtils.stripControlCodes(lineUnclean); @@ -2725,7 +2920,7 @@ public class TheMod break; } else if (line.contains(" Coins")) { int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", "")); - + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { String sCleaned = ScoreboardHandler.cleanSB(s); @@ -2765,9 +2960,44 @@ public class TheMod break; } } - } - - if (!BlockSlayerCommand.onlySlayerName.equals("")) { + } + + if (ToggleCommand.chronomatronToggled && inventoryName.startsWith("Chronomatron (")) { + if (item == null) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) event.setCanceled(true); + return; + } + if (inventory.getStackInSlot(49).getDisplayName().startsWith("§7Timer: §a") && (item.getItem() == Item.getItemFromBlock(Blocks.stained_glass) || item.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay))) { + if (chronomatronPattern.size() > chronomatronMouseClicks && !item.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) event.setCanceled(true); + return; + } + chronomatronMouseClicks++; + } else if (inventory.getStackInSlot(49).getDisplayName().startsWith("§aRemember the pattern!")) { + if (event.isCancelable()) event.setCanceled(true); + return; + } + } + + if (ToggleCommand.ultrasequencerToggled && inventoryName.startsWith("Ultrasequencer (")) { + if (item == null) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + if (inventory.getStackInSlot(49).getDisplayName().equals("§aRemember the pattern!")) { + if (event.isCancelable()) event.setCanceled(true); + return; + } else if (inventory.getStackInSlot(49).getDisplayName().startsWith("§7Timer: §a")) { + if (clickInOrderSlots[lastUltraSequencerClicked] != null && mouseSlot.getSlotIndex() != clickInOrderSlots[lastUltraSequencerClicked].getSlotIndex()) { + if (event.isCancelable() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) + event.setCanceled(true); + return; + } + } + } + + if (!BlockSlayerCommand.onlySlayerName.equals("") && item != null) { if (inventoryName.equals("Slayer")) { if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) return; if (!item.getDisplayName().contains(BlockSlayerCommand.onlySlayerName)) { @@ -2778,7 +3008,7 @@ public class TheMod } else if (inventoryName.equals("Revenant Horror") || inventoryName.equals("Tarantula Broodfather") || inventoryName.equals("Sven Packmaster")) { if (item.getDisplayName().contains("Revenant Horror") || item.getDisplayName().contains("Tarantula Broodfather") || item.getDisplayName().contains("Sven Packmaster")) { // Only check number as they passed the above check - String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1, item.getDisplayName().length()); + String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1); if (!slayerNumber.equals(BlockSlayerCommand.onlySlayerNumber)) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber + ")")); Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5); @@ -2790,31 +3020,66 @@ public class TheMod } } } - + @SubscribeEvent public void onMouseInputPost(GuiScreenEvent.MouseInputEvent.Post event) { if (!Utils.inSkyblock) return; - if (Mouse.getEventButton() == lastMouse) return; if (Mouse.getEventButton() == 0 && event.gui instanceof GuiChat) { if (ToggleCommand.chatMaddoxToggled && System.currentTimeMillis() / 1000 - lastMaddoxTime < 10) { Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); } } - - lastMouse = Mouse.getEventButton(); } - + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + GameSettings gameSettings = mc.gameSettings; + if (event.gui instanceof GuiChest) { + Container containerChest = ((GuiChest) event.gui).inventorySlots; + if (containerChest instanceof ContainerChest) { + GuiChest chest = (GuiChest) event.gui; + IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); + String inventoryName = inventory.getDisplayName().getUnformattedText(); + if (ToggleCommand.swapToPickBlockInExperimentsToggled) { + if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (")) { + if (!pickBlockBindSwapped) { + pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode(); + gameSettings.keyBindPickBlock.setKeyCode(-100); + pickBlockBindSwapped = true; + } + } else { + if (pickBlockBindSwapped) { + gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind); + pickBlockBindSwapped = false; + } + } + } + } + } + clickInOrderSlots = new Slot[36]; + lastChronomatronRound = 0; + chronomatronPattern.clear(); + chronomatronMouseClicks = 0; + experimentTableSlots = new ItemStack[54]; + } + @SubscribeEvent public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent event) { - //if (!Utils.inSkyblock) return; + if (!Utils.inSkyblock) return; if (event.gui instanceof GuiChest) { GuiChest inventory = (GuiChest) event.gui; Container containerChest = inventory.inventorySlots; if (containerChest instanceof ContainerChest) { + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution sr = new ScaledResolution(mc); + int guiLeft = (sr.getScaledWidth() - 176) / 2; + int guiTop = (sr.getScaledHeight() - 222) / 2; + List<Slot> invSlots = inventory.inventorySlots.inventorySlots; - String displayName = ((ContainerChest) containerChest).getLowerChestInventory().getDisplayName().getUnformattedText(); + String displayName = ((ContainerChest) containerChest).getLowerChestInventory().getDisplayName().getUnformattedText().trim(); int chestSize = inventory.inventorySlots.inventorySlots.size(); - + if (ToggleCommand.petColoursToggled) { Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); for (Slot slot : invSlots) { @@ -2852,8 +3117,8 @@ public class TheMod } } } - - if (ToggleCommand.startsWithToggled && Utils.inDungeons && displayName.trim().startsWith("What starts with:")) { + + if (ToggleCommand.startsWithToggled && Utils.inDungeons && displayName.startsWith("What starts with:")) { char letter = displayName.charAt(displayName.indexOf("'") + 1); for (Slot slot : invSlots) { ItemStack item = slot.getStack(); @@ -2863,8 +3128,8 @@ public class TheMod } } } - - if (ToggleCommand.selectAllToggled && Utils.inDungeons && displayName.trim().startsWith("Select all the")) { + + if (ToggleCommand.selectAllToggled && Utils.inDungeons && displayName.startsWith("Select all the")) { String colour = displayName.split(" ")[3]; for (Slot slot : invSlots) { ItemStack item = slot.getStack(); @@ -2874,6 +3139,108 @@ public class TheMod } } } + + if (ToggleCommand.ultrasequencerToggled && displayName.startsWith("Ultrasequencer (")) { + if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) { + if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a")) { + lastUltraSequencerClicked = 0; + for (Slot slot : clickInOrderSlots) { + if (slot != null && slot.getStack() != null && StringUtils.stripControlCodes(slot.getStack().getDisplayName()).matches("\\d+")) { + int number = Integer.parseInt(StringUtils.stripControlCodes(slot.getStack().getDisplayName())); + if (number > lastUltraSequencerClicked) { + lastUltraSequencerClicked = number; + } + } + } + if (clickInOrderSlots[lastUltraSequencerClicked] != null) { + Slot nextSlot = clickInOrderSlots[lastUltraSequencerClicked]; + Utils.drawOnSlot(chestSize, nextSlot.xDisplayPosition, nextSlot.yDisplayPosition, 0xE540FF40); + } + } + } + } + + if (ToggleCommand.chronomatronToggled && displayName.startsWith("Chronomatron (")) { + if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) { + if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a") && invSlots.get(4).getStack() != null) { + int round = invSlots.get(4).getStack().stackSize; + int timerSeconds = Integer.parseInt(StringUtils.stripControlCodes(invSlots.get(49).getStack().getDisplayName()).replaceAll("[^\\d]", "")); + if (round != lastChronomatronRound && timerSeconds == round + 2) { + lastChronomatronRound = round; + for (int i = 10; i <= 43; i++) { + ItemStack stack = invSlots.get(i).getStack(); + if (stack == null) continue; + if (stack.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay)) { + chronomatronPattern.add(stack.getDisplayName()); + break; + } + } + } + if (chronomatronMouseClicks < chronomatronPattern.size()) { + for (int i = 10; i <= 43; i++) { + ItemStack glass = invSlots.get(i).getStack(); + if (glass == null) continue; + Slot glassSlot = invSlots.get(i); + if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) { + Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, 0xE540FF40); + } + } + } + } else if (invSlots.get(49).getStack().getDisplayName().equals("§aRemember the pattern!")) { + chronomatronMouseClicks = 0; + } + } + new TextRenderer(mc, String.join("\n", chronomatronPattern), (int) (guiLeft * 0.8), 10, 1); + } + + if (ToggleCommand.superpairsToggled && displayName.contains("Superpairs (")) { + HashMap<String, HashSet<Integer>> matches = new HashMap<>(); + for(int i = 0; i<53; i++) { + ItemStack itemStack = experimentTableSlots[i]; + if (itemStack == null) continue; + Slot slot = invSlots.get(i); + int x = guiLeft + slot.xDisplayPosition; + int y = guiTop + slot.yDisplayPosition; + if (chestSize != 90) y += (6 - (chestSize - 36) / 9) * 9; + + //Utils.renderItem(itemStack, x, y, -100); + + String itemName = itemStack.getDisplayName(); + String keyName = itemName + itemStack.getUnlocalizedName(); + matches.computeIfAbsent(keyName, k -> new HashSet<>()); + matches.get(keyName).add(i); + } + + Color[] colors = { + new Color(255, 0, 0, 100), + new Color(0, 0, 255, 100), + new Color(100, 179, 113, 100), + new Color(255, 114, 255, 100), + new Color(255, 199, 87, 100), + new Color(119, 105, 198, 100), + new Color(135, 199, 112, 100), + new Color(240, 37, 240, 100), + new Color(178, 132, 190, 100), + new Color(63, 135, 163, 100), + new Color(146, 74, 10, 100), + new Color(255, 255, 255, 100), + new Color(217, 252, 140, 100), + new Color(255, 82, 82, 100) + }; + + Iterator<Color> colorIterator = Arrays.stream(colors).iterator(); + + matches.forEach((itemName, slotSet)->{ + if (slotSet.size() < 2) return; + ArrayList<Slot> slots = new ArrayList<>(); + slotSet.forEach(slotNum->slots.add(invSlots.get(slotNum))); + Color color = colorIterator.next(); + slots.forEach(slot->{ + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, color.getRGB()); + }); + }); + } + } } } diff --git a/src/main/java/me/Danker/commands/ArmourCommand.java b/src/main/java/me/Danker/commands/ArmourCommand.java index a10d75f..579a413 100644 --- a/src/main/java/me/Danker/commands/ArmourCommand.java +++ b/src/main/java/me/Danker/commands/ArmourCommand.java @@ -1,15 +1,7 @@ package me.Danker.commands; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Base64; -import java.util.Collections; -import java.util.List; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -24,6 +16,13 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Base64; +import java.util.Collections; +import java.util.List; + public class ArmourCommand extends CommandBase { @Override @@ -72,10 +71,10 @@ public class ArmourCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking armour of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking armour of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking armour of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking armour of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -88,7 +87,7 @@ public class ArmourCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -131,16 +130,16 @@ public class ArmourCommand extends CommandBase { } armourStream.close(); - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Armour:\n" + - TheMod.TYPE_COLOUR + " Helmet: " + helmet + "\n" + - TheMod.TYPE_COLOUR + " Chestplate: " + chest + "\n" + - TheMod.TYPE_COLOUR + " Leggings: " + legs + "\n" + - TheMod.TYPE_COLOUR + " Boots: " + boots + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Helmet: " + helmet + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Chestplate: " + chest + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Leggings: " + legs + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Boots: " + boots + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); } catch (IOException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occurred while reading inventory data. See logs for more info.")); - System.err.println(ex); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error has occurred while reading inventory data. See logs for more info.")); + ex.printStackTrace(); } }).start(); } diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java index 6e2ddaa..e1bbdde 100644 --- a/src/main/java/me/Danker/commands/BankCommand.java +++ b/src/main/java/me/Danker/commands/BankCommand.java @@ -1,13 +1,7 @@ package me.Danker.commands; -import java.text.NumberFormat; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -19,6 +13,11 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; +import java.util.Collections; +import java.util.List; +import java.util.Locale; + public class BankCommand extends CommandBase { @Override @@ -67,10 +66,10 @@ public class BankCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking coins of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking coins of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking coins of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking coins of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -89,25 +88,26 @@ public class BankCommand extends CommandBase { System.out.println("Fetching bank + purse coins..."); double purseCoins = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("coin_purse").getAsDouble(); - purseCoins = (double) Math.floor(purseCoins * 100.0) / 100.0; + purseCoins = Math.floor(purseCoins * 100.0) / 100.0; NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); // Check for bank api if (profileResponse.get("profile").getAsJsonObject().has("banking")) { double bankCoins = profileResponse.get("profile").getAsJsonObject().get("banking").getAsJsonObject().get("balance").getAsDouble(); - bankCoins = (double) Math.floor(bankCoins * 100.0) / 100.0; + bankCoins = Math.floor(bankCoins * 100.0) / 100.0; - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" + - TheMod.TYPE_COLOUR + " Bank: " + EnumChatFormatting.GOLD + nf.format(bankCoins) + "\n" + - TheMod.TYPE_COLOUR + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Bank: " + EnumChatFormatting.GOLD + nf.format(bankCoins) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Total: " + EnumChatFormatting.GOLD + nf.format(bankCoins + purseCoins) + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); } else { - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" + - TheMod.TYPE_COLOUR + " Bank: " + EnumChatFormatting.RED + "Bank API disabled.\n" + - TheMod.TYPE_COLOUR + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Bank: " + EnumChatFormatting.RED + "Bank API disabled.\n" + + DankersSkyblockMod.TYPE_COLOUR + " Purse: " + EnumChatFormatting.GOLD + nf.format(purseCoins) + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); } }).start(); } diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java index d2144f6..606b930 100644 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -11,6 +9,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import java.util.List; + public class BlockSlayerCommand extends CommandBase { public static String onlySlayerName = ""; @@ -46,7 +46,7 @@ public class BlockSlayerCommand extends CommandBase { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -64,10 +64,10 @@ public class BlockSlayerCommand extends CommandBase { onlySlayerName = ""; onlySlayerNumber = ""; ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking turned off.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer blocking turned off.")); return; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -89,12 +89,12 @@ public class BlockSlayerCommand extends CommandBase { default: onlySlayerName = ""; onlySlayerNumber = ""; - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } ConfigHandler.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking set to " + TheMod.SECONDARY_COLOUR + onlySlayerName + " " + onlySlayerNumber)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer blocking set to " + DankersSkyblockMod.SECONDARY_COLOUR + onlySlayerName + " " + onlySlayerNumber)); } } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 4f99c0d..ee5958c 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -1,6 +1,6 @@ package me.Danker.commands; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -29,19 +29,19 @@ 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 + " " + TheMod.MODID + " Version " + TheMod.VERSION + "\n" + + player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " " + DankersSkyblockMod.MODID + " Version " + DankersSkyblockMod.VERSION + "\n" + 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 + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/threemanpuzzle/midasstaffmessages/healmessages/caketimer/lowhealthnotify/lividsolver/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/startswithterminal/selectallterminal/itemframeonsealanterns/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/lividdagger/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/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/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/catacombs/mythological/auto/off> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" + EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/catacombs/mythological/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <scale (0.1 - 10)>" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer> <scale (0.1 - 10)>" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\n" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 3616849..18230e6 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -1,6 +1,6 @@ package me.Danker.commands; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -24,7 +24,7 @@ public class DankerGuiCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } } diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 1cd8c80..d20491b 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -11,6 +9,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import java.util.List; + public class DisplayCommand extends CommandBase { public static String display; public static boolean auto; @@ -38,7 +38,7 @@ public class DisplayCommand extends CommandBase { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7"); - } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + } else if (args.length > 1) { return getListOfStringsMatchingLastWord(args, "session"); } return null; @@ -49,7 +49,7 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -71,6 +71,7 @@ public class DisplayCommand extends CommandBase { } else { display = "spider"; } + break; case "zombie": if (showSession) { display = "zombie_session"; @@ -126,7 +127,7 @@ public class DisplayCommand extends CommandBase { break; case "catacombs": if (arg1.length == 1) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: /display catacombs <f1/f2/f3/f4f5/f6/f7>")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /display catacombs <f1/f2/f3/f4f5/f6/f7>")); return; } @@ -188,25 +189,25 @@ public class DisplayCommand extends CommandBase { } break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: /display catacombs <f1/f2/f3/f4/f5/f6/f7>")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /display catacombs <f1/f2/f3/f4/f5/f6/f7>")); return; } break; case "auto": auto = true; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Display set to " + TheMod.SECONDARY_COLOUR + "auto" + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + "auto" + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); return; case "off": display = "off"; break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } auto = false; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Display set to " + TheMod.SECONDARY_COLOUR + display + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display set to " + DankersSkyblockMod.SECONDARY_COLOUR + display + DankersSkyblockMod.MAIN_COLOUR + ".")); ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); ConfigHandler.writeStringConfig("misc", "display", display); } diff --git a/src/main/java/me/Danker/commands/DungeonsCommand.java b/src/main/java/me/Danker/commands/DungeonsCommand.java index 4b8c126..bdc1403 100644 --- a/src/main/java/me/Danker/commands/DungeonsCommand.java +++ b/src/main/java/me/Danker/commands/DungeonsCommand.java @@ -1,10 +1,7 @@ package me.Danker.commands; -import java.util.List; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -16,6 +13,8 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.List; + public class DungeonsCommand extends CommandBase { @Override @@ -50,7 +49,7 @@ public class DungeonsCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } // Get UUID for Hypixel API requests @@ -59,10 +58,10 @@ public class DungeonsCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking dungeon stats of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking dungeon stats of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking dungeon stats of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking dungeon stats of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -75,14 +74,14 @@ public class DungeonsCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } System.out.println("Fetching dungeon stats..."); JsonObject dungeonsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("dungeons").getAsJsonObject(); if (!dungeonsObject.get("dungeon_types").getAsJsonObject().get("catacombs").getAsJsonObject().has("experience")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "This player has not played dungeons.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "This player has not played dungeons.")); return; } @@ -94,7 +93,7 @@ public class DungeonsCommand extends CommandBase { double tank = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("tank").getAsJsonObject().get("experience").getAsDouble()); String selectedClass = Utils.capitalizeString(dungeonsObject.get("selected_dungeon_class").getAsString()); - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.RED + " Catacombs Level: " + catacombs + "\n" + EnumChatFormatting.GOLD + " Selected Class: " + selectedClass + "\n\n" + EnumChatFormatting.YELLOW + " Healer Level: " + healer + "\n" + @@ -102,7 +101,7 @@ public class DungeonsCommand extends CommandBase { EnumChatFormatting.RED + " Berserk Level: " + berserk + "\n" + EnumChatFormatting.GREEN + " Archer Level: " + archer + "\n" + EnumChatFormatting.BLUE + " Tank Level: " + tank + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/GetkeyCommand.java b/src/main/java/me/Danker/commands/GetkeyCommand.java index e7dd051..9cbb280 100644 --- a/src/main/java/me/Danker/commands/GetkeyCommand.java +++ b/src/main/java/me/Danker/commands/GetkeyCommand.java @@ -1,10 +1,6 @@ package me.Danker.commands; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -13,6 +9,10 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; + public class GetkeyCommand extends CommandBase implements ICommand { @Override @@ -37,12 +37,12 @@ public class GetkeyCommand extends CommandBase implements ICommand { StringSelection stringSelection = new StringSelection(ConfigHandler.getString("api", "APIKey")); if (ConfigHandler.getString("api", "APIKey").equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Set your API key using /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Set your API key using /setkey.")); } clipboard.setContents(stringSelection, null); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Your set API key is " + TheMod.SECONDARY_COLOUR + ConfigHandler.getString("api", "APIKey") + "\n" + - TheMod.MAIN_COLOUR + " Your set API key has been copied to the clipboard.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Your set API key is " + DankersSkyblockMod.SECONDARY_COLOUR + ConfigHandler.getString("api", "APIKey") + "\n" + + DankersSkyblockMod.MAIN_COLOUR + " Your set API key has been copied to the clipboard.")); } diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java index 881a9c4..eb2a26f 100644 --- a/src/main/java/me/Danker/commands/GuildOfCommand.java +++ b/src/main/java/me/Danker/commands/GuildOfCommand.java @@ -1,12 +1,9 @@ package me.Danker.commands; -import java.util.List; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -18,6 +15,8 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.List; + public class GuildOfCommand extends CommandBase { @Override @@ -52,7 +51,7 @@ public class GuildOfCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } // Get UUID for Hypixel API requests @@ -61,10 +60,10 @@ public class GuildOfCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking guild of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking guild of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking guild of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking guild of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -74,7 +73,7 @@ public class GuildOfCommand extends CommandBase { JsonObject guildResponse = APIHandler.getResponse(guildURL); if (!guildResponse.get("success").getAsBoolean()) { String reason = guildResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -106,12 +105,12 @@ public class GuildOfCommand extends CommandBase { } } - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Guild:\n" + - TheMod.TYPE_COLOUR + " Guild: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + guildName + "\n" + - TheMod.TYPE_COLOUR + " Guildmaster: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + guildMaster + "\n" + - TheMod.TYPE_COLOUR + " Members: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + players + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Guild: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + guildName + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Guildmaster: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + guildMaster + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Members: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + players + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 734a561..e508ecb 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -1,8 +1,7 @@ package me.Danker.commands; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; @@ -37,13 +36,12 @@ public class ImportFishingCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Importing your fishing stats...")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Importing your fishing stats...")); // Get UUID for Hypixel API requests - String username = player.getName(); String uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); String latestProfile = APIHandler.getLatestProfileID(uuid, key); @@ -54,7 +52,7 @@ public class ImportFishingCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -286,7 +284,7 @@ public class ImportFishingCommand extends CommandBase { ConfigHandler.writeIntConfig("fishing", "phantomFisher", LootCommand.phantomFishers); ConfigHandler.writeIntConfig("fishing", "grimReaper", LootCommand.grimReapers); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Fishing stats imported.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); } diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 679898d..e5bf98c 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -1,17 +1,8 @@ package me.Danker.commands; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - import com.google.gson.JsonArray; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -24,6 +15,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.*; +import java.util.Map.Entry; +import java.util.stream.Collectors; + public class LobbySkillsCommand extends CommandBase { Thread mainThread = null; @@ -46,20 +41,20 @@ public class LobbySkillsCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { EntityPlayer playerSP = (EntityPlayer) arg0; - Map<String, Double> unsortedSAList = new HashMap<String, Double>(); - ArrayList<Double> lobbySkills = new ArrayList<Double>(); + Map<String, Double> unsortedSAList = new HashMap<>(); + ArrayList<Double> lobbySkills = new ArrayList<>(); // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - playerSP.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + playerSP.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); return; } mainThread = new Thread(() -> { try { // Create deep copy of players to prevent passing reference and ConcurrentModificationException - Collection<NetworkPlayerInfo> players = new ArrayList<NetworkPlayerInfo>(Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap()); - playerSP.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking skill average of lobby. Estimated time: " + (int) (players.size() * 1.2 + 1) + " seconds.")); + Collection<NetworkPlayerInfo> players = new ArrayList<>(Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap()); + playerSP.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking skill average of lobby. Estimated time: " + (int) (players.size() * 1.2 + 1) + " seconds.")); // Send request every .6 seconds, leaving room for another 20 requests per minute for (final NetworkPlayerInfo player : players) { @@ -121,7 +116,7 @@ public class LobbySkillsCommand extends CommandBase { fishingLevel = (double) Math.round(fishingLevel * 100) / 100; } if (latestProfile.has("experience_skill_enchanting")) { - enchantingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_enchanting").getAsDouble(), 50); + enchantingLevel = Utils.xpToSkillLevel(latestProfile.get("experience_skill_enchanting").getAsDouble(), 60); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; } if (latestProfile.has("experience_skill_alchemy")) { @@ -148,25 +143,25 @@ public class LobbySkillsCommand extends CommandBase { farmingLevel = achievementObject.get("skyblock_harvester").getAsInt(); } if (achievementObject.has("skyblock_excavator")) { - miningLevel = achievementObject.get("skyblock_excavator").getAsInt(); + miningLevel = Math.min(achievementObject.get("skyblock_excavator").getAsInt(), 50); } if (achievementObject.has("skyblock_combat")) { - combatLevel = achievementObject.get("skyblock_combat").getAsInt(); + combatLevel = Math.min(achievementObject.get("skyblock_combat").getAsInt(), 50); } if (achievementObject.has("skyblock_gatherer")) { - foragingLevel = achievementObject.get("skyblock_gatherer").getAsInt(); + foragingLevel = Math.min(achievementObject.get("skyblock_gatherer").getAsInt(), 50); } if (achievementObject.has("skyblock_angler")) { - fishingLevel = achievementObject.get("skyblock_angler").getAsInt(); + fishingLevel = Math.min(achievementObject.get("skyblock_angler").getAsInt(), 50); } if (achievementObject.has("skyblock_augmentation")) { enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); } if (achievementObject.has("skyblock_concoctor")) { - alchemyLevel = achievementObject.get("skyblock_concoctor").getAsInt(); + alchemyLevel = Math.min(achievementObject.get("skyblock_concoctor").getAsInt(), 50); } if (achievementObject.has("skyblock_domesticator")) { - tamingLevel = achievementObject.get("skyblock_domesticator").getAsInt(); + tamingLevel = Math.min(achievementObject.get("skyblock_domesticator").getAsInt(), 50); } } @@ -182,24 +177,24 @@ public class LobbySkillsCommand extends CommandBase { .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); - String[] sortedSAListKeys = sortedSAList.keySet().toArray(new String[sortedSAList.keySet().size()]); + String[] sortedSAListKeys = sortedSAList.keySet().toArray(new String[0]); String top3 = ""; for (int i = 0; i < 3 && i < sortedSAListKeys.length; i++) { - top3 += "\n " + EnumChatFormatting.AQUA + sortedSAListKeys[i] + ": " + TheMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + sortedSAList.get(sortedSAListKeys[i]); + top3 += "\n " + EnumChatFormatting.AQUA + sortedSAListKeys[i] + ": " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + sortedSAList.get(sortedSAListKeys[i]); } // Get lobby sa double lobbySA = 0; - for (int i = 0; i < lobbySkills.size(); i++) { - lobbySA += lobbySkills.get(i); + for (Double playerSkills : lobbySkills) { + lobbySA += playerSkills; } lobbySA = (double) Math.round((lobbySA / lobbySkills.size()) * 100) / 100; // Finally say skill lobby avg and highest SA users - playerSP.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + - TheMod.TYPE_COLOUR + " Lobby Skill Average: " + TheMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + lobbySA + "\n" + - TheMod.TYPE_COLOUR + " Highest Skill Averages:" + top3 + "\n" + - TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + " -------------------")); + playerSP.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + DankersSkyblockMod.TYPE_COLOUR + " Lobby Skill Average: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + lobbySA + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Highest Skill Averages:" + top3 + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + " -------------------")); } catch (InterruptedException ex) { System.out.println("Current skill average list: " + unsortedSAList.toString()); Thread.currentThread().interrupt(); diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index ffe5e49..0f38ada 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -1,10 +1,6 @@ package me.Danker.commands; -import java.text.NumberFormat; -import java.util.List; -import java.util.Locale; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.utils.Utils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -14,6 +10,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; +import java.util.List; +import java.util.Locale; + public class LootCommand extends CommandBase { // Wolf public static int wolfSvens; @@ -357,7 +357,7 @@ public class LootCommand extends CommandBase { return getListOfStringsMatchingLastWord(args, "winter", "festival", "spooky", "session"); } else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) { return getListOfStringsMatchingLastWord(args, "f1", "floor1", "f2", "floor2", "f3", "floor3", "f4", "floor4", "f5", "floor5", "f6", "floor6", "f7", "floor7"); - } else if (args.length > 1 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) { + } else if (args.length > 1) { return getListOfStringsMatchingLastWord(args, "session"); } return null; @@ -368,7 +368,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -778,7 +778,7 @@ public class LootCommand extends CommandBase { break; case "catacombs": if (arg1.length == 1) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: /loot catacombs <f1/f2/f3/f4/f5/f6/f7>")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /loot catacombs <f1/f2/f3/f4/f5/f6/f7>")); return; } switch (arg1[1].toLowerCase()) { @@ -1005,11 +1005,11 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " -------------------")); break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: /loot catacombs <f1/f2/f3/f4/f5/f6/f7>")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /loot catacombs <f1/f2/f3/f4/f5/f6/f7>")); } break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 76babad..e9bfe61 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -11,6 +9,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import java.util.List; + public class MoveCommand extends CommandBase { public static int[] coordsXY = {0, 0}; @@ -20,6 +20,7 @@ public class MoveCommand extends CommandBase { public static int[] lividHpXY = {0, 0}; public static int[] cakeTimerXY = {0, 0}; public static int[] skillTrackerXY = {0, 0}; + public static int[] waterAnswerXY = {0, 0}; @Override public String getCommandName() { @@ -28,7 +29,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <x> <y>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer> <x> <y>"; } @Override @@ -39,7 +40,7 @@ public class MoveCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer"); } return null; } @@ -49,7 +50,7 @@ public class MoveCommand extends CommandBase { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length < 2) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -59,52 +60,59 @@ public class MoveCommand extends CommandBase { coordsXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "coordsX", coordsXY[0]); ConfigHandler.writeIntConfig("locations", "coordsY", coordsXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Coords have been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Coords have been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "display": displayXY[0] = Integer.parseInt(arg1[1]); displayXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "displayX", displayXY[0]); ConfigHandler.writeIntConfig("locations", "displayY", displayXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Tracker display has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Tracker display has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "dungeontimer": dungeonTimerXY[0] = Integer.parseInt(arg1[1]); dungeonTimerXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "dungeonTimerX", dungeonTimerXY[0]); ConfigHandler.writeIntConfig("locations", "dungeonTimerY", dungeonTimerXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Dungeon timer has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "skill50": skill50XY[0] = Integer.parseInt(arg1[1]); skill50XY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "skill50X", skill50XY[0]); ConfigHandler.writeIntConfig("locations", "skill50Y", skill50XY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill 50 display has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill 50 display has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "lividhp": lividHpXY[0] = Integer.parseInt(arg1[1]); lividHpXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "lividHpX", lividHpXY[0]); ConfigHandler.writeIntConfig("locations", "lividHpY", lividHpXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Livid HP has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Livid HP has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "caketimer": cakeTimerXY[0] = Integer.parseInt(arg1[1]); cakeTimerXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "cakeTimerX", cakeTimerXY[0]); ConfigHandler.writeIntConfig("locations", "cakeTimerY", cakeTimerXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Cake timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; case "skilltracker": skillTrackerXY[0] = Integer.parseInt(arg1[1]); skillTrackerXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "skillTrackerX", skillTrackerXY[0]); ConfigHandler.writeIntConfig("locations", "skillTrackerY", skillTrackerXY[1]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; + case "wateranswer": + waterAnswerXY[0] = Integer.parseInt(arg1[1]); + waterAnswerXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "waterAnswerX", waterAnswerXY[0]); + ConfigHandler.writeIntConfig("locations", "waterAnswerY", waterAnswerXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water solver answer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 8e41814..7b1b52f 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -1,14 +1,9 @@ package me.Danker.commands; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -20,6 +15,9 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; +import java.util.List; + public class PetsCommand extends CommandBase { static int petXpToLevel(double xp, String rarity) { @@ -33,14 +31,19 @@ public class PetsCommand extends CommandBase { 1616700, 1746700, 1886700}; int levelOffset = 0; - if (rarity.equals("UNCOMMON")) { - levelOffset = 6; - } else if (rarity.equals("RARE")) { - levelOffset = 11; - } else if (rarity.equals("EPIC")) { - levelOffset = 16; - } else if (rarity.equals("LEGENDARY")) { - levelOffset = 20; + switch (rarity) { + case "UNCOMMON": + levelOffset = 6; + break; + case "RARE": + levelOffset = 11; + break; + case "EPIC": + levelOffset = 16; + break; + case "LEGENDARY": + levelOffset = 20; + break; } for (int i = levelOffset, xpAdded = 0; i < levelOffset + 99; i++) { @@ -84,7 +87,7 @@ public class PetsCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } // Get UUID for Hypixel API requests @@ -93,10 +96,10 @@ public class PetsCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking pets of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking pets of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking pets of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking pets of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -109,57 +112,63 @@ public class PetsCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } System.out.println("Fetching pets..."); JsonArray petsArray = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("pets").getAsJsonArray(); if (petsArray.size() == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + username + " has no pets.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + username + " has no pets.")); return; } System.out.println("Looping through pets..."); // Push each pet into list - List<JsonElement> sortedPets = new ArrayList<JsonElement>(); + List<JsonElement> sortedPets = new ArrayList<>(); for (JsonElement petElement : petsArray) { sortedPets.add(petElement); } // Sort pets by exp - Collections.sort(sortedPets, (pet1, pet2) -> { + sortedPets.sort((pet1, pet2) -> { double petXp1 = pet1.getAsJsonObject().get("exp").getAsDouble(); double petXp2 = pet2.getAsJsonObject().get("exp").getAsDouble(); return -Double.compare(petXp1, petXp2); }); // Sort pets into rarities - List<JsonObject> commonPets = new ArrayList<JsonObject>(); - List<JsonObject> uncommonPets = new ArrayList<JsonObject>(); - List<JsonObject> rarePets = new ArrayList<JsonObject>(); - List<JsonObject> epicPets = new ArrayList<JsonObject>(); - List<JsonObject> legendaryPets = new ArrayList<JsonObject>(); + List<JsonObject> commonPets = new ArrayList<>(); + List<JsonObject> uncommonPets = new ArrayList<>(); + List<JsonObject> rarePets = new ArrayList<>(); + List<JsonObject> epicPets = new ArrayList<>(); + List<JsonObject> legendaryPets = new ArrayList<>(); for (JsonElement petElement : sortedPets) { JsonObject pet = petElement.getAsJsonObject(); String rarity = pet.get("tier").getAsString(); - - if (rarity.equals("COMMON")) { - commonPets.add(pet); - } else if (rarity.equals("UNCOMMON")) { - uncommonPets.add(pet); - } else if (rarity.equals("RARE")) { - rarePets.add(pet); - } else if (rarity.equals("EPIC")) { - epicPets.add(pet); - } else if (rarity.equals("LEGENDARY")) { - legendaryPets.add(pet); + + switch (rarity) { + case "COMMON": + commonPets.add(pet); + break; + case "UNCOMMON": + uncommonPets.add(pet); + break; + case "RARE": + rarePets.add(pet); + break; + case "EPIC": + epicPets.add(pet); + break; + case "LEGENDARY": + legendaryPets.add(pet); + break; } } int totalPets = commonPets.size() + uncommonPets.size() + rarePets.size() + epicPets.size() + legendaryPets.size(); - String finalMessage = TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + String finalMessage = DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Pets (" + totalPets + "):\n"; // Loop through pet rarities @@ -167,7 +176,7 @@ public class PetsCommand extends CommandBase { String petName = Utils.capitalizeString(legPet.get("type").getAsString()); int level = petXpToLevel(legPet.get("exp").getAsDouble(), "LEGENDARY"); - String messageToAdd = ""; + String messageToAdd; if (legPet.get("active").getAsBoolean()) { messageToAdd = EnumChatFormatting.GOLD + " " + EnumChatFormatting.BOLD + ">>> Legendary " + petName + " (" + level + ") <<<"; } else { @@ -181,7 +190,7 @@ public class PetsCommand extends CommandBase { String petName = Utils.capitalizeString(epicPet.get("type").getAsString()); int level = petXpToLevel(epicPet.get("exp").getAsDouble(), "EPIC"); - String messageToAdd = ""; + String messageToAdd; if (epicPet.get("active").getAsBoolean()) { messageToAdd = EnumChatFormatting.DARK_PURPLE + " " + EnumChatFormatting.BOLD + ">>> Epic " + petName + " (" + level + ") <<<"; } else { @@ -195,7 +204,7 @@ public class PetsCommand extends CommandBase { String petName = Utils.capitalizeString(rarePet.get("type").getAsString()); int level = petXpToLevel(rarePet.get("exp").getAsDouble(), "RARE"); - String messageToAdd = ""; + String messageToAdd; if (rarePet.get("active").getAsBoolean()) { messageToAdd = EnumChatFormatting.BLUE + " " + EnumChatFormatting.BOLD + ">>> Rare " + petName + " (" + level + ") <<<"; } else { @@ -209,7 +218,7 @@ public class PetsCommand extends CommandBase { String petName = Utils.capitalizeString(uncommonPet.get("type").getAsString()); int level = petXpToLevel(uncommonPet.get("exp").getAsDouble(), "UNCOMMON"); - String messageToAdd = ""; + String messageToAdd; if (uncommonPet.get("active").getAsBoolean()) { messageToAdd = EnumChatFormatting.GREEN + " " + EnumChatFormatting.BOLD + ">>> Uncommon " + petName + " (" + level + ") <<<"; } else { @@ -223,7 +232,7 @@ public class PetsCommand extends CommandBase { String petName = Utils.capitalizeString(commonPet.get("type").getAsString()); int level = petXpToLevel(commonPet.get("exp").getAsDouble(), "COMMON"); - String messageToAdd = ""; + String messageToAdd; if (commonPet.get("active").getAsBoolean()) { messageToAdd = EnumChatFormatting.BOLD + ">>> Common " + petName + " (" + level + ") <<<"; } else { @@ -233,7 +242,7 @@ public class PetsCommand extends CommandBase { finalMessage += messageToAdd + "\n"; } - finalMessage += TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------"; + finalMessage += DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------"; player.addChatMessage(new ChatComponentText(finalMessage)); }).start(); diff --git a/src/main/java/me/Danker/commands/ReloadConfigCommand.java b/src/main/java/me/Danker/commands/ReloadConfigCommand.java index c4ad036..393d383 100644 --- a/src/main/java/me/Danker/commands/ReloadConfigCommand.java +++ b/src/main/java/me/Danker/commands/ReloadConfigCommand.java @@ -1,6 +1,6 @@ package me.Danker.commands; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -29,7 +29,7 @@ public class ReloadConfigCommand extends CommandBase { public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { final EntityPlayer player = (EntityPlayer)arg0; ConfigHandler.reloadConfig(); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Reloaded config.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Reloaded config.")); } } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 939ed6e..dc968e8 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -12,6 +10,8 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.List; + public class ResetLootCommand extends CommandBase { static String resetOption; @@ -48,7 +48,7 @@ public class ResetLootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: /resetloot <zombie/spider/wolf/fishing/mythological/catacombs>")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: /resetloot <zombie/spider/wolf/fishing/mythological/catacombs>")); return; } @@ -56,7 +56,7 @@ public class ResetLootCommand extends CommandBase { switch (arg1[0].toLowerCase()) { case "confirm": confirmReset = false; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Resetting " + resetOption + " tracker...")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Resetting " + resetOption + " tracker...")); switch (resetOption.toLowerCase()) { case "zombie": resetZombie(); @@ -78,11 +78,11 @@ public class ResetLootCommand extends CommandBase { System.err.println("Resetting unknown tracker."); return; } - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Reset complete.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Reset complete.")); break; case "cancel": confirmReset = false; - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Reset cancelled.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Reset cancelled.")); break; default: player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please confirm the reset of the " + resetOption + " tracker by using /resetloot confirm." + @@ -98,16 +98,16 @@ public class ResetLootCommand extends CommandBase { case "catacombs": resetOption = arg1[0]; player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Are you sure you want to reset the " + resetOption + " tracker?" + - " Confirm with " + TheMod.MAIN_COLOUR + "/resetloot confirm" + EnumChatFormatting.YELLOW + "." + - " Cancel by using " + TheMod.MAIN_COLOUR + "/resetloot cancel" + EnumChatFormatting.YELLOW + ".")); + " Confirm with " + DankersSkyblockMod.MAIN_COLOUR + "/resetloot confirm" + EnumChatFormatting.YELLOW + "." + + " Cancel by using " + DankersSkyblockMod.MAIN_COLOUR + "/resetloot cancel" + EnumChatFormatting.YELLOW + ".")); confirmReset = true; break; case "confirm": case "cancel": - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Pick something to reset first.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Pick something to reset first.")); break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index 65239c5..85d0d5c 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -10,6 +8,9 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import sun.security.krb5.Config; + +import java.util.List; public class ScaleCommand extends CommandBase { @@ -20,6 +21,7 @@ public class ScaleCommand extends CommandBase { public static double lividHpScale; public static double cakeTimerScale; public static double skillTrackerScale; + public static double waterAnswerScale; @Override public String getCommandName() { @@ -28,7 +30,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <size (0.1 - 10)>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer> <size (0.1 - 10)>"; } @Override @@ -39,7 +41,7 @@ public class ScaleCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer"); } return null; } @@ -49,13 +51,13 @@ public class ScaleCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length < 2) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } - double scaleAmount = (double) Math.floor(Double.parseDouble(arg1[1]) * 100.0) / 100.0; + double scaleAmount = Math.floor(Double.parseDouble(arg1[1]) * 100.0) / 100.0; if (scaleAmount < 0.1 || scaleAmount > 10.0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Scale multipler can only be between 0.1x and 10x.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Scale multipler can only be between 0.1x and 10x.")); return; } @@ -63,40 +65,45 @@ public class ScaleCommand extends CommandBase { case "coords": coordsScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "coordsScale", coordsScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Coords have been scaled to " + TheMod.SECONDARY_COLOUR + coordsScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Coords have been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + coordsScale + "x")); break; case "display": displayScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "displayScale", displayScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Display has been scaled to " + TheMod.SECONDARY_COLOUR + displayScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + displayScale + "x")); break; case "dungeontimer": dungeonTimerScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "dungeonTimerScale", dungeonTimerScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Dungeon timer has been scaled to " + TheMod.SECONDARY_COLOUR + dungeonTimerScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon timer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonTimerScale + "x")); break; case "skill50": skill50Scale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "skill50Scale", skill50Scale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill 50 display has been scaled to " + TheMod.SECONDARY_COLOUR + skill50Scale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill 50 display has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + skill50Scale + "x")); break; case "lividhp": lividHpScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "lividHpScale", lividHpScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Livid HP has been scaled to " + TheMod.SECONDARY_COLOUR + lividHpScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Livid HP has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + lividHpScale + "x")); break; case "caketimer": cakeTimerScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "cakeTimerScale", cakeTimerScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been scaled to " + TheMod.SECONDARY_COLOUR + cakeTimerScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Cake timer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + cakeTimerScale + "x")); break; case "skilltracker": skillTrackerScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "skillTrackerScale", skillTrackerScale); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker has been scaled to " + TheMod.SECONDARY_COLOUR + skillTrackerScale + "x")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + skillTrackerScale + "x")); + break; + case "wateranswer": + waterAnswerScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "waterAnswerScale", waterAnswerScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water solver answer has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + waterAnswerScale + "x")); break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/SetkeyCommand.java b/src/main/java/me/Danker/commands/SetkeyCommand.java index f2e58e5..db5fb9a 100644 --- a/src/main/java/me/Danker/commands/SetkeyCommand.java +++ b/src/main/java/me/Danker/commands/SetkeyCommand.java @@ -1,6 +1,6 @@ package me.Danker.commands; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -31,12 +31,12 @@ public class SetkeyCommand extends CommandBase implements ICommand { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } ConfigHandler.writeStringConfig("api", "APIKey", arg1[0]); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Set API key to " + TheMod.SECONDARY_COLOUR + arg1[0])); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Set API key to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[0])); } } diff --git a/src/main/java/me/Danker/commands/SkillTrackerCommand.java b/src/main/java/me/Danker/commands/SkillTrackerCommand.java index 6e6d742..7642070 100644 --- a/src/main/java/me/Danker/commands/SkillTrackerCommand.java +++ b/src/main/java/me/Danker/commands/SkillTrackerCommand.java @@ -1,10 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import org.apache.commons.lang3.time.StopWatch; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -12,6 +8,9 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import org.apache.commons.lang3.time.StopWatch; + +import java.util.List; public class SkillTrackerCommand extends CommandBase { @@ -43,51 +42,51 @@ public class SkillTrackerCommand extends CommandBase { EntityPlayer player = (EntityPlayer) arg0; if (arg1.length < 1) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } switch (arg1[0].toLowerCase()) { case "start": case "resume": - if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.resume(); - } else if (!TheMod.skillStopwatch.isStarted()) { - TheMod.skillStopwatch.start(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.resume(); + } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { + DankersSkyblockMod.skillStopwatch.start(); } - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker started.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); break; case "pause": case "stop": - if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.suspend(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.suspend(); } else { - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker paused.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); } break; case "reset": - TheMod.skillStopwatch = new StopWatch(); - TheMod.farmingXPGained = 0; - TheMod.miningXPGained = 0; - TheMod.combatXPGained = 0; - TheMod.foragingXPGained = 0; - TheMod.fishingXPGained = 0; - TheMod.enchantingXPGained = 0; - TheMod.alchemyXPGained = 0; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker reset.")); + DankersSkyblockMod.skillStopwatch = new StopWatch(); + DankersSkyblockMod.farmingXPGained = 0; + DankersSkyblockMod.miningXPGained = 0; + DankersSkyblockMod.combatXPGained = 0; + DankersSkyblockMod.foragingXPGained = 0; + DankersSkyblockMod.fishingXPGained = 0; + DankersSkyblockMod.enchantingXPGained = 0; + DankersSkyblockMod.alchemyXPGained = 0; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker reset.")); break; case "hide": - TheMod.showSkillTracker = false; + DankersSkyblockMod.showSkillTracker = false; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker hidden.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker hidden.")); break; case "show": - TheMod.showSkillTracker = true; + DankersSkyblockMod.showSkillTracker = true; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker shown.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker shown.")); break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 71905fc..2d5cf78 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -1,10 +1,7 @@ package me.Danker.commands; -import java.util.List; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -16,6 +13,8 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.util.List; + public class SkillsCommand extends CommandBase { @Override @@ -50,7 +49,7 @@ public class SkillsCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } // Get UUID for Hypixel API requests @@ -59,10 +58,10 @@ public class SkillsCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking skills of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking skills of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking skills of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking skills of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -75,7 +74,7 @@ public class SkillsCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -113,7 +112,7 @@ public class SkillsCommand extends CommandBase { fishingLevel = (double) Math.round(fishingLevel * 100) / 100; } if (userObject.has("experience_skill_enchanting")) { - enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 50); + enchantingLevel = Utils.xpToSkillLevel(userObject.get("experience_skill_enchanting").getAsDouble(), 60); enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100; } if (userObject.has("experience_skill_alchemy")) { @@ -133,7 +132,7 @@ public class SkillsCommand extends CommandBase { if (!playerObject.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -154,7 +153,7 @@ public class SkillsCommand extends CommandBase { fishingLevel = Math.min(achievementObject.get("skyblock_angler").getAsInt(), 50); } if (achievementObject.has("skyblock_augmentation")) { - enchantingLevel = Math.min(achievementObject.get("skyblock_augmentation").getAsInt(), 50); + enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt(); } if (achievementObject.has("skyblock_concoctor")) { alchemyLevel = Math.min(achievementObject.get("skyblock_concoctor").getAsInt(), 50); @@ -168,19 +167,19 @@ public class SkillsCommand extends CommandBase { skillAvg = (double) Math.round(skillAvg * 100) / 100; double trueAvg = (Math.floor(farmingLevel) + Math.floor(miningLevel) + Math.floor(combatLevel) + Math.floor(foragingLevel) + Math.floor(fishingLevel) + Math.floor(enchantingLevel) + Math.floor(alchemyLevel) + Math.floor(tamingLevel)) / 8; - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Skills:\n" + - TheMod.TYPE_COLOUR + " Farming: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel + "\n" + - TheMod.TYPE_COLOUR + " Mining: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel + "\n" + - TheMod.TYPE_COLOUR + " Combat: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel + "\n" + - TheMod.TYPE_COLOUR + " Foraging: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel + "\n" + - TheMod.TYPE_COLOUR + " Fishing: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel + "\n" + - TheMod.TYPE_COLOUR + " Enchanting: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel + "\n" + - TheMod.TYPE_COLOUR + " Alchemy: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel + "\n" + - TheMod.TYPE_COLOUR + " Taming: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel + "\n" + - EnumChatFormatting.AQUA + " Average Skill Level: " + TheMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + skillAvg + "\n" + - EnumChatFormatting.AQUA + " True Average Skill Level: " + TheMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + trueAvg + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Farming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + farmingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Mining: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + miningLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Combat: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + combatLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Foraging: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + foragingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Fishing: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + fishingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Enchanting: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + enchantingLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Alchemy: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + alchemyLevel + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Taming: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + tamingLevel + "\n" + + EnumChatFormatting.AQUA + " Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + skillAvg + "\n" + + EnumChatFormatting.AQUA + " True Average Skill Level: " + DankersSkyblockMod.SKILL_AVERAGE_COLOUR + EnumChatFormatting.BOLD + trueAvg + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java index aca61ee..9558d7d 100644 --- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -1,13 +1,7 @@ package me.Danker.commands; -import java.text.NumberFormat; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -18,6 +12,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; +import java.util.Collections; +import java.util.List; +import java.util.Locale; + public class SkyblockPlayersCommand extends CommandBase { @Override @@ -49,7 +48,7 @@ public class SkyblockPlayersCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } String playersURL = "https://api.hypixel.net/gameCounts?key=" + key; @@ -57,7 +56,7 @@ public class SkyblockPlayersCommand extends CommandBase { JsonObject playersResponse = APIHandler.getResponse(playersURL); if (!playersResponse.get("success").getAsBoolean()) { String reason = playersResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -126,24 +125,24 @@ public class SkyblockPlayersCommand extends CommandBase { } NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + - TheMod.TYPE_COLOUR + " Hypixel: " + TheMod.VALUE_COLOUR + nf.format(totalPlayers) + "\n" + - TheMod.TYPE_COLOUR + " Skyblock: " + TheMod.VALUE_COLOUR + nf.format(skyblockTotalPlayers) + " / " + Utils.getPercentage(skyblockTotalPlayers, totalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Private Island: " + TheMod.VALUE_COLOUR + nf.format(privateIsland) + " / " + Utils.getPercentage(privateIsland, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Hub: " + TheMod.VALUE_COLOUR + nf.format(hub) + " / " + Utils.getPercentage(hub, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Barn: " + TheMod.VALUE_COLOUR + nf.format(barn) + " / " + Utils.getPercentage(barn, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Mushroom Desert: " + TheMod.VALUE_COLOUR + nf.format(mushroomDesert) + " / " + Utils.getPercentage(mushroomDesert, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Park: " + TheMod.VALUE_COLOUR + nf.format(park) + " / " + Utils.getPercentage(park, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Gold Mine: " + TheMod.VALUE_COLOUR + nf.format(goldMine) + " / " + Utils.getPercentage(goldMine, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Deep Caverns: " + TheMod.VALUE_COLOUR + nf.format(deepCaverns) + " / " + Utils.getPercentage(deepCaverns, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Spider's Den: " + TheMod.VALUE_COLOUR + nf.format(spidersDen) + " / " + Utils.getPercentage(spidersDen, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Blazing Fortress: " + TheMod.VALUE_COLOUR + nf.format(blazingFortress) + " / " + Utils.getPercentage(blazingFortress, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " The End: " + TheMod.VALUE_COLOUR + nf.format(end) + " / " + Utils.getPercentage(end, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Dungeons Hub: " + TheMod.VALUE_COLOUR + nf.format(dungeonsHub) + " / " + Utils.getPercentage(dungeonsHub, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Dungeons: " + TheMod.VALUE_COLOUR + nf.format(dungeons) + " / " + Utils.getPercentage(dungeons, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Dark Auction: " + TheMod.VALUE_COLOUR + nf.format(darkAuction) + " / " + Utils.getPercentage(darkAuction, skyblockTotalPlayers) + "%\n" + - TheMod.TYPE_COLOUR + " Jerry's Workshop: " + TheMod.VALUE_COLOUR + nf.format(jerry) + " / " + Utils.getPercentage(jerry, skyblockTotalPlayers) + "%\n" + - TheMod.DELIMITER_COLOUR + EnumChatFormatting.BOLD + " -------------------")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + DankersSkyblockMod.TYPE_COLOUR + " Hypixel: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(totalPlayers) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Skyblock: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(skyblockTotalPlayers) + " / " + Utils.getPercentage(skyblockTotalPlayers, totalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Private Island: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(privateIsland) + " / " + Utils.getPercentage(privateIsland, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Hub: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(hub) + " / " + Utils.getPercentage(hub, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Barn: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(barn) + " / " + Utils.getPercentage(barn, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Mushroom Desert: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(mushroomDesert) + " / " + Utils.getPercentage(mushroomDesert, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Park: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(park) + " / " + Utils.getPercentage(park, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Gold Mine: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(goldMine) + " / " + Utils.getPercentage(goldMine, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Deep Caverns: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(deepCaverns) + " / " + Utils.getPercentage(deepCaverns, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Spider's Den: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(spidersDen) + " / " + Utils.getPercentage(spidersDen, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Blazing Fortress: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(blazingFortress) + " / " + Utils.getPercentage(blazingFortress, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " The End: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(end) + " / " + Utils.getPercentage(end, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Dungeons Hub: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(dungeonsHub) + " / " + Utils.getPercentage(dungeonsHub, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Dungeons: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(dungeons) + " / " + Utils.getPercentage(dungeons, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Dark Auction: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(darkAuction) + " / " + Utils.getPercentage(darkAuction, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.TYPE_COLOUR + " Jerry's Workshop: " + DankersSkyblockMod.VALUE_COLOUR + nf.format(jerry) + " / " + Utils.getPercentage(jerry, skyblockTotalPlayers) + "%\n" + + DankersSkyblockMod.DELIMITER_COLOUR + EnumChatFormatting.BOLD + " -------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java index 07119bb..6c83934 100644 --- a/src/main/java/me/Danker/commands/SlayerCommand.java +++ b/src/main/java/me/Danker/commands/SlayerCommand.java @@ -1,12 +1,7 @@ package me.Danker.commands; -import java.text.NumberFormat; -import java.util.List; -import java.util.Locale; - import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -18,6 +13,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import java.text.NumberFormat; +import java.util.List; +import java.util.Locale; + public class SlayerCommand extends CommandBase { @Override @@ -52,7 +51,7 @@ public class SlayerCommand extends CommandBase { // Check key String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } // Get UUID for Hypixel API requests @@ -61,10 +60,10 @@ public class SlayerCommand extends CommandBase { if (arg1.length == 0) { username = player.getName(); uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking slayer of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking slayer of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); } else { username = arg1[0]; - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking slayer of " + TheMod.SECONDARY_COLOUR + username)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Checking slayer of " + DankersSkyblockMod.SECONDARY_COLOUR + username)); uuid = APIHandler.getUUID(username); } @@ -77,7 +76,7 @@ public class SlayerCommand extends CommandBase { JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return; } @@ -100,12 +99,12 @@ public class SlayerCommand extends CommandBase { } NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US); - player.addChatMessage(new ChatComponentText(TheMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(zombieXP + spiderXP + wolfXP) + "\n" + - TheMod.TYPE_COLOUR + " Zombie XP: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(zombieXP) + "\n" + - TheMod.TYPE_COLOUR + " Spider XP: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(spiderXP) + "\n" + - TheMod.TYPE_COLOUR + " Wolf XP: " + TheMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(wolfXP) + "\n" + - TheMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); + DankersSkyblockMod.TYPE_COLOUR + " Zombie XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(zombieXP) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Spider XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(spiderXP) + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Wolf XP: " + DankersSkyblockMod.VALUE_COLOUR + EnumChatFormatting.BOLD + nf.format(wolfXP) + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 51503ed..5c473e5 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; -import java.util.List; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; @@ -12,6 +10,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; +import java.util.List; + public class ToggleCommand extends CommandBase implements ICommand { public static boolean gpartyToggled; public static boolean coordsToggled; @@ -31,20 +31,28 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean skill50DisplayToggled; public static boolean outlineTextToggled; public static boolean midasStaffMessages; + public static boolean implosionMessages; public static boolean healMessages; public static boolean cakeTimerToggled; public static boolean lowHealthNotifyToggled; public static boolean lividSolverToggled; + public static boolean stopSalvageStarredToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; public static boolean blazeToggled; public static boolean creeperToggled; public static boolean waterToggled; + public static boolean ticTacToeToggled; // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; public static boolean itemFrameOnSeaLanternsToggled; + // Experiments + public static boolean ultrasequencerToggled; + public static boolean chronomatronToggled; + public static boolean superpairsToggled; + public static boolean swapToPickBlockInExperimentsToggled; @Override public String getCommandName() { @@ -55,9 +63,9 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/" + "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + - "outlinetext/midasstaffmessages/healmessages/caketimer/lowhealthnotify/lividsolver/threemanpuzzle/oruopuzzle/" + - "blazepuzzle/creeperpuzzle/waterpuzzle/startswithterminal/selectallterminal/" + - "itemframeonsealanterns/list>"; + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + + "lividsolver/stopsalvagestarred/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + + "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/pickblockinexperiments/list>"; } @Override @@ -72,9 +80,11 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "threemanpuzzle", - "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "startswithterminal", - "selectallterminal", "itemframeonsealanterns", "list"); + "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", + "lividsolver", "stopsalvagestarred", "threemanpuzzle", "oruopuzzle", "blazepuzzle", + "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "startswithterminal", + "selectallterminal", "itemframeonsealanterns", "ultrasequencer", + "chronomatron", "superpairs", "pickblockinexperiments", "list"); } return null; } @@ -84,7 +94,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); return; } @@ -92,187 +102,229 @@ public class ToggleCommand extends CommandBase implements ICommand { case "gparty": gpartyToggled = !gpartyToggled; ConfigHandler.writeBooleanConfig("toggles", "GParty", gpartyToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Guild party notifications has been set to " + TheMod.SECONDARY_COLOUR + gpartyToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Guild party notifications has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + gpartyToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "coords": coordsToggled = !coordsToggled; ConfigHandler.writeBooleanConfig("toggles", "Coords", coordsToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Coord/Angle display has been set to " + TheMod.SECONDARY_COLOUR + coordsToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Coord/Angle display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + coordsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "golden": goldenToggled = !goldenToggled; ConfigHandler.writeBooleanConfig("toggles", "Golden", goldenToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Golden T6 enchants has been set to " + TheMod.SECONDARY_COLOUR + goldenToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golden T6 enchants has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + goldenToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "slayercount": slayerCountTotal = !slayerCountTotal; ConfigHandler.writeBooleanConfig("toggles", "SlayerCount", slayerCountTotal); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Counting total 20% slayer drops has been set to " + TheMod.SECONDARY_COLOUR + slayerCountTotal + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Counting total 20% slayer drops has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + slayerCountTotal + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "rngesusalerts": rngesusAlerts = !rngesusAlerts; ConfigHandler.writeBooleanConfig("toggles", "RNGesusAlerts", rngesusAlerts); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer RNGesus alerts has been set to " + TheMod.SECONDARY_COLOUR + rngesusAlerts + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Slayer RNGesus alerts has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + rngesusAlerts + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "splitfishing": splitFishing = !splitFishing; ConfigHandler.writeBooleanConfig("toggles", "SplitFishing", splitFishing); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Split fishing display has been set to " + TheMod.SECONDARY_COLOUR + splitFishing + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Split fishing display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + splitFishing + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "chatmaddox": chatMaddoxToggled = !chatMaddoxToggled; ConfigHandler.writeBooleanConfig("toggles", "ChatMaddox", chatMaddoxToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Click screen to open Maddox menu has been set to " + TheMod.SECONDARY_COLOUR + chatMaddoxToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Click screen to open Maddox menu has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + chatMaddoxToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "spiritbearalerts": spiritBearAlerts = !spiritBearAlerts; ConfigHandler.writeBooleanConfig("toggles", "SpiritBearAlerts", spiritBearAlerts); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Spirit Bear alerts have been set to " + TheMod.SECONDARY_COLOUR + spiritBearAlerts + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Spirit Bear alerts have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + spiritBearAlerts + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "aotd": aotdToggled = !aotdToggled; ConfigHandler.writeBooleanConfig("toggles", "AOTD", aotdToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Block AOTD ability been set to " + TheMod.SECONDARY_COLOUR + aotdToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block AOTD ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + aotdToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "lividdagger": lividDaggerToggled = !lividDaggerToggled; ConfigHandler.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Block Livid Dagger ability been set to " + TheMod.SECONDARY_COLOUR + lividDaggerToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block Livid Dagger ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + lividDaggerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "sceptremessages": sceptreMessages = !sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Spirit Sceptre messages have been set to " + TheMod.SECONDARY_COLOUR + sceptreMessages + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Spirit Sceptre messages have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + sceptreMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "midasstaffmessages": + midasStaffMessages = !midasStaffMessages; + ConfigHandler.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Midas Staff messages have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + midasStaffMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "implosionmessages": + implosionMessages = !implosionMessages; + ConfigHandler.writeBooleanConfig("toggles", "ImplosionMessages", implosionMessages); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Implosion messages have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + implosionMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "healmessages": + healMessages = !healMessages; + ConfigHandler.writeBooleanConfig("toggles", "HealMessages", healMessages); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Heal messages have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + healMessages + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "petcolors": case "petcolours": petColoursToggled = !petColoursToggled; ConfigHandler.writeBooleanConfig("toggles", "PetColors", petColoursToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Pet colours have been set to " + TheMod.SECONDARY_COLOUR + petColoursToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Pet colours have been set to " + DankersSkyblockMod.SECONDARY_COLOUR + petColoursToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "dungeontimer": dungeonTimerToggled = !dungeonTimerToggled; ConfigHandler.writeBooleanConfig("toggles", "DungeonTimer", dungeonTimerToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Dungeon timer has been set to " + TheMod.SECONDARY_COLOUR + dungeonTimerToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon timer has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonTimerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "golemalerts": golemAlertToggled = !golemAlertToggled; ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Golem spawn alerts has been set to " + TheMod.SECONDARY_COLOUR + golemAlertToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem spawn alerts has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + golemAlertToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "expertiselore": expertiseLoreToggled = !expertiseLoreToggled; ConfigHandler.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Expertise in lore has been set to " + TheMod.SECONDARY_COLOUR + expertiseLoreToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Expertise in lore has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + expertiseLoreToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "skill50display": skill50DisplayToggled = !skill50DisplayToggled; ConfigHandler.writeBooleanConfig("toggles", "Skill50Display", skill50DisplayToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill 50 display has been set to " + TheMod.SECONDARY_COLOUR + skill50DisplayToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill 50 display has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + skill50DisplayToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "outlinetext": outlineTextToggled = !outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Outline displayed text has been set to " + TheMod.SECONDARY_COLOUR + outlineTextToggled + TheMod.MAIN_COLOUR + ".")); - break; - case "midasstaffmessages": - midasStaffMessages = !midasStaffMessages; - ConfigHandler.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Midas Staff messages have been set to " + TheMod.SECONDARY_COLOUR + midasStaffMessages + TheMod.MAIN_COLOUR + ".")); - break; - case "healmessages": - healMessages = !healMessages; - ConfigHandler.writeBooleanConfig("toggles", "HealMessages", healMessages); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Heal messages have been set to " + TheMod.SECONDARY_COLOUR + healMessages + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Outline displayed text has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + outlineTextToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "caketimer": cakeTimerToggled = !cakeTimerToggled; ConfigHandler.writeBooleanConfig("toggles", "CakeTimer", cakeTimerToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been set to " + TheMod.SECONDARY_COLOUR + cakeTimerToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Cake timer has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + cakeTimerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "lowhealthnotify": lowHealthNotifyToggled = !lowHealthNotifyToggled; ConfigHandler.writeBooleanConfig("toggles", "LowHealthNotify", lowHealthNotifyToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Low health notify has been set to " + TheMod.SECONDARY_COLOUR + lowHealthNotifyToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Low health notify has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + lowHealthNotifyToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "lividsolver": lividSolverToggled = !lividSolverToggled; ConfigHandler.writeBooleanConfig("toggles", "LividSolver", lividSolverToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Livid solver has been set to " + TheMod.SECONDARY_COLOUR + lividSolverToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Livid solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + lividSolverToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "stopsalvagestarred": + stopSalvageStarredToggled = !stopSalvageStarredToggled; + ConfigHandler.writeBooleanConfig("toggles", "StopSalvageStarred", stopSalvageStarredToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Stop salvaging starred items has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + stopSalvageStarredToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "threemanpuzzle": threeManToggled = !threeManToggled; ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Three man puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + threeManToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Three man puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + threeManToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "oruopuzzle": oruoToggled = !oruoToggled; ConfigHandler.writeBooleanConfig("toggles", "OruoPuzzle", oruoToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Oruo trivia solver has been set to " + TheMod.SECONDARY_COLOUR + oruoToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Oruo trivia solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + oruoToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "blazepuzzle": blazeToggled = !blazeToggled; ConfigHandler.writeBooleanConfig("toggles", "BlazePuzzle", blazeToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Blaze puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + blazeToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Blaze puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + blazeToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "creeperpuzzle": creeperToggled = !creeperToggled; ConfigHandler.writeBooleanConfig("toggles", "CreeperPuzzle", creeperToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Creeper puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + creeperToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Creeper puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + creeperToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "waterpuzzle": waterToggled = !waterToggled; ConfigHandler.writeBooleanConfig("toggles", "WaterPuzzle", waterToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Water puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + waterToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + waterToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "tictactoepuzzle": + ticTacToeToggled = !ticTacToeToggled; + ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ticTacToeToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Tic tac toe puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ticTacToeToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "startswithterminal": startsWithToggled = !startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", startsWithToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Starts with letter terminal solver has been set to " + TheMod.SECONDARY_COLOUR + startsWithToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Starts with letter terminal solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + startsWithToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "selectallterminal": selectAllToggled = !selectAllToggled; ConfigHandler.writeBooleanConfig("toggles", "SelectAllTerminal", selectAllToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Select all color items terminal solver has been set to " + TheMod.SECONDARY_COLOUR + selectAllToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Select all color items terminal solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + selectAllToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "itemframeonsealanterns": itemFrameOnSeaLanternsToggled = !itemFrameOnSeaLanternsToggled; ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", itemFrameOnSeaLanternsToggled); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Ignore item frames on sea lanterns has been set to " + TheMod.SECONDARY_COLOUR + itemFrameOnSeaLanternsToggled + TheMod.MAIN_COLOUR + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ignore item frames on sea lanterns has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + itemFrameOnSeaLanternsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "ultrasequencer": + ultrasequencerToggled = !ultrasequencerToggled; + ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ultrasequencerToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ultrasequencer solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ultrasequencerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "chronomatron": + chronomatronToggled = !chronomatronToggled; + ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", chronomatronToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Chronomatron solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + chronomatronToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "superpairs": + superpairsToggled = !superpairsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Superpairs", superpairsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Superpairs solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + superpairsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; + case "pickblockinexperiments": + swapToPickBlockInExperimentsToggled = !swapToPickBlockInExperimentsToggled; + ConfigHandler.writeBooleanConfig("toggles", "PickBlockInExperiments", superpairsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto-swap to pick block in experiments has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + swapToPickBlockInExperimentsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "list": - player.addChatMessage(new ChatComponentText(TheMod.TYPE_COLOUR + "Guild party notifications: " + TheMod.VALUE_COLOUR + gpartyToggled + "\n" + - TheMod.TYPE_COLOUR + " Coord/Angle display: " + TheMod.VALUE_COLOUR + coordsToggled + "\n" + - TheMod.TYPE_COLOUR + " Golden T6 enchants: " + TheMod.VALUE_COLOUR + goldenToggled + "\n" + - TheMod.TYPE_COLOUR + " Counting total 20% slayer drops: " + TheMod.VALUE_COLOUR + slayerCountTotal + "\n" + - TheMod.TYPE_COLOUR + " Slayer RNGesus alerts: " + TheMod.VALUE_COLOUR + rngesusAlerts + "\n" + - TheMod.TYPE_COLOUR + " Split fishing display: " + TheMod.VALUE_COLOUR + splitFishing + "\n" + - TheMod.TYPE_COLOUR + " Chat Maddox menu: " + TheMod.VALUE_COLOUR + chatMaddoxToggled + "\n" + - TheMod.TYPE_COLOUR + " Spirit Bear alerts: " + TheMod.VALUE_COLOUR + spiritBearAlerts + "\n" + - TheMod.TYPE_COLOUR + " Block AOTD ability: " + TheMod.VALUE_COLOUR + aotdToggled + "\n" + - TheMod.TYPE_COLOUR + " Block Livid Dagger ability: " + TheMod.VALUE_COLOUR + lividDaggerToggled + "\n" + - TheMod.TYPE_COLOUR + " Spirit Sceptre messages: " + TheMod.VALUE_COLOUR + sceptreMessages + "\n" + - TheMod.TYPE_COLOUR + " Pet colours: " + TheMod.VALUE_COLOUR + petColoursToggled + "\n" + - TheMod.TYPE_COLOUR + " Dungeon timer: " + TheMod.VALUE_COLOUR + dungeonTimerToggled + "\n" + - TheMod.TYPE_COLOUR + " Golem spawn alerts: " + TheMod.VALUE_COLOUR + golemAlertToggled + "\n" + - TheMod.TYPE_COLOUR + " Expertise in lore: " + TheMod.VALUE_COLOUR + expertiseLoreToggled + "\n" + - TheMod.TYPE_COLOUR + " Skill 50 display: " + TheMod.VALUE_COLOUR + skill50DisplayToggled + "\n" + - TheMod.TYPE_COLOUR + " Outline displayed text: " + TheMod.VALUE_COLOUR + outlineTextToggled + "\n" + - TheMod.TYPE_COLOUR + " Midas Staff messages: " + TheMod.VALUE_COLOUR + midasStaffMessages + "\n" + - TheMod.TYPE_COLOUR + " Heal messages: " + TheMod.VALUE_COLOUR + healMessages + "\n" + - TheMod.TYPE_COLOUR + " Cake timer: " + TheMod.VALUE_COLOUR + cakeTimerToggled + "\n" + - TheMod.TYPE_COLOUR + " Low health notify: " + TheMod.VALUE_COLOUR + lowHealthNotifyToggled + "\n" + - TheMod.TYPE_COLOUR + " Livid solver: " + TheMod.VALUE_COLOUR + lividSolverToggled + "\n" + - TheMod.TYPE_COLOUR + " Three man puzzle solver: " + TheMod.VALUE_COLOUR + threeManToggled + "\n" + - TheMod.TYPE_COLOUR + " Oruo trivia solver: " + TheMod.VALUE_COLOUR + oruoToggled + "\n" + - TheMod.TYPE_COLOUR + " Blaze puzzle solver: " + TheMod.VALUE_COLOUR + blazeToggled + "\n" + - TheMod.TYPE_COLOUR + " Creeper puzzle solver: " + TheMod.VALUE_COLOUR + creeperToggled + "\n" + - TheMod.TYPE_COLOUR + " Water puzzle solver: " + TheMod.VALUE_COLOUR + waterToggled + "\n" + - TheMod.TYPE_COLOUR + " Starts with letter terminal solver: " + TheMod.VALUE_COLOUR + startsWithToggled + "\n" + - TheMod.TYPE_COLOUR + " Select all color items terminal solver: " + TheMod.VALUE_COLOUR + selectAllToggled + "\n" + - TheMod.TYPE_COLOUR + " Ignore item frames on sea lanterns: " + TheMod.VALUE_COLOUR + itemFrameOnSeaLanternsToggled)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Golden T6 enchants: " + DankersSkyblockMod.VALUE_COLOUR + goldenToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Counting total 20% slayer drops: " + DankersSkyblockMod.VALUE_COLOUR + slayerCountTotal + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Slayer RNGesus alerts: " + DankersSkyblockMod.VALUE_COLOUR + rngesusAlerts + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Split fishing display: " + DankersSkyblockMod.VALUE_COLOUR + splitFishing + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Chat Maddox menu: " + DankersSkyblockMod.VALUE_COLOUR + chatMaddoxToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Spirit Bear alerts: " + DankersSkyblockMod.VALUE_COLOUR + spiritBearAlerts + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Block AOTD ability: " + DankersSkyblockMod.VALUE_COLOUR + aotdToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Block Livid Dagger ability: " + DankersSkyblockMod.VALUE_COLOUR + lividDaggerToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Spirit Sceptre messages: " + DankersSkyblockMod.VALUE_COLOUR + sceptreMessages + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Midas Staff messages: " + DankersSkyblockMod.VALUE_COLOUR + midasStaffMessages + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Implosion messages: " + DankersSkyblockMod.VALUE_COLOUR + implosionMessages + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Heal messages: " + DankersSkyblockMod.VALUE_COLOUR + healMessages + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Pet colours: " + DankersSkyblockMod.VALUE_COLOUR + petColoursToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Dungeon timer: " + DankersSkyblockMod.VALUE_COLOUR + dungeonTimerToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Golem spawn alerts: " + DankersSkyblockMod.VALUE_COLOUR + golemAlertToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Expertise in lore: " + DankersSkyblockMod.VALUE_COLOUR + expertiseLoreToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Skill 50 display: " + DankersSkyblockMod.VALUE_COLOUR + skill50DisplayToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Outline displayed text: " + DankersSkyblockMod.VALUE_COLOUR + outlineTextToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Cake timer: " + DankersSkyblockMod.VALUE_COLOUR + cakeTimerToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Low health notify: " + DankersSkyblockMod.VALUE_COLOUR + lowHealthNotifyToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Livid solver: " + DankersSkyblockMod.VALUE_COLOUR + lividSolverToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Three man puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + threeManToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Oruo trivia solver: " + DankersSkyblockMod.VALUE_COLOUR + oruoToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Blaze puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + blazeToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Creeper puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + creeperToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Water puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + waterToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Tic tac toe puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + ticTacToeToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Starts with letter terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + startsWithToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Ignore item frames on sea lanterns: " + DankersSkyblockMod.VALUE_COLOUR + itemFrameOnSeaLanternsToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Ultra sequencer solver: " + DankersSkyblockMod.VALUE_COLOUR + ultrasequencerToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Superpairs solver: " + DankersSkyblockMod.VALUE_COLOUR + superpairsToggled + )); + break; default: - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } } } diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 168f7c7..1c40dc4 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -1,11 +1,6 @@ package me.Danker.gui; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -15,6 +10,11 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + public class DankerGui extends GuiScreen { private int page; @@ -27,6 +27,7 @@ public class DankerGui extends GuiScreen { private GuiButton changeDisplay; private GuiButton onlySlayer; private GuiButton puzzleSolvers; + private GuiButton experimentationTableSolvers; private GuiButton skillTracker; // Toggles private GuiButton gparty; @@ -40,17 +41,19 @@ public class DankerGui extends GuiScreen { private GuiButton aotd; private GuiButton lividDagger; private GuiButton sceptreMessages; + private GuiButton midasStaffMessages; + private GuiButton implosionMessages; + private GuiButton healMessages; private GuiButton petColours; private GuiButton dungeonTimer; private GuiButton golemAlerts; private GuiButton expertiseLore; private GuiButton skill50Display; private GuiButton outlineText; - private GuiButton midasStaffMessages; - private GuiButton healMessages; private GuiButton cakeTimer; private GuiButton lowHealthNotify; private GuiButton lividSolver; + private GuiButton stopSalvageStarred; public DankerGui(int page) { this.page = page; @@ -80,72 +83,83 @@ public class DankerGui extends GuiScreen { changeDisplay = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Change Display Settings"); onlySlayer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Set Slayer Quest"); puzzleSolvers = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Toggle Dungeons Puzzle Solvers"); - skillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Toggle Skill XP/Hour Tracking"); - outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); - splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); - coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); + experimentationTableSolvers = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Toggle Experimentation Table Solvers"); + skillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Toggle Skill XP/Hour Tracking"); + outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); + splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); // Page 2 - dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); - cakeTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); - skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); - slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); - chatMaddox = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); + coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + cakeTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); // Page 3 - gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); - spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); - sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); - midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); - healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + chatMaddox = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); + implosionMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages)); + healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); // Page 4 - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); - lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); - + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); + lowHealthNotify = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled)); + // Page 5 + stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); + switch (page) { case 1: this.buttonList.add(changeDisplay); this.buttonList.add(onlySlayer); this.buttonList.add(puzzleSolvers); + this.buttonList.add(experimentationTableSolvers); this.buttonList.add(skillTracker); this.buttonList.add(outlineText); this.buttonList.add(splitFishing); - this.buttonList.add(coords); this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(coords); this.buttonList.add(dungeonTimer); this.buttonList.add(cakeTimer); this.buttonList.add(skill50Display); this.buttonList.add(slayerCount); - this.buttonList.add(chatMaddox); this.buttonList.add(aotd); this.buttonList.add(lividDagger); this.buttonList.add(nextPage); this.buttonList.add(backPage); break; case 3: + this.buttonList.add(chatMaddox); this.buttonList.add(gparty); this.buttonList.add(spiritBearAlert); this.buttonList.add(sceptreMessages); this.buttonList.add(midasStaffMessages); + this.buttonList.add(implosionMessages); this.buttonList.add(healMessages); - this.buttonList.add(goldenEnch); - this.buttonList.add(petColours); this.buttonList.add(nextPage); this.buttonList.add(backPage); break; case 4: + this.buttonList.add(goldenEnch); + this.buttonList.add(petColours); this.buttonList.add(expertiseLore); this.buttonList.add(lividSolver); this.buttonList.add(golemAlerts); this.buttonList.add(rngesusAlert); this.buttonList.add(lowHealthNotify); + this.buttonList.add(nextPage); + this.buttonList.add(backPage); + break; + case 5: + this.buttonList.add(stopSalvageStarred); this.buttonList.add(backPage); break; } @@ -158,7 +172,7 @@ public class DankerGui extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); - String pageText = "Page: " + page + "/4"; + String pageText = "Page: " + page + "/5"; int pageWidth = mc.fontRendererObj.getStringWidth(pageText); new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D); super.drawScreen(mouseX, mouseY, partialTicks); @@ -169,29 +183,31 @@ public class DankerGui extends GuiScreen { if (button == closeGUI) { Minecraft.getMinecraft().thePlayer.closeScreen(); } else if (button == nextPage) { - TheMod.guiToOpen = "dankergui" + (page + 1); + DankersSkyblockMod.guiToOpen = "dankergui" + (page + 1); } else if (button == backPage) { - TheMod.guiToOpen = "dankergui" + (page - 1); + DankersSkyblockMod.guiToOpen = "dankergui" + (page - 1); } else if (button == githubLink) { try { Desktop.getDesktop().browse(new URI("https://github.com/bowser0000/SkyblockMod")); } catch (IOException | URISyntaxException ex) { - System.err.println(ex); + ex.printStackTrace(); } } else if (button == discordLink) { try { Desktop.getDesktop().browse(new URI("https://discord.gg/QsEkNQS")); } catch (IOException | URISyntaxException ex) { - System.err.println(ex); + ex.printStackTrace(); } } else if (button == changeDisplay) { - TheMod.guiToOpen = "displaygui"; + DankersSkyblockMod.guiToOpen = "displaygui"; } else if (button == onlySlayer) { - TheMod.guiToOpen = "onlyslayergui"; - } else if (button == puzzleSolvers) { - TheMod.guiToOpen = "puzzlesolvers"; - } else if (button == skillTracker) { - TheMod.guiToOpen = "skilltracker"; + DankersSkyblockMod.guiToOpen = "onlyslayergui"; + } else if (button == puzzleSolvers) { + DankersSkyblockMod.guiToOpen = "puzzlesolvers"; + } else if (button == experimentationTableSolvers) { + DankersSkyblockMod.guiToOpen = "experimentsolvers"; + } else if (button == skillTracker) { + DankersSkyblockMod.guiToOpen = "skilltracker"; } else if (button == outlineText) { ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); @@ -280,6 +296,14 @@ public class DankerGui extends GuiScreen { ToggleCommand.lowHealthNotifyToggled = !ToggleCommand.lowHealthNotifyToggled; ConfigHandler.writeBooleanConfig("toggles", "LowHealthNotify", ToggleCommand.lowHealthNotifyToggled); lowHealthNotify.displayString = "Low Health Notifications: " + Utils.getColouredBoolean(ToggleCommand.lowHealthNotifyToggled); + } else if (button == implosionMessages) { + ToggleCommand.implosionMessages = !ToggleCommand.implosionMessages; + ConfigHandler.writeBooleanConfig("toggles", "ImplosionMessages", ToggleCommand.implosionMessages); + implosionMessages.displayString = "Implosion Messages: " + Utils.getColouredBoolean(ToggleCommand.implosionMessages); + } else if(button == stopSalvageStarred) { + ToggleCommand.stopSalvageStarredToggled = !ToggleCommand.stopSalvageStarredToggled; + ConfigHandler.writeBooleanConfig("toggles", "StopSalvageStarred", ToggleCommand.stopSalvageStarredToggled); + stopSalvageStarred.displayString = "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled); } } diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index 0a5f805..f498a67 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.DisplayCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -115,9 +115,9 @@ public class DisplayGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == editLocations) { - TheMod.guiToOpen = "editlocations"; + DankersSkyblockMod.guiToOpen = "editlocations"; } else if (button == showSession) { addSession = !addSession; showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 75caf6a..8519f1a 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -1,8 +1,6 @@ package me.Danker.gui; -import org.lwjgl.opengl.GL11; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.gui.buttons.LocationButton; @@ -12,6 +10,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.opengl.GL11; public class EditLocationsGui extends GuiScreen { @@ -26,6 +25,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton lividHP; private LocationButton cakeTimer; private LocationButton skillTracker; + private LocationButton waterAnswer; @Override public boolean doesGuiPauseGame() { @@ -72,23 +72,32 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.YELLOW + 2 + "\n" + EnumChatFormatting.YELLOW + 1; - String skillTrackerText = TheMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + - TheMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + - TheMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; - + String skillTrackerText = DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + + DankersSkyblockMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; + + String waterAnswerText = DankersSkyblockMod.MAIN_COLOUR + "The following levers must be down:\n" + + EnumChatFormatting.DARK_PURPLE + "Purple: " + EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay\n" + + EnumChatFormatting.GOLD + "Orange: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal\n" + + EnumChatFormatting.BLUE + "Blue: " + EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay\n" + + EnumChatFormatting.GREEN + "Green: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald\n" + + EnumChatFormatting.RED + "Red: " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; + display = new LocationButton(0, MoveCommand.displayXY[0], MoveCommand.displayXY[1], 145 * ScaleCommand.displayScale, 102 * ScaleCommand.displayScale, ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(0, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], 113 * ScaleCommand.dungeonTimerScale, 57 * ScaleCommand.dungeonTimerScale, ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); - coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, TheMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); - skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, TheMod.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, DankersSkyblockMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, DankersSkyblockMod.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); lividHP = new LocationButton(0, MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], 85 * ScaleCommand.lividHpScale, 12 * ScaleCommand.lividHpScale, ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); - cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, TheMod.CAKE_COLOUR + " 11h16m", null, null); + cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, DankersSkyblockMod.CAKE_COLOUR + " 11h16m", null, null); skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); - + waterAnswer = new LocationButton(0, MoveCommand.waterAnswerXY[0], MoveCommand.waterAnswerXY[1], 190 * ScaleCommand.waterAnswerScale, 54 * ScaleCommand.waterAnswerScale, ScaleCommand.waterAnswerScale, waterAnswerText, null, null); + this.buttonList.add(coords); this.buttonList.add(dungeonTimer); this.buttonList.add(lividHP); this.buttonList.add(cakeTimer); this.buttonList.add(skillTracker); + this.buttonList.add(waterAnswer); this.buttonList.add(display); this.buttonList.add(skill50); } @@ -99,9 +108,9 @@ public class EditLocationsGui extends GuiScreen { mouseMoved(mouseX, mouseY); double scale = ScaleCommand.cakeTimerScale; - double scaleReset = (double) Math.pow(scale, -1); + double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); - mc.getTextureManager().bindTexture(TheMod.CAKE_ICON); + mc.getTextureManager().bindTexture(DankersSkyblockMod.CAKE_ICON); Gui.drawModalRectWithCustomSizedTexture(MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1], 0, 0, 16, 16, 16, 16); GL11.glScaled(scaleReset, scaleReset, scaleReset); @@ -113,41 +122,55 @@ public class EditLocationsGui extends GuiScreen { int yMoved = mouseY - lastMouseY; if (moving != null) { - if (moving.equals("display")) { - MoveCommand.displayXY[0] += xMoved; - MoveCommand.displayXY[1] += yMoved; - display.xPosition = MoveCommand.displayXY[0]; - display.yPosition = MoveCommand.displayXY[1]; - } else if (moving.equals("dungeonTimer")) { - MoveCommand.dungeonTimerXY[0] += xMoved; - MoveCommand.dungeonTimerXY[1] += yMoved; - dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; - dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; - } else if (moving.equals("coords")) { - MoveCommand.coordsXY[0] += xMoved; - MoveCommand.coordsXY[1] += yMoved; - coords.xPosition = MoveCommand.coordsXY[0]; - coords.yPosition = MoveCommand.coordsXY[1]; - } else if (moving.equals("skill50")) { - MoveCommand.skill50XY[0] += xMoved; - MoveCommand.skill50XY[1] += yMoved; - skill50.xPosition = MoveCommand.skill50XY[0]; - skill50.yPosition = MoveCommand.skill50XY[1]; - } else if (moving.equals("lividHP")) { - MoveCommand.lividHpXY[0] += xMoved; - MoveCommand.lividHpXY[1] += yMoved; - lividHP.xPosition = MoveCommand.lividHpXY[0]; - lividHP.yPosition = MoveCommand.lividHpXY[1]; - } else if (moving.equals("cakeTimer")) { - MoveCommand.cakeTimerXY[0] += xMoved; - MoveCommand.cakeTimerXY[1] += yMoved; - cakeTimer.xPosition = MoveCommand.cakeTimerXY[0]; - cakeTimer.yPosition = MoveCommand.cakeTimerXY[1]; - } else if (moving.equals("skillTracker")) { - MoveCommand.skillTrackerXY[0] += xMoved; - MoveCommand.skillTrackerXY[1] += yMoved; - skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; - skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; + switch (moving) { + case "display": + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + display.xPosition = MoveCommand.displayXY[0]; + display.yPosition = MoveCommand.displayXY[1]; + break; + case "dungeonTimer": + MoveCommand.dungeonTimerXY[0] += xMoved; + MoveCommand.dungeonTimerXY[1] += yMoved; + dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; + dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; + break; + case "coords": + MoveCommand.coordsXY[0] += xMoved; + MoveCommand.coordsXY[1] += yMoved; + coords.xPosition = MoveCommand.coordsXY[0]; + coords.yPosition = MoveCommand.coordsXY[1]; + break; + case "skill50": + MoveCommand.skill50XY[0] += xMoved; + MoveCommand.skill50XY[1] += yMoved; + skill50.xPosition = MoveCommand.skill50XY[0]; + skill50.yPosition = MoveCommand.skill50XY[1]; + break; + case "lividHP": + MoveCommand.lividHpXY[0] += xMoved; + MoveCommand.lividHpXY[1] += yMoved; + lividHP.xPosition = MoveCommand.lividHpXY[0]; + lividHP.yPosition = MoveCommand.lividHpXY[1]; + break; + case "cakeTimer": + MoveCommand.cakeTimerXY[0] += xMoved; + MoveCommand.cakeTimerXY[1] += yMoved; + cakeTimer.xPosition = MoveCommand.cakeTimerXY[0]; + cakeTimer.yPosition = MoveCommand.cakeTimerXY[1]; + break; + case "skillTracker": + MoveCommand.skillTrackerXY[0] += xMoved; + MoveCommand.skillTrackerXY[1] += yMoved; + skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; + skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; + break; + case "waterAnswer": + MoveCommand.waterAnswerXY[0] += xMoved; + MoveCommand.waterAnswerXY[1] += yMoved; + waterAnswer.xPosition = MoveCommand.waterAnswerXY[0]; + waterAnswer.yPosition = MoveCommand.waterAnswerXY[1]; + break; } this.buttonList.clear(); initGui(); @@ -174,6 +197,8 @@ public class EditLocationsGui extends GuiScreen { moving = "cakeTimer"; } else if (button == skillTracker) { moving = "skillTracker"; + } else if (button == waterAnswer) { + moving = "waterAnswer"; } } } @@ -196,6 +221,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "cakeTimerY", MoveCommand.cakeTimerXY[1]); ConfigHandler.writeIntConfig("locations", "skillTrackerX", MoveCommand.skillTrackerXY[0]); ConfigHandler.writeIntConfig("locations", "skillTrackerY", MoveCommand.skillTrackerXY[1]); + ConfigHandler.writeIntConfig("locations", "waterAnswerX", MoveCommand.waterAnswerXY[1]); + ConfigHandler.writeIntConfig("locations", "waterAnswerY", MoveCommand.waterAnswerXY[1]); } } diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java new file mode 100644 index 0000000..b27ff16 --- /dev/null +++ b/src/main/java/me/Danker/gui/ExperimentsGui.java @@ -0,0 +1,76 @@ +package me.Danker.gui; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class ExperimentsGui extends GuiScreen { + + private GuiButton goBack; + private GuiButton ultrasequencer; + private GuiButton chronomatron; + private GuiButton superpairs; + private GuiButton pickBlock; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + ultrasequencer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled)); + chronomatron = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled)); + superpairs = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled)); + pickBlock = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockInExperimentsToggled)); + + + this.buttonList.add(goBack); + this.buttonList.add(ultrasequencer); + this.buttonList.add(chronomatron); + this.buttonList.add(superpairs); + this.buttonList.add(pickBlock); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + DankersSkyblockMod.guiToOpen = "dankergui1"; + } else if (button == ultrasequencer) { + ToggleCommand.ultrasequencerToggled = !ToggleCommand.ultrasequencerToggled; + ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ToggleCommand.ultrasequencerToggled); + ultrasequencer.displayString = "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled); + } else if (button == chronomatron) { + ToggleCommand.chronomatronToggled = !ToggleCommand.chronomatronToggled; + ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", ToggleCommand.chronomatronToggled); + chronomatron.displayString = "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled); + } else if (button == superpairs) { + ToggleCommand.superpairsToggled = !ToggleCommand.superpairsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Superpairs", ToggleCommand.superpairsToggled); + superpairs.displayString = "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled); + } else if (button == pickBlock) { + ToggleCommand.swapToPickBlockInExperimentsToggled = !ToggleCommand.swapToPickBlockInExperimentsToggled; + ConfigHandler.writeBooleanConfig("toggles", "PickBlockInExperiments", ToggleCommand.swapToPickBlockInExperimentsToggled); + pickBlock.displayString = "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockInExperimentsToggled); + } + } + +} diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java index c96bfd6..89c701d 100644 --- a/src/main/java/me/Danker/gui/OnlySlayerGui.java +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.BlockSlayerCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; @@ -38,14 +38,19 @@ public class OnlySlayerGui extends GuiScreen { int width = sr.getScaledWidth(); onlyName = BlockSlayerCommand.onlySlayerName; - if (BlockSlayerCommand.onlySlayerNumber.equals("I")) { - onlyNumberInt = 1; - } else if (BlockSlayerCommand.onlySlayerNumber.equals("II")) { - onlyNumberInt = 2; - } else if (BlockSlayerCommand.onlySlayerNumber.equals("III")) { - onlyNumberInt = 3; - } else { - onlyNumberInt = 4; + switch (BlockSlayerCommand.onlySlayerNumber) { + case "I": + onlyNumberInt = 1; + break; + case "II": + onlyNumberInt = 2; + break; + case "III": + onlyNumberInt = 3; + break; + default: + onlyNumberInt = 4; + break; } goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); @@ -89,7 +94,7 @@ public class OnlySlayerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == off) { BlockSlayerCommand.onlySlayerName = ""; BlockSlayerCommand.onlySlayerNumber = ""; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index b052b02..8701563 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -1,6 +1,6 @@ package me.Danker.gui; -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.handlers.ConfigHandler; import me.Danker.utils.Utils; @@ -21,6 +21,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton blaze; private GuiButton creeper; private GuiButton water; + private GuiButton ticTacToe; private GuiButton startsWith; private GuiButton selectAll; private GuiButton itemFrameOnSeaLanterns; @@ -52,10 +53,11 @@ public class PuzzleSolversGui extends GuiScreen { blaze = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Blaze Solver: " + Utils.getColouredBoolean(ToggleCommand.blazeToggled)); creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled)); - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); // Page 2 - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -64,11 +66,12 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(blaze); this.buttonList.add(creeper); this.buttonList.add(water); + this.buttonList.add(ticTacToe); this.buttonList.add(startsWith); - this.buttonList.add(selectAll); this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(selectAll); this.buttonList.add(itemFrameOnSeaLanterns); this.buttonList.add(backPage); break; @@ -85,7 +88,7 @@ public class PuzzleSolversGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == backPage) { Minecraft.getMinecraft().displayGuiScreen(new PuzzleSolversGui(page - 1)); } else if (button == nextPage) { @@ -110,13 +113,17 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.waterToggled = !ToggleCommand.waterToggled; ConfigHandler.writeBooleanConfig("toggles", "WaterPuzzle", ToggleCommand.waterToggled); water.displayString = "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled); + } else if (button == ticTacToe) { + ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled; + ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled); + ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled); } else if (button == startsWith) { ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; - ConfigHandler.writeBooleanConfig("toggle", "StartsWithTerminal", ToggleCommand.startsWithToggled); + ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled); startsWith.displayString = "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled); } else if (button == selectAll) { ToggleCommand.selectAllToggled = !ToggleCommand.selectAllToggled; - ConfigHandler.writeBooleanConfig("toggle", "SelectAllTerminal", ToggleCommand.selectAllToggled); + ConfigHandler.writeBooleanConfig("toggles", "SelectAllTerminal", ToggleCommand.selectAllToggled); selectAll.displayString = "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled); } else if (button == itemFrameOnSeaLanterns) { ToggleCommand.itemFrameOnSeaLanternsToggled = !ToggleCommand.itemFrameOnSeaLanternsToggled; diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java index 9672890..4b38f2e 100644 --- a/src/main/java/me/Danker/gui/SkillTrackerGui.java +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -1,14 +1,13 @@ package me.Danker.gui; -import org.apache.commons.lang3.time.StopWatch; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; +import org.apache.commons.lang3.time.StopWatch; public class SkillTrackerGui extends GuiScreen { @@ -51,12 +50,12 @@ public class SkillTrackerGui extends GuiScreen { public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); String stateText = ""; - if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { stateText = "Timer: Running"; - } else if (!TheMod.skillStopwatch.isStarted() || TheMod.skillStopwatch.isSuspended()) { + } else if (!DankersSkyblockMod.skillStopwatch.isStarted() || DankersSkyblockMod.skillStopwatch.isSuspended()) { stateText = "Timer: Paused"; } - if (!TheMod.showSkillTracker) { + if (!DankersSkyblockMod.showSkillTracker) { stateText += " (Hidden)"; } int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText); @@ -67,31 +66,31 @@ public class SkillTrackerGui extends GuiScreen { @Override public void actionPerformed(GuiButton button) { if (button == goBack) { - TheMod.guiToOpen = "dankergui1"; + DankersSkyblockMod.guiToOpen = "dankergui1"; } else if (button == start) { - if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.resume(); - } else if (!TheMod.skillStopwatch.isStarted()) { - TheMod.skillStopwatch.start(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.resume(); + } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { + DankersSkyblockMod.skillStopwatch.start(); } } else if (button == stop) { - if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { - TheMod.skillStopwatch.suspend(); + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.suspend(); } } else if (button == reset) { - TheMod.skillStopwatch = new StopWatch(); - TheMod.farmingXPGained = 0; - TheMod.miningXPGained = 0; - TheMod.combatXPGained = 0; - TheMod.foragingXPGained = 0; - TheMod.fishingXPGained = 0; - TheMod.enchantingXPGained = 0; - TheMod.alchemyXPGained = 0; + DankersSkyblockMod.skillStopwatch = new StopWatch(); + DankersSkyblockMod.farmingXPGained = 0; + DankersSkyblockMod.miningXPGained = 0; + DankersSkyblockMod.combatXPGained = 0; + DankersSkyblockMod.foragingXPGained = 0; + DankersSkyblockMod.fishingXPGained = 0; + DankersSkyblockMod.enchantingXPGained = 0; + DankersSkyblockMod.alchemyXPGained = 0; } else if (button == hide) { - TheMod.showSkillTracker = false; + DankersSkyblockMod.showSkillTracker = false; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); } else if (button == show) { - TheMod.showSkillTracker = true; + DankersSkyblockMod.showSkillTracker = true; ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); } } diff --git a/src/main/java/me/Danker/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java index 061f198..a8937fd 100644 --- a/src/main/java/me/Danker/gui/buttons/LocationButton.java +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -34,12 +34,11 @@ public class LocationButton extends GuiButton { } else { splitText = text2.split("\n"); } - int index = 0; + int longestText = -1; - for (int i = 0; i < splitText.length; i++) { - int stringLength = mc.fontRendererObj.getStringWidth(splitText[i]); + for (String s : splitText) { + int stringLength = mc.fontRendererObj.getStringWidth(s); if (stringLength > longestText) { - index = i; longestText = stringLength; } } diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index c96aa50..c9460fe 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -1,24 +1,22 @@ package me.Danker.handlers; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Scanner; - import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Scanner; + public class APIHandler { public static JsonObject getResponse(String urlString) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -31,7 +29,7 @@ public class APIHandler { if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String input; - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); while ((input = in.readLine()) != null) { response.append(input); @@ -39,9 +37,8 @@ public class APIHandler { in.close(); Gson gson = new Gson(); - JsonObject object = gson.fromJson(response.toString(), JsonObject.class); - - return object; + + return gson.fromJson(response.toString(), JsonObject.class); } else { if (urlString.startsWith("https://api.hypixel.net/")) { InputStream errorStream = conn.getErrorStream(); @@ -50,23 +47,19 @@ public class APIHandler { String error = scanner.next(); Gson gson = new Gson(); - JsonObject object = gson.fromJson(error, JsonObject.class); - return object; + return gson.fromJson(error, JsonObject.class); } } else if (urlString.startsWith("https://api.mojang.com/users/profiles/minecraft/") && conn.getResponseCode() == 204) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: Player does not exist.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: Player does not exist.")); } else { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } } - } catch (MalformedURLException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); } catch (IOException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); + ex.printStackTrace(); } - + return new JsonObject(); } @@ -82,7 +75,7 @@ public class APIHandler { if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String input; - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); while ((input = in.readLine()) != null) { response.append(input); @@ -90,33 +83,25 @@ public class APIHandler { in.close(); Gson gson = new Gson(); - JsonArray array = gson.fromJson(response.toString(), JsonArray.class); - - return array; + + return gson.fromJson(response.toString(), JsonArray.class); } else { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode())); } - } catch (MalformedURLException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); } catch (IOException ex) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); - System.err.println(ex); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "An error has occured. See logs for more details.")); + ex.printStackTrace(); } - + return new JsonArray(); } public static String getUUID(String username) { - Gson gson = new Gson(); - JsonObject uuidResponse = getResponse("https://api.mojang.com/users/profiles/minecraft/" + username); - String UUID = uuidResponse.get("id").getAsString(); - return UUID; + return uuidResponse.get("id").getAsString(); } public static String getLatestProfileID(String UUID, String key) { - Gson gson = new Gson(); EntityPlayer player = Minecraft.getMinecraft().thePlayer; // Get profiles @@ -125,11 +110,11 @@ public class APIHandler { JsonObject profilesResponse = getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key); if (!profilesResponse.get("success").getAsBoolean()) { String reason = profilesResponse.get("cause").getAsString(); - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); return null; } if (profilesResponse.get("profiles").isJsonNull()) { - player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "This player doesn't appear to have played SkyBlock.")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "This player doesn't appear to have played SkyBlock.")); return null; } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4cc910b..23bd6c4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -1,30 +1,25 @@ package me.Danker.handlers; -import java.io.File; - -import me.Danker.TheMod; -import me.Danker.commands.BlockSlayerCommand; -import me.Danker.commands.DisplayCommand; -import me.Danker.commands.LootCommand; -import me.Danker.commands.MoveCommand; -import me.Danker.commands.ScaleCommand; -import me.Danker.commands.ToggleCommand; +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; +import java.io.File; + public class ConfigHandler { public static Configuration config; - private static String file = "config/Danker's Skyblock Mod.cfg"; + private final static String file = "config/Danker's Skyblock Mod.cfg"; public static void init() { config = new Configuration(new File(file)); try { config.load(); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -38,7 +33,7 @@ public class ConfigHandler { return config.get(category, key, 0).getInt(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -53,7 +48,7 @@ public class ConfigHandler { return config.get(category, key, 0D).getDouble(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -68,7 +63,7 @@ public class ConfigHandler { return config.get(category, key, "").getString(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -83,7 +78,7 @@ public class ConfigHandler { return config.get(category, key, false).getBoolean(); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -97,7 +92,7 @@ public class ConfigHandler { int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -110,7 +105,7 @@ public class ConfigHandler { double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -123,7 +118,7 @@ public class ConfigHandler { String set = config.get(category, key, value).getString(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -136,7 +131,7 @@ public class ConfigHandler { boolean set = config.get(category, key, value).getBoolean(); config.getCategory(category).get(key).set(value); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -149,7 +144,7 @@ public class ConfigHandler { if (!config.hasCategory(category)) return false; return config.getCategory(category).containsKey(key); } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -164,7 +159,7 @@ public class ConfigHandler { config.removeCategory(new ConfigCategory(category)); } } catch (Exception ex) { - System.err.println(ex); + ex.printStackTrace(); } finally { config.save(); } @@ -183,6 +178,9 @@ public class ConfigHandler { if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false); if (!hasKey("toggles", "LividDagger")) writeBooleanConfig("toggles", "LividDagger", false); if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true); + if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); + if (!hasKey("toggles", "ImplosionMessages")) writeBooleanConfig("toggles", "ImplosionMessages", true); + if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false); if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false); if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", ""); @@ -190,21 +188,26 @@ public class ConfigHandler { if (!hasKey("toggles", "ExpertiseLore")) writeBooleanConfig("toggles", "ExpertiseLore", true); if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); - if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); - if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); if (!hasKey("toggles", "CakeTimer")) writeBooleanConfig("toggles", "CakeTimer", false); if (!hasKey("toggles", "LowHealthNotify")) writeBooleanConfig("toggles", "LowHealthNotify", false); if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); + if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); if (!hasKey("toggles", "BlazePuzzle")) writeBooleanConfig("toggles", "BlazePuzzle", false); if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); + if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); - + if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); + if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false); + if (!hasKey("toggles", "Superpairs")) writeBooleanConfig("toggles", "Superpairs", false); + if (!hasKey("toggles", "PickBlockInExperiments")) writeBooleanConfig("toggles", "PickBlockInExperiments", false); + + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); // Wolf Loot @@ -388,6 +391,8 @@ public class ConfigHandler { if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); + if (!hasKey("locations", "waterAnswerX")) writeIntConfig("locations", "waterAnswerX", 100); + if (!hasKey("locations", "waterAnswerY")) writeIntConfig("locations", "waterAnswerY", 100); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); @@ -395,6 +400,7 @@ public class ConfigHandler { if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); + if (!hasKey("scales", "waterAnswerScale")) writeDoubleConfig("scales", "waterAnswerScale", 1); if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); @@ -423,31 +429,38 @@ public class ConfigHandler { ToggleCommand.aotdToggled = getBoolean("toggles", "AOTD"); ToggleCommand.lividDaggerToggled = getBoolean("toggles", "LividDagger"); ToggleCommand.sceptreMessages = getBoolean("toggles", "SceptreMessages"); + ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); + ToggleCommand.implosionMessages = getBoolean("toggles", "ImplosionMessages"); + ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); ToggleCommand.petColoursToggled = getBoolean("toggles", "PetColors"); ToggleCommand.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer"); ToggleCommand.golemAlertToggled = getBoolean("toggles", "GolemAlerts"); ToggleCommand.expertiseLoreToggled = getBoolean("toggles", "ExpertiseLore"); ToggleCommand.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); ToggleCommand.outlineTextToggled = getBoolean("toggles", "OutlineText"); - ToggleCommand.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); - ToggleCommand.healMessages = getBoolean("toggles", "HealMessages"); ToggleCommand.cakeTimerToggled = getBoolean("toggles", "CakeTimer"); ToggleCommand.lowHealthNotifyToggled = getBoolean("toggles", "LowHealthNotify"); ToggleCommand.lividSolverToggled = getBoolean("toggles", "LividSolver"); + ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); // Puzzle Solvers ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); + ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); - + ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); + ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); + ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); + ToggleCommand.swapToPickBlockInExperimentsToggled = getBoolean("toggles", "PickBlockInExperiments"); + String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { BlockSlayerCommand.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" ")); - BlockSlayerCommand.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1, onlySlayer.length()); + BlockSlayerCommand.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1); } // Wolf @@ -612,9 +625,9 @@ public class ConfigHandler { // Misc DisplayCommand.display = getString("misc", "display"); DisplayCommand.auto = getBoolean("misc", "autoDisplay"); - TheMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; - TheMod.cakeTime = getDouble("misc", "cakeTime"); - TheMod.showSkillTracker = getBoolean("misc", "showSkillTracker"); + DankersSkyblockMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; + DankersSkyblockMod.cakeTime = getDouble("misc", "cakeTime"); + DankersSkyblockMod.showSkillTracker = getBoolean("misc", "showSkillTracker"); MoveCommand.coordsXY[0] = getInt("locations", "coordsX"); MoveCommand.coordsXY[1] = getInt("locations", "coordsY"); @@ -630,6 +643,8 @@ public class ConfigHandler { MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); + MoveCommand.waterAnswerXY[0] = getInt("locations", "waterAnswerX"); + MoveCommand.waterAnswerXY[1] = getInt("locations", "waterAnswerY"); ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); ScaleCommand.displayScale = getDouble("scales", "displayScale"); @@ -638,22 +653,23 @@ public class ConfigHandler { ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); - - TheMod.MAIN_COLOUR = getString("colors", "main"); - TheMod.SECONDARY_COLOUR = getString("colors", "secondary"); - TheMod.DELIMITER_COLOUR = getString("colors", "delimiter"); - TheMod.ERROR_COLOUR = getString("colors", "error"); - TheMod.TYPE_COLOUR = getString("colors", "type"); - TheMod.VALUE_COLOUR = getString("colors", "value"); - TheMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); - TheMod.ANSWER_COLOUR = getString("colors", "answer"); - TheMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); - TheMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); - TheMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); - TheMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); - TheMod.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); - TheMod.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); - TheMod.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); + ScaleCommand.waterAnswerScale = getDouble("scales", "waterAnswerScale"); + + DankersSkyblockMod.MAIN_COLOUR = getString("colors", "main"); + DankersSkyblockMod.SECONDARY_COLOUR = getString("colors", "secondary"); + DankersSkyblockMod.DELIMITER_COLOUR = getString("colors", "delimiter"); + DankersSkyblockMod.ERROR_COLOUR = getString("colors", "error"); + DankersSkyblockMod.TYPE_COLOUR = getString("colors", "type"); + DankersSkyblockMod.VALUE_COLOUR = getString("colors", "value"); + DankersSkyblockMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); + DankersSkyblockMod.ANSWER_COLOUR = getString("colors", "answer"); + DankersSkyblockMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); + DankersSkyblockMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); + DankersSkyblockMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); + DankersSkyblockMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); + DankersSkyblockMod.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); + DankersSkyblockMod.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); + DankersSkyblockMod.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); } } diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index 716b27c..da7900a 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -1,7 +1,5 @@ package me.Danker.handlers; -import java.lang.reflect.Field; - import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; @@ -18,6 +16,8 @@ import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; import net.minecraft.util.BlockPos; +import java.lang.reflect.Field; + public class PacketHandler extends ChannelDuplexHandler { // Spirit boots fix @@ -47,7 +47,7 @@ public class PacketHandler extends ChannelDuplexHandler { EntityItemFrame itemFrame = (EntityItemFrame) entityHit; ItemStack item = itemFrame.getDisplayedItem(); if (item != null && item.getItem() == Items.arrow) { - BlockPos blockPos = Utils.getBlockUnderItemFrame(mc.theWorld, itemFrame); + BlockPos blockPos = Utils.getBlockUnderItemFrame(itemFrame); if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { return; } diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java index 92fc844..b81689c 100644 --- a/src/main/java/me/Danker/handlers/ScoreboardHandler.java +++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java @@ -1,13 +1,7 @@ package me.Danker.handlers; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - import com.google.common.collect.Iterables; import com.google.common.collect.Lists; - import net.minecraft.client.Minecraft; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; @@ -15,6 +9,11 @@ import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.StringUtils; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + public class ScoreboardHandler { public static String cleanSB(String scoreboard) { @@ -39,10 +38,10 @@ public class ScoreboardHandler { if (objective == null) return lines; Collection<Score> scores = scoreboard.getSortedScores(objective); - List<Score> list = Lists.newArrayList(scores.stream() + List<Score> list = scores.stream() .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName() .startsWith("#")) - .collect(Collectors.toList())); + .collect(Collectors.toList()); if (list.size() > 15) { scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15)); diff --git a/src/main/java/me/Danker/handlers/TextRenderer.java b/src/main/java/me/Danker/handlers/TextRenderer.java index 0e965e6..cbf196b 100644 --- a/src/main/java/me/Danker/handlers/TextRenderer.java +++ b/src/main/java/me/Danker/handlers/TextRenderer.java @@ -1,15 +1,14 @@ package me.Danker.handlers; -import org.lwjgl.opengl.GL11; - import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.StringUtils; +import org.lwjgl.opengl.GL11; public class TextRenderer extends Gui { public TextRenderer(Minecraft mc, String text, int x, int y, double scale) { - double scaleReset = (double) Math.pow(scale, -1); + double scaleReset = Math.pow(scale, -1); GL11.glScaled(scale, scale, scale); y -= mc.fontRendererObj.FONT_HEIGHT; diff --git a/src/main/java/me/Danker/utils/TicTacToeUtils.java b/src/main/java/me/Danker/utils/TicTacToeUtils.java new file mode 100644 index 0000000..ab1b853 --- /dev/null +++ b/src/main/java/me/Danker/utils/TicTacToeUtils.java @@ -0,0 +1,102 @@ +package me.Danker.utils; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class TicTacToeUtils { + + public static int getBestMove(char[][] board) { + HashMap<Integer, Integer> moves = new HashMap<>(); + for (int row = 0; row < board.length; row++) { + for (int col = 0; col < board[row].length; col++) { + if (board[row][col] != '\0') continue; + board[row][col] = 'O'; + int score = minimax(board, false, 0); + board[row][col] = '\0'; + moves.put(row * 3 + col + 1, score); + } + } + return Collections.max(moves.entrySet(), Map.Entry.comparingByValue()).getKey(); + } + + public static boolean hasMovesLeft(char[][] board) { + for (char[] rows : board) { + for (char col : rows) { + if (col == '\0') return true; + } + } + return false; + } + + public static int getBoardRanking(char[][] board) { + for (int row = 0; row < 3; row++) { + if (board[row][0] == board[row][1] && board[row][0] == board[row][2]) { + if (board[row][0] == 'X') { + return -10; + } else if (board[row][0] == 'O') { + return 10; + } + } + } + + for (int col = 0; col < 3; col++) { + if (board[0][col] == board[1][col] && board[0][col] == board[2][col]) { + if (board[0][col] == 'X') { + return -10; + } else if (board[0][col] == 'O') { + return 10; + } + } + } + + if (board[0][0] == board[1][1] && board[0][0] == board[2][2]) { + if (board[0][0] == 'X') { + return -10; + } else if (board[0][0] == 'O') { + return 10; + } + } else if (board[0][2] == board[1][1] && board[0][2] == board[2][0]) { + if (board[0][2] == 'X') { + return -10; + } else if (board[0][2] == 'O') { + return 10; + } + } + + return 0; + } + + public static int minimax(char[][] board, boolean max, int depth) { + int score = getBoardRanking(board); + if (score == 10 || score == -10) return score; + if (!hasMovesLeft(board)) return 0; + + if (max) { + int bestScore = -1000; + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + if (board[row][col] == '\0') { + board[row][col] = 'O'; + bestScore = Math.max(bestScore, minimax(board, false, depth + 1)); + board[row][col] = '\0'; + } + } + } + return bestScore - depth; + } else { + int bestScore = 1000; + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 3; col++) { + if (board[row][col] == '\0') { + board[row][col] = 'X'; + bestScore = Math.min(bestScore, minimax(board, true, depth + 1)); + board[row][col] = '\0'; + } + } + } + return bestScore + depth; + } + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 245d071..fbd8e4c 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -1,14 +1,6 @@ package me.Danker.utils; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.regex.Matcher; - -import org.lwjgl.opengl.GL11; - -import me.Danker.TheMod; +import me.Danker.DankersSkyblockMod; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.block.Block; @@ -17,6 +9,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderManager; @@ -26,13 +19,16 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StringUtils; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; +import net.minecraft.util.*; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.regex.Matcher; public class Utils { @@ -68,11 +64,11 @@ public class Utils { } public static String returnGoldenEnchants(String line) { - Matcher matcher = TheMod.pattern.matcher(line); + Matcher matcher = DankersSkyblockMod.pattern.matcher(line); StringBuffer out = new StringBuffer(); while (matcher.find()) { - matcher.appendReplacement(out, TheMod.t6Enchants.get(matcher.group(1))); + matcher.appendReplacement(out, DankersSkyblockMod.t6Enchants.get(matcher.group(1))); } matcher.appendTail(out); @@ -96,9 +92,9 @@ public class Utils { public static void createTitle(String text, int seconds) { Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, (float) 0.5); - TheMod.titleTimer = seconds * 20; - TheMod.showTitle = true; - TheMod.titleText = text; + DankersSkyblockMod.titleTimer = seconds * 20; + DankersSkyblockMod.showTitle = true; + DankersSkyblockMod.titleText = text; } public static void drawTitle(String text) { @@ -107,16 +103,21 @@ public class Utils { int height = scaledResolution.getScaledHeight(); int width = scaledResolution.getScaledWidth(); - int textLength = mc.fontRendererObj.getStringWidth(text); - - double scale = 4; - if (textLength * scale > (width * 0.9F)) { - scale = (width * 0.9F) / (float) textLength; + int drawHeight = 0; + String[] splitText = text.split("\n"); + for (String title : splitText) { + int textLength = mc.fontRendererObj.getStringWidth(title); + + double scale = 4; + if (textLength * scale > (width * 0.9F)) { + scale = (width * 0.9F) / (float) textLength; + } + + int titleX = (int) ((width / 2) - (textLength * scale / 2)); + int titleY = (int) ((height * 0.45) / scale) + (int) (drawHeight * scale); + new TextRenderer(mc, title, titleX, titleY, scale); + drawHeight += mc.fontRendererObj.FONT_HEIGHT; } - - int titleX = (int) ((width / 2) - (textLength * scale / 2)); - int titleY = (int) ((height * 0.45) / scale); - new TextRenderer(mc, text, titleX, titleY, scale); } public static void checkForSkyblock() { @@ -135,7 +136,6 @@ public class Utils { } public static void checkForDungeons() { - Minecraft mc = Minecraft.getMinecraft(); if (inSkyblock) { List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { @@ -183,7 +183,7 @@ public class Utils { public static String getTimeBetween(double timeOne, double timeTwo) { double secondsBetween = Math.floor(timeTwo - timeOne); - String timeFormatted = ""; + String timeFormatted; int days; int hours; int minutes; @@ -246,8 +246,14 @@ public class Utils { } public static int getPastXpEarned(int currentLevelXp, int limit) { - if (currentLevelXp == 0) return skillXPPerLevel[limit]; - for (int i = 1, xpAdded = 0; i < limit; i++) { + if (currentLevelXp == 0) { + int xpAdded = 0; + for (int i = 1; i <= limit; i++) { + xpAdded += skillXPPerLevel[i]; + } + return xpAdded; + } + for (int i = 1, xpAdded = 0; i <= limit; i++) { xpAdded += skillXPPerLevel[i - 1]; if (currentLevelXp == skillXPPerLevel[i]) return xpAdded; } @@ -364,6 +370,22 @@ public class Utils { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } + + public static void renderItem(ItemStack item, float x, float y, float z) { + + GlStateManager.enableRescaleNormal(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.enableDepth(); + + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, z); + Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(item, 0, 0); + GlStateManager.popMatrix(); + + GlStateManager.disableDepth(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + } public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) { double x = pos2.xCoord - pos1.xCoord; @@ -405,7 +427,7 @@ public class Utils { return closestBlock; } - public static BlockPos getBlockUnderItemFrame(World world, EntityItemFrame itemFrame) { + public static BlockPos getBlockUnderItemFrame(EntityItemFrame itemFrame) { switch (itemFrame.facingDirection) { case NORTH: return new BlockPos(itemFrame.posX, itemFrame.posY, itemFrame.posZ + 1); |