diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-10-09 10:54:39 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-10-09 10:54:39 -0400 |
commit | 68111a9d9c9d403436dc2041010f337580d48d60 (patch) | |
tree | fa66b56133e317b08f60c4e84d556c3ec70e1f98 | |
parent | 5d477d9d06933c7a52ea5df17160b89391387872 (diff) | |
download | SkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.tar.gz SkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.tar.bz2 SkyblockMod-68111a9d9c9d403436dc2041010f337580d48d60.zip |
Add GUI: /dsm
No GUI for moving or scaling displays yet
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 29 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DHelpCommand.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DankerGuiCommand.java | 32 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 194 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DisplayGui.java | 155 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 112 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/OnlySlayerGui.java | 129 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 5 |
9 files changed, 657 insertions, 1 deletions
@@ -29,6 +29,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/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. diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 5af08ac..f7b7763 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -21,6 +21,7 @@ import me.Danker.commands.BankCommand; import me.Danker.commands.BlockSlayerCommand; import me.Danker.commands.ChatMaddoxCommand; 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; @@ -38,6 +39,10 @@ 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.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; @@ -56,7 +61,6 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; @@ -106,6 +110,7 @@ public class TheMod static KeyBinding[] keyBindings = new KeyBinding[1]; static int lastMouse = -1; static boolean usingLabymod = false; + public static String guiToOpen = null; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -187,6 +192,7 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); + ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); } @EventHandler @@ -974,6 +980,8 @@ public class TheMod final MoveCommand moc = new MoveCommand(); final DisplayCommand ds = new DisplayCommand(); + if (Minecraft.getMinecraft().currentScreen instanceof EditLocationsGui) return; + if (tc.coordsToggled) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; @@ -1849,6 +1857,25 @@ public class TheMod } } + // Delay GUI by 1 tick + @SubscribeEvent + public void onRenderTick(TickEvent.RenderTickEvent event) { + if (guiToOpen != null) { + Minecraft mc = Minecraft.getMinecraft(); + if (guiToOpen.startsWith("dankergui")) { + int page = Character.getNumericValue(guiToOpen.charAt(guiToOpen.length() - 1)); + mc.displayGuiScreen(new DankerGui(page)); + } else if (guiToOpen.equals("displaygui")) { + mc.displayGuiScreen(new DisplayGui()); + } else if (guiToOpen.equals("onlyslayergui")) { + mc.displayGuiScreen(new OnlySlayerGui()); + } else if (guiToOpen.equals("editlocations")) { + mc.displayGuiScreen(new EditLocationsGui()); + } + guiToOpen = null; + } + } + @SubscribeEvent public void onInteract(PlayerInteractEvent event) { if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 57cffa3..32b7d4b 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -33,6 +33,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" + EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/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" + diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java new file mode 100644 index 0000000..ef39d24 --- /dev/null +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -0,0 +1,32 @@ +package me.Danker.commands; + +import me.Danker.TheMod; +import me.Danker.gui.DankerGui; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; + +public class DankerGuiCommand extends CommandBase { + + @Override + public String getCommandName() { + return "dsm"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return null; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + TheMod.guiToOpen = "dankergui1"; + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java new file mode 100644 index 0000000..502bcb6 --- /dev/null +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -0,0 +1,194 @@ +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.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.GuiConfirmOpenLink; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class DankerGui extends GuiScreen { + + private int page; + + private GuiButton closeGUI; + private GuiButton backPage; + private GuiButton nextPage; + private GuiButton githubLink; + private GuiButton discordLink; + private GuiButton changeDisplay; + private GuiButton onlySlayer; + // Toggles + private GuiButton gparty; + private GuiButton coords; + private GuiButton goldenEnch; + private GuiButton slayerCount; + private GuiButton rngesusAlert; + private GuiButton splitFishing; + private GuiButton chatMaddox; + private GuiButton spiritBearAlert; + private GuiButton aotd; + private GuiButton sceptreMessages; + private GuiButton petColours; + private GuiButton dungeonTimer; + private GuiButton golemAlerts; + private GuiButton expertiseLore; + private GuiButton skill50Display; + private GuiButton outlineText; + + public DankerGui(int page) { + this.page = page; + } + + @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(); + + // Default button size is 200, 20 + closeGUI = new GuiButton(0, width / 2 - 100, (int) (height * 0.9), "Close"); + 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 >"); + githubLink = new GuiButton(0, 2, height - 50, 80, 20, "GitHub"); + discordLink = new GuiButton(0, 2, height - 30, 80, 20, "Discord"); + + // Page 1 + 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"); + outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); + // Page 2 + aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); + + if (page == 1) { + this.buttonList.add(changeDisplay); + this.buttonList.add(onlySlayer); + this.buttonList.add(outlineText); + this.buttonList.add(gparty); + this.buttonList.add(coords); + this.buttonList.add(goldenEnch); + this.buttonList.add(slayerCount); + this.buttonList.add(nextPage); + this.buttonList.add(closeGUI); + } else if (page == 2) { + this.buttonList.add(aotd); + this.buttonList.add(sceptreMessages); + this.buttonList.add(petColours); + this.buttonList.add(dungeonTimer); + this.buttonList.add(golemAlerts); + this.buttonList.add(expertiseLore); + this.buttonList.add(skill50Display); + this.buttonList.add(backPage); + this.buttonList.add(closeGUI); + } + this.buttonList.add(githubLink); + this.buttonList.add(discordLink); + } + + @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 == closeGUI) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + } else if (button == nextPage) { + TheMod.guiToOpen = "dankergui" + (page + 1); + } else if (button == backPage) { + TheMod.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); + } + } else if (button == discordLink) { + try { + Desktop.getDesktop().browse(new URI("https://discord.gg/QsEkNQS")); + } catch (IOException | URISyntaxException ex) { + System.err.println(ex); + } + } else if (button == changeDisplay) { + TheMod.guiToOpen = "displaygui"; + } else if (button == onlySlayer) { + TheMod.guiToOpen = "onlyslayergui"; + } else if (button == outlineText) { + ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; + ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); + outlineText.displayString = "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled); + } else if (button == gparty) { + ToggleCommand.gpartyToggled = !ToggleCommand.gpartyToggled; + ConfigHandler.writeBooleanConfig("toggles", "GParty", ToggleCommand.gpartyToggled); + gparty.displayString = "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled); + } else if (button == coords) { + ToggleCommand.coordsToggled = !ToggleCommand.coordsToggled; + ConfigHandler.writeBooleanConfig("toggles", "Coords", ToggleCommand.coordsToggled); + coords.displayString = "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled); + } else if (button == goldenEnch) { + ToggleCommand.goldenToggled = !ToggleCommand.goldenToggled; + ConfigHandler.writeBooleanConfig("toggles", "Golden", ToggleCommand.goldenToggled); + goldenEnch.displayString = "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled); + } else if (button == slayerCount) { + ToggleCommand.slayerCountTotal = !ToggleCommand.slayerCountTotal; + ConfigHandler.writeBooleanConfig("toggles", "SlayerCount", ToggleCommand.slayerCountTotal); + slayerCount.displayString = "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal); + } else if (button == aotd) { + ToggleCommand.aotdToggled = !ToggleCommand.aotdToggled; + ConfigHandler.writeBooleanConfig("toggles", "AOTD", ToggleCommand.aotdToggled); + aotd.displayString = "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled); + } else if (button == sceptreMessages) { + ToggleCommand.sceptreMessages = !ToggleCommand.sceptreMessages; + ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", ToggleCommand.sceptreMessages); + sceptreMessages.displayString = "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages); + } else if (button == petColours) { + ToggleCommand.petColoursToggled = !ToggleCommand.petColoursToggled; + ConfigHandler.writeBooleanConfig("toggles", "PetColors", ToggleCommand.petColoursToggled); + petColours.displayString = "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled); + } else if (button == dungeonTimer) { + ToggleCommand.dungeonTimerToggled = !ToggleCommand.dungeonTimerToggled; + ConfigHandler.writeBooleanConfig("toggles", "DungeonTimer", ToggleCommand.dungeonTimerToggled); + dungeonTimer.displayString = "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled); + } else if (button == golemAlerts) { + ToggleCommand.golemAlertToggled = !ToggleCommand.golemAlertToggled; + ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", ToggleCommand.golemAlertToggled); + golemAlerts.displayString = "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled); + } else if (button == expertiseLore) { + ToggleCommand.expertiseLoreToggled = !ToggleCommand.expertiseLoreToggled; + ConfigHandler.writeBooleanConfig("toggles", "ExpertiseLore", ToggleCommand.expertiseLoreToggled); + expertiseLore.displayString = "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled); + } else if (button == skill50Display) { + ToggleCommand.skill50DisplayToggled = !ToggleCommand.skill50DisplayToggled; + ConfigHandler.writeBooleanConfig("toggles", "Skill50Display", ToggleCommand.skill50DisplayToggled); + skill50Display.displayString = "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java new file mode 100644 index 0000000..d71f4b9 --- /dev/null +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -0,0 +1,155 @@ +package me.Danker.gui; + +import me.Danker.TheMod; +import me.Danker.commands.DisplayCommand; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +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 DisplayGui extends GuiScreen { + + private boolean addSession = false; + + private GuiButton goBack; + //private GuiButton editLocations; + private GuiButton off; + private GuiButton showSession; + private GuiButton zombie; + private GuiButton spider; + private GuiButton wolf; + private GuiButton auto; + private GuiButton fishing; + private GuiButton fishingWinter; + private GuiButton fishingFestival; + private GuiButton catacombsF1; + private GuiButton catacombsF2; + private GuiButton catacombsF3; + private GuiButton catacombsF4; + private GuiButton catacombsF5; + private GuiButton catacombsF6; + + @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"); + //editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); + showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); + off = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Off"); + zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 80, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 90, (int) (height * 0.3), 80, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 10, (int) (height * 0.3), 80, 20, "Wolf"); + auto = new GuiButton(0, width / 2 + 110, (int) (height * 0.3), 80, 20, "Auto"); + fishing = new GuiButton(0, width / 2 - 190, (int) (height * 0.4), 110, 20, "Fishing"); + fishingWinter = new GuiButton(0, width / 2 - 55, (int) (height * 0.4), 110, 20, "Fishing Winter"); + fishingFestival = new GuiButton(0, width / 2 + 75, (int) (height * 0.4), 110, 20, "Fishing Festival"); + catacombsF1 = new GuiButton(0, width / 2 - 145, (int) (height * 0.55), 50, 20, "F1"); + catacombsF2 = new GuiButton(0, width / 2 - 85, (int) (height * 0.55), 50, 20, "F2"); + catacombsF3 = new GuiButton(0, width / 2 - 25, (int) (height * 0.55), 50, 20, "F3"); + catacombsF4 = new GuiButton(0, width / 2 + 35, (int) (height * 0.55), 50, 20, "F4"); + catacombsF5 = new GuiButton(0, width / 2 + 95, (int) (height * 0.55), 50, 20, "F5"); + catacombsF6 = new GuiButton(0, width / 2 - 145, (int) (height * 0.63), 50, 20, "F6"); + + this.buttonList.add(showSession); + this.buttonList.add(off); + this.buttonList.add(zombie); + this.buttonList.add(spider); + this.buttonList.add(wolf); + this.buttonList.add(auto); + this.buttonList.add(fishing); + this.buttonList.add(fishingWinter); + this.buttonList.add(fishingFestival); + this.buttonList.add(catacombsF1); + this.buttonList.add(catacombsF2); + this.buttonList.add(catacombsF3); + this.buttonList.add(catacombsF4); + this.buttonList.add(catacombsF5); + this.buttonList.add(catacombsF6); + //this.buttonList.add(editLocations); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + Minecraft mc = Minecraft.getMinecraft(); + + String displayText; + if (DisplayCommand.auto) { + displayText = "Current Display: auto"; + } else { + displayText = "Current Display: " + DisplayCommand.display; + } + int displayWidth = mc.fontRendererObj.getStringWidth(displayText); + new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + + String catacombsTitleText = "Catacombs Dungeon"; + int catacombsTitleWidth = mc.fontRendererObj.getStringWidth(catacombsTitleText); + new TextRenderer(mc, catacombsTitleText, width / 2 - catacombsTitleWidth / 2, (int) (height * 0.5), 1D); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + TheMod.guiToOpen = "dankergui1"; + //} else if (button == editLocations) { + //TheMod.guiToOpen = "editlocations"; + } else if (button == showSession) { + addSession = !addSession; + showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); + } else if (button == off) { + setDisplay("off", true); + } else if (button == zombie) { + setDisplay("zombie", false); + } else if (button == spider) { + setDisplay("spider", false); + } else if (button == wolf) { + setDisplay("wolf", false); + } else if (button == auto) { + DisplayCommand.auto = true; + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); + } else if (button == fishing) { + setDisplay("fishing", false); + } else if (button == fishingWinter) { + setDisplay("fishing_winter", false); + } else if (button == fishingFestival) { + setDisplay("fishing_festival", false); + } else if (button == catacombsF1) { + setDisplay("catacombs_floor_one", false); + } else if (button == catacombsF2) { + setDisplay("catacombs_floor_two", false); + } else if (button == catacombsF3) { + setDisplay("catacombs_floor_three", false); + } else if (button == catacombsF4) { + setDisplay("catacombs_floor_four", false); + } else if (button == catacombsF5) { + setDisplay("catacombs_floor_five", false); + } else if (button == catacombsF6) { + setDisplay("catacombs_floor_six", false); + } + } + + public void setDisplay(String display, boolean forceNoSession) { + if (!forceNoSession && addSession) display += "_session"; + DisplayCommand.auto = false; + DisplayCommand.display = display; + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); + ConfigHandler.writeStringConfig("misc", "display", display); + } + +} diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java new file mode 100644 index 0000000..8cfed2d --- /dev/null +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -0,0 +1,112 @@ +package me.Danker.gui; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.handlers.TextRenderer; +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.util.EnumChatFormatting; + +public class EditLocationsGui extends GuiScreen { + + private int lastMouseX = -1; + private int lastMouseY = -1; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + + Minecraft mc = Minecraft.getMinecraft(); + + drawRect(MoveCommand.coordsXY[0] - 2, MoveCommand.coordsXY[1] - 2, (int) (MoveCommand.coordsXY[0] + (139 * ScaleCommand.coordsScale)), (int) (MoveCommand.coordsXY[1] + (12 * ScaleCommand.coordsScale)), 0x40D3D3D3); + new TextRenderer(mc, "74 / 14 / -26 (141.1 / 6.7)", MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale); + + String dungeonTimerText = EnumChatFormatting.GRAY + "Wither Doors:\n" + + EnumChatFormatting.DARK_RED + "Blood Open:\n" + + EnumChatFormatting.RED + "Watcher Clear:\n" + + EnumChatFormatting.BLUE + "Boss Clear:\n" + + EnumChatFormatting.YELLOW + "Deaths:\n" + + EnumChatFormatting.YELLOW + "Puzzle Fails:"; + String dungeonTimerNums = EnumChatFormatting.GRAY + "" + 5 + "\n" + + EnumChatFormatting.DARK_RED + Utils.getTimeBetween(0, 33) + "\n" + + EnumChatFormatting.RED + Utils.getTimeBetween(0, 129) + "\n" + + EnumChatFormatting.BLUE + Utils.getTimeBetween(0, 169) + "\n" + + EnumChatFormatting.YELLOW + 2 + "\n" + + EnumChatFormatting.YELLOW + 1; + drawRect(MoveCommand.dungeonTimerXY[0] - 2, MoveCommand.dungeonTimerXY[1] - 2, (int) (MoveCommand.dungeonTimerXY[0] + (112 * ScaleCommand.dungeonTimerScale)), (int) (MoveCommand.dungeonTimerXY[1] + (56 * ScaleCommand.dungeonTimerScale)), 0x40D3D3D3); + new TextRenderer(mc, dungeonTimerText, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + new TextRenderer(mc, dungeonTimerNums, (int) (MoveCommand.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale); + + String displayText = EnumChatFormatting.GOLD + "Svens Killed:\n" + + EnumChatFormatting.GREEN + "Wolf Teeth:\n" + + EnumChatFormatting.BLUE + "Hamster Wheels:\n" + + EnumChatFormatting.AQUA + "Spirit Runes:\n" + + EnumChatFormatting.WHITE + "Critical VI Books:\n" + + EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" + + EnumChatFormatting.GOLD + "Couture Runes:\n" + + EnumChatFormatting.AQUA + "Grizzly Baits:\n" + + EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + String displayNums = EnumChatFormatting.GOLD + "1,024" + "\n" + + EnumChatFormatting.GREEN + "59,719" + "\n" + + EnumChatFormatting.BLUE + "36" + "\n" + + EnumChatFormatting.AQUA + "64" + "\n" + + EnumChatFormatting.WHITE + "17" + "\n" + + EnumChatFormatting.DARK_RED + "3" + "\n" + + EnumChatFormatting.GOLD + "4" + "\n" + + EnumChatFormatting.AQUA + "0" + "\n" + + EnumChatFormatting.DARK_PURPLE + "5" + "\n" + + EnumChatFormatting.AQUA + Utils.getTimeBetween(0, 2678400) + "\n" + + EnumChatFormatting.AQUA + "5,000"; + drawRect(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), 0x40D3D3D3); + new TextRenderer(mc, displayText, MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale); + new TextRenderer(mc, displayNums, (int) (MoveCommand.displayXY[0] + (110 * ScaleCommand.displayScale)), MoveCommand.displayXY[1], ScaleCommand.displayScale); + + drawRect(MoveCommand.skill50XY[0] - 2, MoveCommand.skill50XY[1] - 2, (int) (MoveCommand.skill50XY[0] + (232 * ScaleCommand.skill50Scale)), (int) (MoveCommand.skill50XY[1] + (12 * ScaleCommand.skill50Scale)), 0x40D3D3D3); + new TextRenderer(mc, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /*@Override + public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); + + if (lastMouseX == -1) lastMouseX = mouseX; + if (lastMouseY == -1) lastMouseY = mouseY; + + int xMoved = mouseX - lastMouseX; + int yMoved = mouseY - lastMouseY; + + // Display + if (isInsideBox(MoveCommand.displayXY[0] - 2, MoveCommand.displayXY[1] - 2, (int) (MoveCommand.displayXY[0] + (144 * ScaleCommand.displayScale)), (int) (MoveCommand.displayXY[1] + (100 * ScaleCommand.displayScale)), mouseX, mouseY)) { + System.out.println("lastMouseX: " + lastMouseX + ", mouseX: " + mouseX + ", xMoved: " + xMoved); + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + } + + lastMouseX = mouseX; + lastMouseY = mouseY; + } + + boolean isInsideBox(int x1, int y1, int x2, int y2, int x, int y) { + if (x >= x1 && x <= x2 && y >= y1 && y <= y2) { + return true; + } + return false; + }*/ + +} diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java new file mode 100644 index 0000000..0573777 --- /dev/null +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -0,0 +1,129 @@ +package me.Danker.gui; + +import me.Danker.commands.BlockSlayerCommand; +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; + +public class OnlySlayerGui extends GuiScreen { + + private int onlyNumberInt = 4; + private String onlyName = "Revenant Horror"; + + private GuiButton off; + private GuiButton zombie; + private GuiButton spider; + private GuiButton wolf; + private GuiButton one; + private GuiButton two; + private GuiButton three; + private GuiButton four; + + @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(); + + 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; + } + + off = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Off"); + zombie = new GuiButton(0, width / 2 - 200, (int) (height * 0.4), 120, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 60, (int) (height * 0.4), 120, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 80, (int) (height * 0.4), 120, 20, "Wolf"); + one = new GuiButton(0, width / 2 - 190, (int) (height * 0.6), 85, 20, "I"); + two = new GuiButton(0, width / 2 - 95, (int) (height * 0.6), 85, 20, "II"); + three = new GuiButton(0, width / 2 + 10, (int) (height * 0.6), 85, 20, "III"); + four = new GuiButton(0, width / 2 + 115, (int) (height * 0.6), 85, 20, "IV"); + + this.buttonList.add(off); + this.buttonList.add(zombie); + this.buttonList.add(spider); + this.buttonList.add(wolf); + this.buttonList.add(one); + this.buttonList.add(two); + this.buttonList.add(three); + this.buttonList.add(four); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + Minecraft mc = Minecraft.getMinecraft(); + + String displayText; + if (BlockSlayerCommand.onlySlayerName.equals("")) { + displayText = "Only Allow Slayer: Off"; + } else { + displayText = "Only Allow Slayer: " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber; + } + int displayWidth = mc.fontRendererObj.getStringWidth(displayText); + new TextRenderer(mc, displayText, width / 2 - displayWidth / 2, 10, 1D); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == off) { + BlockSlayerCommand.onlySlayerName = ""; + BlockSlayerCommand.onlySlayerNumber = ""; + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); + return; + } else if (button == zombie) { + onlyName = "Revenant Horror"; + } else if (button == spider) { + onlyName = "Tarantula Broodfather"; + } else if (button == wolf) { + onlyName = "Sven Packmaster"; + } else if (button == one) { + onlyNumberInt = 1; + } else if (button == two) { + onlyNumberInt = 2; + } else if (button == three) { + onlyNumberInt = 3; + } else if (button == four) { + onlyNumberInt = 4; + } + + String onlyNumber; + switch (onlyNumberInt) { + case 1: + onlyNumber = "I"; + break; + case 2: + onlyNumber = "II"; + break; + case 3: + onlyNumber = "III"; + break; + case 4: + default: + onlyNumber = "IV"; + } + + BlockSlayerCommand.onlySlayerName = onlyName; + BlockSlayerCommand.onlySlayerNumber = onlyNumber; + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber); + } + +} diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index ae9f08b..ba01071 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -18,6 +18,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; public class Utils { @@ -223,4 +224,8 @@ public class Utils { return 0; } + public static String getColouredBoolean(boolean bool) { + return bool ? EnumChatFormatting.GREEN + "On" : EnumChatFormatting.RED + "Off"; + } + } |