diff options
Diffstat (limited to 'src')
30 files changed, 4030 insertions, 2557 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 2c75a0e..12a8066 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -7,20 +7,25 @@ import me.Danker.handlers.*; import me.Danker.utils.TicTacToeUtils; import me.Danker.utils.Utils; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; 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.*; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.command.ICommand; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; +import net.minecraft.event.HoverEvent; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.Container; @@ -40,9 +45,7 @@ import net.minecraftforge.client.event.*; 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.entity.player.*; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Loader; @@ -67,18 +70,18 @@ import java.awt.*; import java.text.NumberFormat; import java.util.List; import java.util.*; +import java.util.regex.Matcher; import java.util.regex.Pattern; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) -public class DankersSkyblockMod -{ +public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.4"; - + public static final String VERSION = "1.8.5"; static double checkItemsNow = 0; static double itemsChecked = 0; public static Map<String, String> t6Enchants = new HashMap<>(); - public static Pattern pattern = Pattern.compile(""); + public static Pattern t6EnchantPattern = Pattern.compile(""); + static Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); static boolean updateChecked = false; public static int titleTimer = -1; public static boolean showTitle = false; @@ -90,48 +93,57 @@ public class DankersSkyblockMod static int tickAmount = 1; static String lastMaddoxCommand = "/cb placeholder"; static double lastMaddoxTime = 0; - static KeyBinding[] keyBindings = new KeyBinding[2]; + static KeyBinding[] keyBindings = new KeyBinding[3]; static boolean usingLabymod = false; + static boolean usingOAM = false; + static boolean OAMWarning = false; public static String guiToOpen = null; - static boolean foundLivid = false; - static Entity livid = null; - public static double cakeTime; - - public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); - - 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<>(); - static String[] triviaAnswers = null; - static Entity highestBlaze = null; - static Entity lowestBlaze = null; - // Among Us colours - 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<>(); - static boolean prevInWaterRoom = false; - static boolean inWaterRoom = false; - 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 boolean foundLivid = false; + static Entity livid = null; + public static double cakeTime; + public static double nextBonzoUse = 0; + public static boolean firstLaunch = false; + + public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); + public static final ResourceLocation BONZO_ICON = new ResourceLocation("dsm", "icons/bonzo.png"); + + 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 BlockPos riddleChest = null; + static Map<String, String[]> triviaSolutions = new HashMap<>(); + static String[] triviaAnswers = null; + static Entity highestBlaze = null; + static Entity lowestBlaze = null; + // Among Us colours + 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<>(); + static boolean prevInWaterRoom = false; + static boolean inWaterRoom = false; + static String waterAnswers = null; + static AxisAlignedBB correctTicTacToeButton = null; + static Pattern startsWithTerminalPattern = Pattern.compile("[A-Z]{2,}"); + 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 String terminalColorNeeded; + static int[] terminalNumberNeeded = new int[4]; + + static double dungeonStartTime = 0; static double bloodOpenTime = 0; static double watcherClearTime = 0; static double bossClearTime = 0; static int witherDoors = 0; static int dungeonDeaths = 0; static int puzzleFails = 0; - + static String lastSkill = "Farming"; public static boolean showSkillTracker; public static StopWatch skillStopwatch = new StopWatch(); @@ -150,6 +162,7 @@ public class DankersSkyblockMod static double alchemyXP = 0; public static double alchemyXPGained = 0; static double xpLeft = 0; + static double timeSinceGained = 0; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -164,98 +177,117 @@ public class DankersSkyblockMod public static String CAKE_COLOUR; public static String SKILL_TRACKER_COLOUR; public static String TRIVIA_WRONG_ANSWER_COLOUR; + public static String BONZO_COLOR; public static int LOWEST_BLAZE_COLOUR; public static int HIGHEST_BLAZE_COLOUR; - + public static int PET_1_TO_9; + public static int PET_10_TO_19; + public static int PET_20_TO_29; + public static int PET_30_TO_39; + public static int PET_40_TO_49; + public static int PET_50_TO_59; + public static int PET_60_TO_69; + public static int PET_70_TO_79; + public static int PET_80_TO_89; + public static int PET_90_TO_99; + public static int PET_100; + public static int ULTRASEQUENCER_NEXT; + public static int ULTRASEQUENCER_NEXT_TO_NEXT; + public static int CHRONOMATRON_NEXT; + public static int CHRONOMATRON_NEXT_TO_NEXT; + public static int CLICK_IN_ORDER_NEXT; + public static int CLICK_IN_ORDER_NEXT_TO_NEXT; + @EventHandler public void init(FMLInitializationEvent event) { - MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.EVENT_BUS.register(new PacketHandler()); - - ConfigHandler.reloadConfig(); - - // For golden enchants - t6Enchants.put("9Angler VI", "6Angler VI"); - t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); - t6Enchants.put("9Caster VI", "6Caster VI"); - t6Enchants.put("9Compact X", "6Compact X"); - t6Enchants.put("9Critical VI", "6Critical VI"); - t6Enchants.put("9Dragon Hunter V", "6Dragon Hunter V"); - t6Enchants.put("9Efficiency VI", "6Efficiency VI"); - t6Enchants.put("9Ender Slayer VI", "6Ender Slayer VI"); - t6Enchants.put("9Experience IV", "6Experience IV"); - t6Enchants.put("9Expertise X", "6Expertise X"); - t6Enchants.put("9Feather Falling X", "6Feather Falling X"); - t6Enchants.put("9Frail VI", "6Frail VI"); - t6Enchants.put("9Giant Killer VI", "6Giant Killer VI"); - t6Enchants.put("9Growth VI", "6Growth VI"); - t6Enchants.put("9Infinite Quiver X", "6Infinite Quiver X"); - t6Enchants.put("9Lethality VI", "6Lethality VI"); - t6Enchants.put("9Life Steal IV", "6Life Steal IV"); - t6Enchants.put("9Looting IV", "6Looting IV"); - t6Enchants.put("9Luck VI", "6Luck VI"); - t6Enchants.put("9Luck of the Sea VI", "6Luck of the Sea VI"); - t6Enchants.put("9Lure VI", "6Lure VI"); - t6Enchants.put("9Magnet VI", "6Magnet VI"); - t6Enchants.put("9Overload V", "6Overload V"); - t6Enchants.put("9Power VI", "6Power VI"); - t6Enchants.put("9Protection VI", "6Protection VI"); - t6Enchants.put("9Scavenger IV", "6Scavenger IV"); - t6Enchants.put("9Scavenger V", "6Scavenger V"); - t6Enchants.put("9Sharpness VI", "6Sharpness VI"); - t6Enchants.put("9Smite VI", "6Smite VI"); - t6Enchants.put("9Spiked Hook VI", "6Spiked Hook VI"); - t6Enchants.put("9Thunderlord VI", "6Thunderlord VI"); - t6Enchants.put("9Vampirism VI", "6Vampirism VI"); - - triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); - triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); - triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); - triviaSolutions.put("What is the status of The Professor?", new String[]{"Professor"}); - triviaSolutions.put("What is the status of Thorn?", new String[]{"Shaman Necromancer"}); - triviaSolutions.put("What is the status of Livid?", new String[]{"Master Necromancer"}); - triviaSolutions.put("What is the status of Sadan?", new String[]{"Necromancer Lord"}); - triviaSolutions.put("What is the status of Maxor?", new String[]{"Young Wither"}); - triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); - triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); - triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"209 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The Hub?", new String[]{"79 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", new String[]{"21 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", new String[]{"12 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Dungeon Hub?", new String[]{"7 Fairy Souls"}); - triviaSolutions.put("Which brother is on the Spider's Den?", new String[]{"Rick"}); - triviaSolutions.put("What is the name of Rick's brother?", new String[]{"Pat"}); - triviaSolutions.put("What is the name of the Painter in the Hub?", new String[]{"Marco"}); - triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); - triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); - triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); - triviaSolutions.put("How many unique minions are there?", new String[]{"52 Minions"}); - triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", - "Dashing Spooder", "Broodfather", "Night Spider"}); - triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); - triviaSolutions.put("Which of these is not a dragon in The End?", new String[]{"Zoomer Dragon", "Weak Dragon", "Stonk Dragon", "Holy Dragon", "Boomer Dragon", - "Booger Dragon", "Older Dragon", "Elder Dragon", "Stable Dragon", "Professor Dragon"}); - - String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; - pattern = Pattern.compile(patternString); - - 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 (KeyBinding keyBinding : keyBindings) { - ClientRegistry.registerKeyBinding(keyBinding); - } + MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new PacketHandler()); + + ConfigHandler.reloadConfig(); + + // For golden enchants + t6Enchants.put("9Angler VI", "6Angler VI"); + t6Enchants.put("9Bane of Arthropods VI", "6Bane of Arthropods VI"); + t6Enchants.put("9Caster VI", "6Caster VI"); + t6Enchants.put("9Compact X", "6Compact X"); + t6Enchants.put("9Critical VI", "6Critical VI"); + t6Enchants.put("9Dragon Hunter V", "6Dragon Hunter V"); + t6Enchants.put("9Efficiency VI", "6Efficiency VI"); + t6Enchants.put("9Ender Slayer VI", "6Ender Slayer VI"); + t6Enchants.put("9Experience IV", "6Experience IV"); + t6Enchants.put("9Expertise X", "6Expertise X"); + t6Enchants.put("9Feather Falling X", "6Feather Falling X"); + t6Enchants.put("9Frail VI", "6Frail VI"); + t6Enchants.put("9Giant Killer VI", "6Giant Killer VI"); + t6Enchants.put("9Growth VI", "6Growth VI"); + t6Enchants.put("9Infinite Quiver X", "6Infinite Quiver X"); + t6Enchants.put("9Lethality VI", "6Lethality VI"); + t6Enchants.put("9Life Steal IV", "6Life Steal IV"); + t6Enchants.put("9Looting IV", "6Looting IV"); + t6Enchants.put("9Luck VI", "6Luck VI"); + t6Enchants.put("9Luck of the Sea VI", "6Luck of the Sea VI"); + t6Enchants.put("9Lure VI", "6Lure VI"); + t6Enchants.put("9Magnet VI", "6Magnet VI"); + t6Enchants.put("9Overload V", "6Overload V"); + t6Enchants.put("9Power VI", "6Power VI"); + t6Enchants.put("9Protection VI", "6Protection VI"); + t6Enchants.put("9Scavenger IV", "6Scavenger IV"); + t6Enchants.put("9Scavenger V", "6Scavenger V"); + t6Enchants.put("9Sharpness VI", "6Sharpness VI"); + t6Enchants.put("9Smite VI", "6Smite VI"); + t6Enchants.put("9Spiked Hook VI", "6Spiked Hook VI"); + t6Enchants.put("9Thunderlord VI", "6Thunderlord VI"); + t6Enchants.put("9Vampirism VI", "6Vampirism VI"); + + triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); + triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); + triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); + triviaSolutions.put("What is the status of The Professor?", new String[]{"Professor"}); + triviaSolutions.put("What is the status of Thorn?", new String[]{"Shaman Necromancer"}); + triviaSolutions.put("What is the status of Livid?", new String[]{"Master Necromancer"}); + triviaSolutions.put("What is the status of Sadan?", new String[]{"Necromancer Lord"}); + triviaSolutions.put("What is the status of Maxor?", new String[]{"Young Wither"}); + triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); + triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); + triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"220 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Hub?", new String[]{"79 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Deep Caverns?", new String[]{"21 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Gold Mine?", new String[]{"12 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in Dungeon Hub?", new String[]{"7 Fairy Souls"}); + triviaSolutions.put("Which brother is on the Spider's Den?", new String[]{"Rick"}); + triviaSolutions.put("What is the name of Rick's brother?", new String[]{"Pat"}); + triviaSolutions.put("What is the name of the Painter in the Hub?", new String[]{"Marco"}); + triviaSolutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); + triviaSolutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); + triviaSolutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); + triviaSolutions.put("How many unique minions are there?", new String[]{"53 Minions"}); + triviaSolutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", + "Dashing Spooder", "Broodfather", "Night Spider"}); + triviaSolutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); + triviaSolutions.put("Which of these is not a dragon in The End?", new String[]{"Zoomer Dragon", "Weak Dragon", "Stonk Dragon", "Holy Dragon", "Boomer Dragon", + "Booger Dragon", "Older Dragon", "Elder Dragon", "Stable Dragon", "Professor Dragon"}); + + String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; + t6EnchantPattern = Pattern.compile(patternString); + + keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); + keyBindings[1] = new KeyBinding("Regular Ability", Keyboard.KEY_NUMPAD4, "Danker's Skyblock Mod"); + keyBindings[2] = new KeyBinding("Start/Stop Skill Tracker", Keyboard.KEY_NUMPAD5, "Danker's Skyblock Mod"); + + for (KeyBinding keyBinding : keyBindings) { + ClientRegistry.registerKeyBinding(keyBinding); + } } - + @EventHandler public void preInit(final FMLPreInitializationEvent event) { ClientCommandHandler.instance.registerCommand(new ToggleCommand()); @@ -280,74 +312,282 @@ public class DankersSkyblockMod ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); - ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); + ClientCommandHandler.instance.registerCommand(new FairySoulsCommand()); } - + @EventHandler public void postInit(final FMLPostInitializationEvent event) { + Package[] packages = Package.getPackages(); + for(Package p : packages){ + if(p.getName().startsWith("com.spiderfrog.gadgets") || p.getName().startsWith("com.spiderfrog.oldanimations")){ + usingOAM = true; + } + } + System.out.println("OAM detection: " + usingOAM); + usingLabymod = Loader.isModLoaded("labymod"); System.out.println("LabyMod detection: " + usingLabymod); + + if(!ClientCommandHandler.instance.getCommands().containsKey("reparty")) { + ClientCommandHandler.instance.registerCommand(new RepartyCommand()); + } else if (ConfigHandler.getBoolean("commands", "reparty")) { + for(Map.Entry<String, ICommand> entry : ClientCommandHandler.instance.getCommands().entrySet()) { + if (entry.getKey().equals("reparty") || entry.getKey().equals("rp")) { + entry.setValue(new RepartyCommand()); + } + } + } + } - + + @SubscribeEvent + public void onGuiOpenEvent(GuiOpenEvent event){ + if(event.gui instanceof GuiMainMenu && usingOAM && !OAMWarning){ + if(!(event.gui instanceof WarningGui)){ + event.gui = new WarningGuiRedirect(new WarningGui()); + OAMWarning = true; + } + } + } + // Update checker @SubscribeEvent public void onJoin(EntityJoinWorldEvent event) { - if (!updateChecked) { - updateChecked = true; - - // MULTI THREAD DRIFTING - new Thread(() -> { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - - 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(); - DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(VERSION); - DefaultArtifactVersion latestVersion = new DefaultArtifactVersion(latestTag.substring(1)); - - if (currentVersion.compareTo(latestVersion) < 0) { - String releaseURL = latestRelease.get("html_url").getAsString(); - - ChatComponentText update = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [UPDATE] "); - update.setChatStyle(update.getChatStyle().setChatClickEvent(new ClickEvent(Action.OPEN_URL, releaseURL))); - - try { - Thread.sleep(2000); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - player.addChatMessage(new ChatComponentText(ERROR_COLOUR + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); - } - }).start(); - } + + if (firstLaunch) { + firstLaunch = false; + ConfigHandler.writeBooleanConfig("misc", "firstLaunch", false); + + IChatComponent chatComponent = new ChatComponentText( + EnumChatFormatting.GOLD + "Thank you for downloading Danker's Skyblock Mod.\n" + + "To get started, run the command " + EnumChatFormatting.GOLD + "/dsm" + EnumChatFormatting.RESET + " to view all the mod features." + ); + chatComponent.setChatStyle(chatComponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("Click to open the DSM menu."))).setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, "/dsm"))); + + new Thread(() -> { + while (true) { + if (Minecraft.getMinecraft().thePlayer == null) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + continue; + } + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft.getMinecraft().thePlayer.addChatMessage(chatComponent); + break; + } + }).start(); + } + + if (!updateChecked) { + updateChecked = true; + + // MULTI THREAD DRIFTING + new Thread(() -> { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + + 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(); + DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(VERSION); + DefaultArtifactVersion latestVersion = new DefaultArtifactVersion(latestTag.substring(1)); + + if (currentVersion.compareTo(latestVersion) < 0) { + String releaseURL = latestRelease.get("html_url").getAsString(); + + ChatComponentText update = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [UPDATE] "); + update.setChatStyle(update.getChatStyle().setChatClickEvent(new ClickEvent(Action.OPEN_URL, releaseURL))); + + try { + Thread.sleep(2000); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + player.addChatMessage(new ChatComponentText(ERROR_COLOUR + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update)); + } + }).start(); + } } - + @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { - foundLivid = false; - livid = null; + riddleChest = null; + foundLivid = false; + livid = null; + lowestBlaze = null; + highestBlaze = null; + nextBonzoUse = 0; } - + // It randomly broke, so I had to make it the highest priority @SubscribeEvent(priority = EventPriority.HIGHEST) public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - + + if (message.startsWith("Your new API key is ") && Utils.isOnHypixel()) { + String apiKey = event.message.getSiblings().get(0).getChatStyle().getChatClickEvent().getValue(); + ConfigHandler.writeStringConfig("api", "APIKey", apiKey); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Set API key to " + DankersSkyblockMod.SECONDARY_COLOUR + apiKey)); + } + + // Reparty command + // Getting party + if (RepartyCommand.gettingParty) { + if (message.contains("-----")) { + switch(RepartyCommand.Delimiter) { + case 0: + System.out.println("Get Party Delimiter Cancelled"); + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; + case 1: + System.out.println("Done querying party"); + RepartyCommand.gettingParty = false; + RepartyCommand.Delimiter = 0; + event.setCanceled(true); + return; + } + }else if (message.startsWith("Party M") || message.startsWith("Party Leader")){ + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + + Pattern party_start_pattern = Pattern.compile("^Party Members \\((\\d+)\\)$"); + Pattern leader_pattern = Pattern.compile("^Party Leader: (?:\\[.+?] )?(\\w+) ●$"); + Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); + Matcher party_start = party_start_pattern.matcher(message); + Matcher leader = leader_pattern.matcher(message); + Matcher members = members_pattern.matcher(message); + + if (party_start.matches() && Integer.parseInt(party_start.group(1)) == 1) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You cannot reparty yourself.")); + RepartyCommand.partyThread.interrupt(); + } else if (leader.matches() && !(leader.group(1).equals(player.getName()))) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You are not party leader.")); + RepartyCommand.partyThread.interrupt(); + } else { + while (members.find()) { + String partyMember = members.group(1); + if (!partyMember.equals(player.getName())) { + RepartyCommand.party.add(partyMember); + System.out.println(partyMember); + } + } + } + event.setCanceled(true); + return; + } + } + // Disbanding party + if (RepartyCommand.disbanding) { + if (message.contains("-----")) { + switch (RepartyCommand.Delimiter) { + case 0: + System.out.println("Disband Delimiter Cancelled"); + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; + case 1: + System.out.println("Done disbanding"); + RepartyCommand.disbanding = false; + RepartyCommand.Delimiter = 0; + event.setCanceled(true); + return; + } + } else if (message.endsWith("has disbanded the party!")) { + event.setCanceled(true); + return; + } + } + // Inviting + if (RepartyCommand.inviting) { + if (message.contains("-----")) { + switch (RepartyCommand.Delimiter) { + case 1: + event.setCanceled(true); + RepartyCommand.Delimiter = 0; + System.out.println("Player Invited!"); + RepartyCommand.inviting = false; + return; + case 0: |
