diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-30 15:28:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 15:28:14 -0500 |
commit | 886402bdcd8d68e6d1076c86d53baab47070dd63 (patch) | |
tree | 80b30cfa6fd5127a63d51ae1037bbd129dbee1af | |
parent | 016814851e46acdbc7a8fce44746eb67feef5905 (diff) | |
parent | 7091007cdd4f214ab47d1fb18c951eb25cb67852 (diff) | |
download | SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.tar.gz SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.tar.bz2 SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.zip |
1.8.3
Merge pull request #32 from bowser0000/development
I forgot to pull request when releasing
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 174 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DHelpCommand.java | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 34 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 77 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/PuzzleSolversGui.java | 56 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 6 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/PacketHandler.java | 32 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 17 |
10 files changed, 288 insertions, 115 deletions
@@ -26,6 +26,7 @@ Discord Server: https://discord.gg/QsEkNQS - Expertise kills in fishing rod lore - Catacombs trackers - Dungeons puzzle solver (Riddle, trivia, blaze, creeper, water) +- Catacombs F7 Stage 3 solvers (Starts with letter, select all colour, ignore arrows on sea lanterns) - Find correct Livid (with graphic display of HP) - Pet background colors based on level - Golem spawning alerts @@ -40,7 +41,7 @@ Discord Server: https://discord.gg/QsEkNQS ## Commands - /dhelp - Returns this message in-game. - /dsm - Opens the GUI for Danker's Skyblock Mod. -- /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/midasstaffmessages/healmessages/caketimer/lividsolver/lowhealthnotify/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/list> - Toggles features. /toggle list returns values of every toggle. +- /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/midasstaffmessages/healmessages/caketimer/lividsolver/lowhealthnotify/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/startswithterminal/selectallterminal/itemframeonsealanterns/list> - Toggles features. /toggle list returns values of every toggle. - /setkey <key> - Sets API key. - /getkey - Returns key set with /setkey and copies it to your clipboard. - /loot <zombie/spider/wolf/fishing/catacombs> [winter/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. diff --git a/build.gradle b/build.gradle index 0b0e2b1..60e9ed9 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.2" +version = "1.8.3" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 1cc0939..9f0e935 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -62,11 +62,13 @@ import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; @@ -90,6 +92,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.WorldEvent; @@ -112,7 +115,7 @@ import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.2"; + public static final String VERSION = "1.8.3"; static double checkItemsNow = 0; static double itemsChecked = 0; @@ -146,7 +149,6 @@ public class TheMod static String[] triviaAnswers = null; static Entity highestBlaze = null; static Entity lowestBlaze = null; - static boolean lowToHigh = false; // Among Us colours static final int[] CREEPER_COLOURS = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; static boolean drawCreeperLines = false; @@ -180,6 +182,7 @@ public class TheMod public static double enchantingXPGained = 0; static double alchemyXP = 0; public static double alchemyXPGained = 0; + static double xpLeft = 0; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -374,7 +377,9 @@ public class TheMod if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { int limit = section.contains("Farming") ? 60 : 50; double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); - int previousXP = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + 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(" ")); @@ -981,7 +986,7 @@ public class TheMod LootCommand.minosHunters++; LootCommand.minosHuntersSession++; ConfigHandler.writeIntConfig("mythological", "minosHunter", LootCommand.minosHunters); - } else if (message.contains("Siamese Lynxes!!")) { + } else if (message.contains("Siamese Lynxes!")) { LootCommand.siameseLynxes++; LootCommand.siameseLynxesSession++; ConfigHandler.writeIntConfig("mythological", "siameseLynx", LootCommand.siameseLynxes); @@ -1304,6 +1309,10 @@ public class TheMod String skillTrackerText = SKILL_TRACKER_COLOUR + lastSkill + " XP Earned: " + NumberFormat.getNumberInstance(Locale.US).format(xpToShow) + "\n" + SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, skillStopwatch.getTime() / 1000d) + "\n" + SKILL_TRACKER_COLOUR + "XP Per Hour: " + NumberFormat.getIntegerInstance(Locale.US).format(xpPerHour); + if (xpLeft >= 0) { + String time = xpPerHour == 0 ? "Never" : Utils.getTimeBetween(0, xpLeft / (xpPerHour / 3600D)); + skillTrackerText += "\n" + SKILL_TRACKER_COLOUR + "Time Until Next Level: " + time; + } if (!skillStopwatch.isStarted() || skillStopwatch.isSuspended()) { skillTrackerText += "\n" + EnumChatFormatting.RED + "PAUSED"; } @@ -2294,7 +2303,7 @@ public class TheMod Utils.checkForDungeons(); } - if (DisplayCommand.auto && mc != null && world != null) { + if (DisplayCommand.auto && mc != null && world != null && player != null) { List<String> scoreboard = ScoreboardHandler.getSidebarLines(); boolean found = false; for (String s : scoreboard) { @@ -2327,6 +2336,14 @@ public class TheMod found = true; } } + for (int i = 0; i < 8; i++) { + ItemStack hotbarItem = player.inventory.getStackInSlot(i); + if (hotbarItem == null) continue; + if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { + DisplayCommand.display = "mythological"; + found = true; + } + } if (!found) DisplayCommand.display = "off"; ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display); } @@ -2545,27 +2562,6 @@ public class TheMod } } } - - if (highestBlaze != null || lowestBlaze != null) { - new Thread(() -> { - boolean wallFound = false; - for (int x = (int) player.posX - 25; x <= player.posX + 25; x++) { - for (int z = (int) player.posZ - 25; z <= player.posX + 25; z++) { - BlockPos blockPos = new BlockPos(x, 119, z); - if (world.getBlockState(blockPos).getBlock() == Blocks.cobblestone_wall) { - wallFound = true; - break; - } - } - if (wallFound) break; - } - if (wallFound) { - lowToHigh = true; - } else { - lowToHigh = false; - } - }).start(); - } } } @@ -2616,7 +2612,7 @@ public class TheMod mc.displayGuiScreen(new EditLocationsGui()); break; case "puzzlesolvers": - mc.displayGuiScreen(new PuzzleSolversGui()); + mc.displayGuiScreen(new PuzzleSolversGui(1)); break; case "skilltracker": mc.displayGuiScreen(new SkillTrackerGui()); @@ -2630,13 +2626,13 @@ public class TheMod @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.blazeToggled) { - if (lowestBlaze != null && lowToHigh) { + if (lowestBlaze != null) { BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Smallest", LOWEST_BLAZE_COLOUR, event.partialTicks); AxisAlignedBB aabb = new AxisAlignedBB(lowestBlaze.posX - 0.5, lowestBlaze.posY - 2, lowestBlaze.posZ - 0.5, lowestBlaze.posX + 0.5, lowestBlaze.posY, lowestBlaze.posZ + 0.5); Utils.draw3DBox(aabb, LOWEST_BLAZE_COLOUR, event.partialTicks); } - if (highestBlaze != null && !lowToHigh) { + if (highestBlaze != null) { BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Biggest", HIGHEST_BLAZE_COLOUR, event.partialTicks); AxisAlignedBB aabb = new AxisAlignedBB(highestBlaze.posX - 0.5, highestBlaze.posY - 2, highestBlaze.posZ - 0.5, highestBlaze.posX + 0.5, highestBlaze.posY, highestBlaze.posZ + 0.5); @@ -2667,6 +2663,22 @@ public class TheMod } @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); + if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { + event.setCanceled(true); + } + } + } + + @SubscribeEvent public void onKey(KeyInputEvent event) { if (!Utils.inSkyblock) return; @@ -2794,44 +2806,74 @@ public class TheMod @SubscribeEvent public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent event) { - if (!Utils.inSkyblock) return; - if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) { + //if (!Utils.inSkyblock) return; + if (event.gui instanceof GuiChest) { GuiChest inventory = (GuiChest) event.gui; - List<Slot> invSlots = inventory.inventorySlots.inventorySlots; - Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); - for (Slot slot : invSlots) { - ItemStack item = slot.getStack(); - if (item == null) continue; - String name = item.getDisplayName(); - if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) { - if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank")) continue; - int colour; - int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]"))); - if (petLevel == 100) { - colour = 0xBFF2D249; // Gold - } else if (petLevel >= 90) { - colour = 0xBF9E794E; // Brown - } else if (petLevel >= 80) { - colour = 0xBF5C1F35; // idk weird magenta - } else if (petLevel >= 70) { - colour = 0xBFD64FC8; // Pink - } else if (petLevel >= 60) { - colour = 0xBF7E4FC6; // Purple - } else if (petLevel >= 50) { - colour = 0xBF008AD8; // Light Blue - } else if (petLevel >= 40) { - colour = 0xBF0EAC35; // Green - } else if (petLevel >= 30) { - colour = 0xBFFFC400; // Yellow - } else if (petLevel >= 20) { - colour = 0xBFEF5230; // Orange - } else if (petLevel >= 10) { - colour = 0xBFD62440; // Red - } else { - colour = 0xBF999999; // Gray - } - Utils.drawOnSlot(inventory.inventorySlots.inventorySlots.size(), slot.xDisplayPosition, slot.yDisplayPosition, colour); - } + Container containerChest = inventory.inventorySlots; + if (containerChest instanceof ContainerChest) { + List<Slot> invSlots = inventory.inventorySlots.inventorySlots; + String displayName = ((ContainerChest) containerChest).getLowerChestInventory().getDisplayName().getUnformattedText(); + int chestSize = inventory.inventorySlots.inventorySlots.size(); + + if (ToggleCommand.petColoursToggled) { + Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); + for (Slot slot : invSlots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + String name = item.getDisplayName(); + if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) { + if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank")) continue; + int colour; + int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]"))); + if (petLevel == 100) { + colour = 0xBFF2D249; // Gold + } else if (petLevel >= 90) { + colour = 0xBF9E794E; // Brown + } else if (petLevel >= 80) { + colour = 0xBF5C1F35; // idk weird magenta + } else if (petLevel >= 70) { + colour = 0xBFD64FC8; // Pink + } else if (petLevel >= 60) { + colour = 0xBF7E4FC6; // Purple + } else if (petLevel >= 50) { + colour = 0xBF008AD8; // Light Blue + } else if (petLevel >= 40) { + colour = 0xBF0EAC35; // Green + } else if (petLevel >= 30) { + colour = 0xBFFFC400; // Yellow + } else if (petLevel >= 20) { + colour = 0xBFEF5230; // Orange + } else if (petLevel >= 10) { + colour = 0xBFD62440; // Red + } else { + colour = 0xBF999999; // Gray + } + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, colour); + } + } + } + + if (ToggleCommand.startsWithToggled && Utils.inDungeons && displayName.trim().startsWith("What starts with:")) { + char letter = displayName.charAt(displayName.indexOf("'") + 1); + for (Slot slot : invSlots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + if (StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter) { + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + } + } + + if (ToggleCommand.selectAllToggled && Utils.inDungeons && displayName.trim().startsWith("Select all the")) { + String colour = displayName.split(" ")[3]; + for (Slot slot : invSlots) { + ItemStack item = slot.getStack(); + if (item == null) continue; + if (item.getDisplayName().toUpperCase().contains(colour)) { + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + } + } } } } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 9d9bb51..4f99c0d 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { 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/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/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 + " /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" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 6e85d58..51503ed 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -41,6 +41,10 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean blazeToggled; public static boolean creeperToggled; public static boolean waterToggled; + // Terminal Helpers + public static boolean startsWithToggled; + public static boolean selectAllToggled; + public static boolean itemFrameOnSeaLanternsToggled; @Override public String getCommandName() { @@ -52,7 +56,8 @@ public class ToggleCommand extends CommandBase implements ICommand { 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/list>"; + "blazepuzzle/creeperpuzzle/waterpuzzle/startswithterminal/selectallterminal/" + + "itemframeonsealanterns/list>"; } @Override @@ -68,7 +73,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "threemanpuzzle", - "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "list"); + "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "startswithterminal", + "selectallterminal", "itemframeonsealanterns", "list"); } return null; } @@ -211,14 +217,29 @@ public class ToggleCommand extends CommandBase implements ICommand { break; case "creeperpuzzle": creeperToggled = !creeperToggled; - ConfigHandler.writeBooleanConfig("creeperpuzzle", "CreeperPuzzle", 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 + ".")); break; case "waterpuzzle": waterToggled = !waterToggled; - ConfigHandler.writeBooleanConfig("waterpuzzle", "WaterPuzzle", 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 + ".")); 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 + ".")); + 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 + ".")); + 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 + ".")); + 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" + @@ -246,7 +267,10 @@ public class ToggleCommand extends CommandBase implements ICommand { 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)); + 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)); default: player.addChatMessage(new ChatComponentText(TheMod.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 f086e25..168f7c7 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -107,42 +107,47 @@ public class DankerGui extends GuiScreen { 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)); - if (page == 1) { - this.buttonList.add(changeDisplay); - this.buttonList.add(onlySlayer); - this.buttonList.add(puzzleSolvers); - this.buttonList.add(skillTracker); - this.buttonList.add(outlineText); - this.buttonList.add(splitFishing); - this.buttonList.add(coords); - this.buttonList.add(nextPage); - } else if (page == 2) { - 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); - } else if (page == 3) { - this.buttonList.add(gparty); - this.buttonList.add(spiritBearAlert); - this.buttonList.add(sceptreMessages); - this.buttonList.add(midasStaffMessages); - this.buttonList.add(healMessages); - this.buttonList.add(goldenEnch); - this.buttonList.add(petColours); - this.buttonList.add(nextPage); - this.buttonList.add(backPage); - } else if (page == 4) { - this.buttonList.add(expertiseLore); - this.buttonList.add(lividSolver); - this.buttonList.add(golemAlerts); - this.buttonList.add(rngesusAlert); - this.buttonList.add(lowHealthNotify); - this.buttonList.add(backPage); + switch (page) { + case 1: + this.buttonList.add(changeDisplay); + this.buttonList.add(onlySlayer); + this.buttonList.add(puzzleSolvers); + 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(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(gparty); + this.buttonList.add(spiritBearAlert); + this.buttonList.add(sceptreMessages); + this.buttonList.add(midasStaffMessages); + 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(expertiseLore); + this.buttonList.add(lividSolver); + this.buttonList.add(golemAlerts); + this.buttonList.add(rngesusAlert); + this.buttonList.add(lowHealthNotify); + this.buttonList.add(backPage); + break; } this.buttonList.add(githubLink); diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 4ae97bb..b052b02 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -11,12 +11,23 @@ import net.minecraft.client.gui.ScaledResolution; public class PuzzleSolversGui extends GuiScreen { + private int page; + private GuiButton goBack; + private GuiButton backPage; + private GuiButton nextPage; private GuiButton riddle; private GuiButton trivia; private GuiButton blaze; private GuiButton creeper; private GuiButton water; + private GuiButton startsWith; + private GuiButton selectAll; + private GuiButton itemFrameOnSeaLanterns; + + public PuzzleSolversGui(int page) { + this.page = page; + } @Override public boolean doesGuiPauseGame() { @@ -32,18 +43,37 @@ public class PuzzleSolversGui extends GuiScreen { int width = sr.getScaledWidth(); goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + backPage = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), 80, 20, "< Back"); + nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); + + // Page 1 riddle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Riddle Solver: " + Utils.getColouredBoolean(ToggleCommand.threeManToggled)); trivia = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Trivia Solver: " + Utils.getColouredBoolean(ToggleCommand.oruoToggled)); 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)); + // Page 2 + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + switch (page) { + case 1: + this.buttonList.add(riddle); + this.buttonList.add(trivia); + this.buttonList.add(blaze); + this.buttonList.add(creeper); + this.buttonList.add(water); + this.buttonList.add(startsWith); + this.buttonList.add(selectAll); + this.buttonList.add(nextPage); + break; + case 2: + this.buttonList.add(itemFrameOnSeaLanterns); + this.buttonList.add(backPage); + break; + } this.buttonList.add(goBack); - this.buttonList.add(riddle); - this.buttonList.add(trivia); - this.buttonList.add(blaze); - this.buttonList.add(creeper); - this.buttonList.add(water); } @Override @@ -56,6 +86,10 @@ public class PuzzleSolversGui extends GuiScreen { public void actionPerformed(GuiButton button) { if (button == goBack) { TheMod.guiToOpen = "dankergui1"; + } else if (button == backPage) { + Minecraft.getMinecraft().displayGuiScreen(new PuzzleSolversGui(page - 1)); + } else if (button == nextPage) { + Minecraft.getMinecraft().displayGuiScreen(new PuzzleSolversGui(page + 1)); } else if (button == riddle) { ToggleCommand.threeManToggled = !ToggleCommand.threeManToggled; ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", ToggleCommand.threeManToggled); @@ -76,6 +110,18 @@ 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 == startsWith) { + ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; + ConfigHandler.writeBooleanConfig("toggle", "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); + selectAll.displayString = "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled); + } else if (button == itemFrameOnSeaLanterns) { + ToggleCommand.itemFrameOnSeaLanternsToggled = !ToggleCommand.itemFrameOnSeaLanternsToggled; + ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", ToggleCommand.itemFrameOnSeaLanternsToggled); + itemFrameOnSeaLanterns.displayString = "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index c680716..4cc910b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -201,6 +201,9 @@ public class ConfigHandler { 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", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); + if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); + if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -437,6 +440,9 @@ public class ConfigHandler { ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); + ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); + ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); + ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index ed1c8b0..716b27c 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -4,13 +4,23 @@ import java.lang.reflect.Field; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; +import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; +import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.util.BlockPos; public class PacketHandler extends ChannelDuplexHandler { + // Spirit boots fix @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (Utils.inSkyblock && msg instanceof Packet && msg.getClass().getName().endsWith("S04PacketEntityEquipment")) { // Inventory packet name @@ -26,4 +36,26 @@ public class PacketHandler extends ChannelDuplexHandler { super.channelRead(ctx, msg); } + // Ignore item frames with arrows on sea lanterns + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + if (ToggleCommand.itemFrameOnSeaLanternsToggled && Utils.inDungeons && msg instanceof Packet && msg.getClass().getName().endsWith("C02PacketUseEntity")) { + Minecraft mc = Minecraft.getMinecraft(); + C02PacketUseEntity packet = (C02PacketUseEntity) msg; + Entity entityHit = packet.getEntityFromWorld(mc.theWorld); + if (entityHit instanceof EntityItemFrame) { + EntityItemFrame itemFrame = (EntityItemFrame) entityHit; + ItemStack item = itemFrame.getDisplayedItem(); + if (item != null && item.getItem() == Items.arrow) { + BlockPos blockPos = Utils.getBlockUnderItemFrame(mc.theWorld, itemFrame); + if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { + return; + } + } + } + } + + super.write(ctx, msg, promise); + } + } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 29e61ed..245d071 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -23,6 +23,7 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; 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.scoreboard.ScoreObjective; @@ -31,6 +32,7 @@ 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; public class Utils { @@ -403,4 +405,19 @@ public class Utils { return closestBlock; } + public static BlockPos getBlockUnderItemFrame(World world, EntityItemFrame itemFrame) { + switch (itemFrame.facingDirection) { + case NORTH: + return new BlockPos(itemFrame.posX, itemFrame.posY, itemFrame.posZ + 1); + case EAST: + return new BlockPos(itemFrame.posX - 1, itemFrame.posY, itemFrame.posZ - 0.5); + case SOUTH: + return new BlockPos(itemFrame.posX, itemFrame.posY, itemFrame.posZ - 1); + case WEST: + return new BlockPos(itemFrame.posX + 1, itemFrame.posY, itemFrame.posZ - 0.5); + default: + return null; + } + } + } |