diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-10-20 11:57:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 11:57:50 -0400 |
commit | 5c5ffdbd4379d4c5002cd42c297f90e631566006 (patch) | |
tree | 1f203e2c7506697efe5efc326d95567bd7e958a0 /src/main/java/me/Danker/gui | |
parent | 20b405f59dcd92df1b4c3cd5b9ac353652ef4405 (diff) | |
parent | 1635fe604e6ca2d32d96409165fcc298f1c5b067 (diff) | |
download | SkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.tar.gz SkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.tar.bz2 SkyblockMod-5c5ffdbd4379d4c5002cd42c297f90e631566006.zip |
1.8v1.8
Merge pull request #22 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/gui')
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 206 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DisplayGui.java | 155 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 152 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/OnlySlayerGui.java | 135 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/buttons/LocationButton.java | 61 |
5 files changed, 709 insertions, 0 deletions
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..0ee10b9 --- /dev/null +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -0,0 +1,206 @@ +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 lividDagger; + 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)); + lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Enable Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + // Page 3 + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "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(lividDagger); + this.buttonList.add(sceptreMessages); + this.buttonList.add(petColours); + this.buttonList.add(dungeonTimer); + this.buttonList.add(golemAlerts); + this.buttonList.add(expertiseLore); + this.buttonList.add(nextPage); + this.buttonList.add(backPage); + this.buttonList.add(closeGUI); + } else if (page == 3) { + 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 == lividDagger) { + ToggleCommand.lividDaggerToggled = !ToggleCommand.lividDaggerToggled; + ConfigHandler.writeBooleanConfig("toggles", "LividDagger", ToggleCommand.lividDaggerToggled); + lividDagger.displayString = "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled); + } 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..243bedb --- /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 - 210, (int) (height * 0.2), "Off"); + auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); + zombie = new GuiButton(0, width / 2 - 190, (int) (height * 0.3), 110, 20, "Zombie"); + spider = new GuiButton(0, width / 2 - 55, (int) (height * 0.3), 110, 20, "Spider"); + wolf = new GuiButton(0, width / 2 + 75, (int) (height * 0.3), 110, 20, "Wolf"); + 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(auto); + this.buttonList.add(zombie); + this.buttonList.add(spider); + this.buttonList.add(wolf); + 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..8fbc4cb --- /dev/null +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -0,0 +1,152 @@ +package me.Danker.gui; + +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.gui.buttons.LocationButton; +import me.Danker.handlers.ConfigHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.EnumChatFormatting; + +public class EditLocationsGui extends GuiScreen { + + private String moving = null; + private int lastMouseX = -1; + private int lastMouseY = -1; + + private LocationButton display; + private LocationButton dungeonTimer; + private LocationButton coords; + private LocationButton skill50; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + // Ease of typing + MoveCommand moc = new MoveCommand(); + ScaleCommand sc = new ScaleCommand(); + + 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"; + + 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; + + display = new LocationButton(0, moc.displayXY[0], moc.displayXY[1], 145 * sc.displayScale, 102 * sc.displayScale, sc.displayScale, displayText, displayNums, 110); + dungeonTimer = new LocationButton(0, moc.dungeonTimerXY[0], moc.dungeonTimerXY[1], 113 * sc.dungeonTimerScale, 57 * sc.dungeonTimerScale, sc.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); + coords = new LocationButton(0, moc.coordsXY[0], moc.coordsXY[1], 141 * sc.coordsScale, 12 * sc.coordsScale, sc.coordsScale, "74 / 14 / -26 (141.1 / 6.7)", null, null); + skill50 = new LocationButton(0, moc.skill50XY[0], moc.skill50XY[1], 233 * sc.skill50Scale, 12 * sc.skill50Scale, sc.skill50Scale, EnumChatFormatting.AQUA + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); + + this.buttonList.add(coords); + this.buttonList.add(dungeonTimer); + this.buttonList.add(display); + this.buttonList.add(skill50); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + mouseMoved(mouseX, mouseY); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + private void mouseMoved(int mouseX, int mouseY) { + int xMoved = mouseX - lastMouseX; + int yMoved = mouseY - lastMouseY; + + if (moving != null) { + if (moving.equals("display")) { + MoveCommand.displayXY[0] += xMoved; + MoveCommand.displayXY[1] += yMoved; + display.xPosition = MoveCommand.displayXY[0]; + display.yPosition = MoveCommand.displayXY[1]; + } else if (moving.equals("dungeonTimer")) { + MoveCommand.dungeonTimerXY[0] += xMoved; + MoveCommand.dungeonTimerXY[1] += yMoved; + dungeonTimer.xPosition = MoveCommand.dungeonTimerXY[0]; + dungeonTimer.yPosition = MoveCommand.dungeonTimerXY[1]; + } else if (moving.equals("coords")) { + MoveCommand.coordsXY[0] += xMoved; + MoveCommand.coordsXY[1] += yMoved; + coords.xPosition = MoveCommand.coordsXY[0]; + coords.yPosition = MoveCommand.coordsXY[1]; + } else if (moving.equals("skill50")) { + MoveCommand.skill50XY[0] += xMoved; + MoveCommand.skill50XY[1] += yMoved; + skill50.xPosition = MoveCommand.skill50XY[0]; + skill50.yPosition = MoveCommand.skill50XY[1]; + } + this.buttonList.clear(); + initGui(); + } + + lastMouseX = mouseX; + lastMouseY = mouseY; + } + + @Override + public void actionPerformed(GuiButton button) { + if (button instanceof LocationButton) { + if (button == display) { + moving = "display"; + } else if (button == dungeonTimer) { + moving = "dungeonTimer"; + } else if (button == coords) { + moving = "coords"; + } else if (button == skill50) { + moving = "skill50"; + } + } + } + + @Override + public void mouseReleased(int mouseX, int mouseY, int state) { + super.mouseReleased(mouseX, mouseY, state); + moving = null; + ConfigHandler.writeIntConfig("locations", "coordsX", MoveCommand.coordsXY[0]); + ConfigHandler.writeIntConfig("locations", "coordsY", MoveCommand.coordsXY[1]); + ConfigHandler.writeIntConfig("locations", "displayX", MoveCommand.displayXY[0]); + ConfigHandler.writeIntConfig("locations", "displayY", MoveCommand.displayXY[1]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerX", MoveCommand.dungeonTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerY", MoveCommand.dungeonTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "skill50X", MoveCommand.skill50XY[0]); + ConfigHandler.writeIntConfig("locations", "skill50Y", MoveCommand.skill50XY[1]); + } + +} 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..c96bfd6 --- /dev/null +++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java @@ -0,0 +1,135 @@ +package me.Danker.gui; + +import me.Danker.TheMod; +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 goBack; + 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; + } + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + 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); + this.buttonList.add(goBack); + } + + @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 == goBack) { + TheMod.guiToOpen = "dankergui1"; + } else 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/gui/buttons/LocationButton.java b/src/main/java/me/Danker/gui/buttons/LocationButton.java new file mode 100644 index 0000000..061f198 --- /dev/null +++ b/src/main/java/me/Danker/gui/buttons/LocationButton.java @@ -0,0 +1,61 @@ +package me.Danker.gui.buttons; + +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.gui.GuiButton; + +public class LocationButton extends GuiButton { + + private int x; + private int y; + private double scale; + private String text; + private String text2; + private Integer text2Offset; + + public LocationButton(int buttonId, int x, int y, double width, double height, double scale, String text, String text2, Integer text2Offset) { + super(buttonId, x, y, text); + this.x = x; + this.y = y; + this.width = (int) width; + this.height = (int) height; + this.scale = scale; + this.text = text; + this.text2 = text2; + this.text2Offset = text2Offset; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + String[] splitText; + if (text2 == null) { + splitText = text.split("\n"); + } else { + splitText = text2.split("\n"); + } + int index = 0; + int longestText = -1; + for (int i = 0; i < splitText.length; i++) { + int stringLength = mc.fontRendererObj.getStringWidth(splitText[i]); + if (stringLength > longestText) { + index = i; + longestText = stringLength; + } + } + + if (text2 == null) { + drawRect(x - 2, y - 2, (int) (x + longestText * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + } else { + drawRect(x - 2, y - 2, (int) (x + (longestText + text2Offset) * scale + 3), (int) (y + (splitText.length * 9 + 3) * scale), 0x40D3D3D3); + new TextRenderer(mc, text2, (int) (x + (text2Offset * scale)), y, scale); + } + new TextRenderer(mc, text, x, y, scale); + } + + @Override + public void playPressSound(SoundHandler soundHandler) { + + } + +} |