diff options
Diffstat (limited to 'src/main/java/me/Danker/DankersSkyblockMod.java')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 211 |
1 files changed, 164 insertions, 47 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index ee24b84..980fddc 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -1,16 +1,16 @@ package me.Danker; +import com.google.gson.JsonObject; import me.Danker.commands.*; -import me.Danker.events.ChestSlotClickedEvent; -import me.Danker.events.GuiChestBackgroundDrawnEvent; -import me.Danker.events.RenderOverlay; +import me.Danker.commands.warp.WarpCommandHandler; +import me.Danker.events.*; import me.Danker.features.*; -import me.Danker.features.loot.LootDisplay; -import me.Danker.features.loot.LootTracker; +import me.Danker.features.loot.*; import me.Danker.features.puzzlesolvers.*; import me.Danker.gui.*; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; +import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -57,23 +57,36 @@ import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import java.io.IOException; import java.util.List; +import java.util.Locale; import java.util.Map; @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.6"; + public static final String VERSION = "1.8.7"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; public static int tickAmount = 1; - public static KeyBinding[] keyBindings = new KeyBinding[3]; + public static int repoTickAmount = 1; + public static KeyBinding[] keyBindings = new KeyBinding[4]; public static boolean usingLabymod = false; public static boolean usingOAM = false; static boolean OAMWarning = false; public static String guiToOpen = null; public static boolean firstLaunch = false; public static String configDirectory; + public static JsonObject data = null; + public static WarpCommandHandler warpCommandHandler; + + public static int farmingLevel; + public static int miningLevel; + public static int combatLevel; + public static int foragingLevel; + public static int fishingLevel; + public static int enchantingLevel; + public static int alchemyLevel; + public static int carpentryLevel; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -87,34 +100,56 @@ public class DankersSkyblockMod { @EventHandler public void init(FMLInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new AbilityCooldowns()); + MinecraftForge.EVENT_BUS.register(new Alerts()); MinecraftForge.EVENT_BUS.register(new ArachneESP()); + MinecraftForge.EVENT_BUS.register(new ArrowTerminalSolver()); + MinecraftForge.EVENT_BUS.register(new AutoAcceptReparty()); MinecraftForge.EVENT_BUS.register(new AutoDisplay()); + MinecraftForge.EVENT_BUS.register(new AutoJoinSkyblock()); MinecraftForge.EVENT_BUS.register(new AutoSwapToPickBlock()); MinecraftForge.EVENT_BUS.register(new BlazeSolver()); + MinecraftForge.EVENT_BUS.register(new BlockPlacingFlowers()); + MinecraftForge.EVENT_BUS.register(new BlockWrongSlayer()); + MinecraftForge.EVENT_BUS.register(new BlockWrongTerminalClicks()); MinecraftForge.EVENT_BUS.register(new BonzoMaskTimer()); MinecraftForge.EVENT_BUS.register(new BoulderSolver()); MinecraftForge.EVENT_BUS.register(new CakeTimer()); + MinecraftForge.EVENT_BUS.register(new ChatAliases()); MinecraftForge.EVENT_BUS.register(new ChronomatronSolver()); MinecraftForge.EVENT_BUS.register(new ClickInOrderSolver()); + MinecraftForge.EVENT_BUS.register(new ColouredNames()); MinecraftForge.EVENT_BUS.register(new CreeperSolver()); + MinecraftForge.EVENT_BUS.register(new CrystalHollowWaypoints()); MinecraftForge.EVENT_BUS.register(new CustomMusic()); + MinecraftForge.EVENT_BUS.register(new DungeonScore()); MinecraftForge.EVENT_BUS.register(new DungeonTimer()); + MinecraftForge.EVENT_BUS.register(new EndOfFarmAlert()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); + MinecraftForge.EVENT_BUS.register(new FilletMagmafish()); + MinecraftForge.EVENT_BUS.register(new FirePillarDisplay()); + MinecraftForge.EVENT_BUS.register(new FishingSpawnAlerts()); + MinecraftForge.EVENT_BUS.register(new GemstonesLore()); + MinecraftForge.EVENT_BUS.register(new GiantHPDisplay()); MinecraftForge.EVENT_BUS.register(new GoldenEnchants()); MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert()); MinecraftForge.EVENT_BUS.register(new GpartyNotifications()); + MinecraftForge.EVENT_BUS.register(new HidePetCandy()); + MinecraftForge.EVENT_BUS.register(new HidePlayerArmour()); MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments()); + MinecraftForge.EVENT_BUS.register(new HighlightCommissions()); + MinecraftForge.EVENT_BUS.register(new HighlightSkeletonMasters()); MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); MinecraftForge.EVENT_BUS.register(new LividSolver()); - MinecraftForge.EVENT_BUS.register(new LootDisplay()); - MinecraftForge.EVENT_BUS.register(new LootTracker()); MinecraftForge.EVENT_BUS.register(new LowHealthNotifications()); + MinecraftForge.EVENT_BUS.register(new MinionLastCollected()); MinecraftForge.EVENT_BUS.register(new NecronNotifications()); MinecraftForge.EVENT_BUS.register(new NoF3Coords()); MinecraftForge.EVENT_BUS.register(new NotifySlayerSlain()); MinecraftForge.EVENT_BUS.register(new PetColours()); MinecraftForge.EVENT_BUS.register(new Reparty()); + MinecraftForge.EVENT_BUS.register(new SameColourSolver()); MinecraftForge.EVENT_BUS.register(new SelectAllColourSolver()); MinecraftForge.EVENT_BUS.register(new SilverfishSolver()); MinecraftForge.EVENT_BUS.register(new Skill50Display()); @@ -122,9 +157,11 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new SlayerESP()); MinecraftForge.EVENT_BUS.register(new SpamHider()); MinecraftForge.EVENT_BUS.register(new SpiritBearAlert()); + MinecraftForge.EVENT_BUS.register(new SpiritBootsFix()); MinecraftForge.EVENT_BUS.register(new StartsWithSolver()); MinecraftForge.EVENT_BUS.register(new StopSalvagingStarredItems()); MinecraftForge.EVENT_BUS.register(new SuperpairsSolver()); + MinecraftForge.EVENT_BUS.register(new TetherDisplay()); MinecraftForge.EVENT_BUS.register(new ThreeManSolver()); MinecraftForge.EVENT_BUS.register(new TicTacToeSolver()); MinecraftForge.EVENT_BUS.register(new TriviaSolver()); @@ -133,47 +170,73 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new WatcherReadyAlert()); MinecraftForge.EVENT_BUS.register(new WaterSolver()); + MinecraftForge.EVENT_BUS.register(new LootDisplay()); + MinecraftForge.EVENT_BUS.register(new LootTracker()); + MinecraftForge.EVENT_BUS.register(new BlazeTracker()); + MinecraftForge.EVENT_BUS.register(new CatacombsTracker()); + MinecraftForge.EVENT_BUS.register(new EndermanTracker()); + MinecraftForge.EVENT_BUS.register(new FishingTracker()); + MinecraftForge.EVENT_BUS.register(new GhostTracker()); + MinecraftForge.EVENT_BUS.register(new MythologicalTracker()); + MinecraftForge.EVENT_BUS.register(new SpiderTracker()); + MinecraftForge.EVENT_BUS.register(new TrophyFishTracker()); + MinecraftForge.EVENT_BUS.register(new WolfTracker()); + MinecraftForge.EVENT_BUS.register(new ZombieTracker()); + + MinecraftForge.EVENT_BUS.post(new ModInitEvent(configDirectory)); ConfigHandler.reloadConfig(); - GoldenEnchants.init(); - TriviaSolver.init(); - CustomMusic.init(configDirectory); + MinecraftForge.EVENT_BUS.post(new PostConfigInitEvent(configDirectory)); 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"); + keyBindings[3] = new KeyBinding("Create Waypoint", Keyboard.KEY_NUMPAD6, "Danker's Skyblock Mod"); for (KeyBinding keyBinding : keyBindings) { ClientRegistry.registerKeyBinding(keyBinding); } + + new Thread(Utils::refreshRepo).start(); } @EventHandler public void preInit(final FMLPreInitializationEvent event) { ClientCommandHandler.instance.registerCommand(new ArmourCommand()); ClientCommandHandler.instance.registerCommand(new BankCommand()); + ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); + ClientCommandHandler.instance.registerCommand(new CrystalHollowWaypointCommand()); ClientCommandHandler.instance.registerCommand(new CustomMusicCommand()); - ClientCommandHandler.instance.registerCommand(new DHelpCommand()); ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new DHelpCommand()); ClientCommandHandler.instance.registerCommand(new DisplayCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(new FarmLengthCommand()); ClientCommandHandler.instance.registerCommand(new GetkeyCommand()); ClientCommandHandler.instance.registerCommand(new GuildOfCommand()); + ClientCommandHandler.instance.registerCommand(new HOTMCommand()); + ClientCommandHandler.instance.registerCommand(new HOTMTreeCommand()); ClientCommandHandler.instance.registerCommand(new ImportFishingCommand()); + ClientCommandHandler.instance.registerCommand(new InventoryCommand()); ClientCommandHandler.instance.registerCommand(new LobbyBankCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); ClientCommandHandler.instance.registerCommand(new LootCommand()); ClientCommandHandler.instance.registerCommand(new MoveCommand()); ClientCommandHandler.instance.registerCommand(new PetsCommand()); + ClientCommandHandler.instance.registerCommand(new PlayerCommand()); ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); + ClientCommandHandler.instance.registerCommand(new ReloadRepoCommand()); ClientCommandHandler.instance.registerCommand(new ResetLootCommand()); ClientCommandHandler.instance.registerCommand(new ScaleCommand()); ClientCommandHandler.instance.registerCommand(new SetkeyCommand()); - ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); ClientCommandHandler.instance.registerCommand(new SkillsCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand()); ClientCommandHandler.instance.registerCommand(new SlayerCommand()); ClientCommandHandler.instance.registerCommand(new ToggleCommand()); + ClientCommandHandler.instance.registerCommand(new WeightCommand()); + + warpCommandHandler = new WarpCommandHandler(); configDirectory = event.getModConfigurationDirectory().toString(); } @@ -248,12 +311,47 @@ public class DankersSkyblockMod { @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { - String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + 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)); + } else if (Utils.inSkyblock && !message.contains(":") && message.contains(" SKILL LEVEL UP ")) { + // Handle skill level ups + String skill = message.substring(message.indexOf("UP") + 3, message.lastIndexOf(" ")); + int level = Utils.getIntFromString(message.substring(message.indexOf("➜") + 1), true); + + switch (skill) { + case "Farming": + DankersSkyblockMod.farmingLevel = level; + break; + case "Mining": + DankersSkyblockMod.miningLevel = level; + break; + case "Combat": + DankersSkyblockMod.combatLevel = level; + break; + case "Foraging": + DankersSkyblockMod.foragingLevel = level; + break; + case "Fishing": + DankersSkyblockMod.fishingLevel = level; + break; + case "Enchanting": + DankersSkyblockMod.enchantingLevel = level; + break; + case "Alchemy": + DankersSkyblockMod.alchemyLevel = level; + break; + case "Carpentry": + DankersSkyblockMod.carpentryLevel = level; + break; + default: + System.err.println("Unknown skill leveled up."); + } + + ConfigHandler.writeIntConfig("skills", skill.toLowerCase(Locale.US), level); } } @@ -263,7 +361,7 @@ public class DankersSkyblockMod { if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE && event.type != RenderGameOverlayEvent.ElementType.JUMPBAR) return; if (Minecraft.getMinecraft().currentScreen instanceof EditLocationsGui) return; - MinecraftForge.EVENT_BUS.post(new RenderOverlay()); + MinecraftForge.EVENT_BUS.post(new RenderOverlayEvent()); } // LabyMod Support @@ -272,13 +370,13 @@ public class DankersSkyblockMod { if (!usingLabymod) return; if (event.type != null) return; if (Minecraft.getMinecraft().currentScreen instanceof EditLocationsGui) return; - MinecraftForge.EVENT_BUS.post(new RenderOverlay()); + MinecraftForge.EVENT_BUS.post(new RenderOverlayEvent()); } @SubscribeEvent - public void renderPlayerInfo(RenderOverlay event) { + public void renderPlayerInfo(RenderOverlayEvent event) { if (showTitle) { - Utils.drawTitle(titleText); + RenderUtils.drawTitle(titleText); } } @@ -286,24 +384,55 @@ public class DankersSkyblockMod { public void onTick(TickEvent.ClientTickEvent event) { if (event.phase != Phase.START) return; - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; tickAmount++; if (tickAmount % 20 == 0) { + repoTickAmount++; if (player != null) { Utils.checkForSkyblock(); Utils.checkForDungeons(); + Utils.checkForDungeonFloor(); + Utils.checkTabLocation(); } tickAmount = 0; } + if (repoTickAmount % 3601 == 0) { + // I didn't want to change everything so I just made a new tick variable + new Thread(Utils::refreshRepo).start(); + repoTickAmount = 1; + } + if (titleTimer >= 0) { if (titleTimer == 0) { showTitle = false; } titleTimer--; } + + // New skill level detection + if (mc.currentScreen instanceof GuiChest && tickAmount % 5 == 0 && player != null) { + ContainerChest chest = (ContainerChest) player.openContainer; + String chestName = chest.getLowerChestInventory().getDisplayName().getUnformattedText().trim(); + + if (chestName.equals("Your Skills")) { + List<Slot> invSlots = ((GuiChest) mc.currentScreen).inventorySlots.inventorySlots; + + farmingLevel = Utils.initializeSkill(invSlots.get(19).getStack(), "farming"); + miningLevel = Utils.initializeSkill(invSlots.get(20).getStack(), "mining"); + combatLevel = Utils.initializeSkill(invSlots.get(21).getStack(), "combat"); + foragingLevel = Utils.initializeSkill(invSlots.get(22).getStack(), "foraging"); + fishingLevel = Utils.initializeSkill(invSlots.get(23).getStack(), "fishing"); + enchantingLevel = Utils.initializeSkill(invSlots.get(24).getStack(), "enchanting"); + alchemyLevel = Utils.initializeSkill(invSlots.get(25).getStack(), "alchemy"); + carpentryLevel = Utils.initializeSkill(invSlots.get(29).getStack(), "carpentry"); + + System.out.println("Updated skill levels."); + } + } } // Delay GUI by 1 tick @@ -319,20 +448,11 @@ public class DankersSkyblockMod { case "displaygui": mc.displayGuiScreen(new DisplayGui()); break; - case "editlocations": - mc.displayGuiScreen(new EditLocationsGui()); + case "inventory": + mc.displayGuiScreen(InventoryCommand.chest); break; - case "puzzlesolvers": - mc.displayGuiScreen(new PuzzleSolversGui(1)); - break; - case "experimentsolvers": - mc.displayGuiScreen(new ExperimentsGui()); - break; - case "skilltracker": - mc.displayGuiScreen(new SkillTrackerGui()); - break; - case "custommusic": - mc.displayGuiScreen(new CustomMusicGui()); + case "hotminventory": + mc.displayGuiScreen(HOTMTreeCommand.chest); break; } } @@ -342,23 +462,23 @@ public class DankersSkyblockMod { @SubscribeEvent public void onKey(KeyInputEvent event) { - if (!Utils.inSkyblock) return; - - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - if (keyBindings[1].isPressed()) { - if (Utils.inDungeons) { - player.dropOneItem(true); - } - } + if (!Utils.inDungeons) return; + if (keyBindings[1].isPressed()) Minecraft.getMinecraft().thePlayer.dropOneItem(true); } @SubscribeEvent public void onGuiMouseInputPre(GuiScreenEvent.MouseInputEvent.Pre event) { - if (!Utils.inSkyblock) return; 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 == InventoryCommand.chest || event.gui == HOTMTreeCommand.chest) { + event.setCanceled(true); + return; + } + + if (!Utils.inSkyblock) return; + if (event.gui instanceof GuiChest) { Container containerChest = ((GuiChest) event.gui).inventorySlots; if (containerChest instanceof ContainerChest) { @@ -369,11 +489,8 @@ public class DankersSkyblockMod { if (slot == null) return; ItemStack item = slot.getStack(); String inventoryName = inventory.getDisplayName().getUnformattedText(); - if (item == null) { - if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot))) event.setCanceled(true); - } else { - if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot, item))) event.setCanceled(true); - } + + if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot, item))) event.setCanceled(true); } } } |