diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-08-15 20:40:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 20:40:34 -0400 |
commit | 3aa11b859a2a22be30a5035f7273e1a604a4dde4 (patch) | |
tree | 8f428b29a6b56cc9d010b0441bf41b6b78373548 /src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java | |
parent | 33710ac6d9f57fa59e8dfb19a81b053346f1b097 (diff) | |
parent | daceea1e42371c295c36f80b3246601a6ffb2cc5 (diff) | |
download | SkyblockMod-master.tar.gz SkyblockMod-master.tar.bz2 SkyblockMod-master.zip |
1.8.7
Diffstat (limited to 'src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java')
-rw-r--r-- | src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java new file mode 100644 index 0000000..8d6fa85 --- /dev/null +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java @@ -0,0 +1,93 @@ +package me.Danker.gui.crystalhollowwaypoints; + +import me.Danker.DankersSkyblockMod; +import me.Danker.features.CrystalHollowWaypoints; +import me.Danker.utils.RenderUtils; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; + +public class CrystalHollowWaypointActionGui extends GuiScreen { + + private int id; + + private GuiButton goBack; + private GuiButton toggle; + private GuiButton sendNormal; + private GuiButton sendDSM; + private GuiButton sendSBE; + private GuiButton delete; + + public CrystalHollowWaypointActionGui(int id) { + this.id = id; + } + + @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(); + + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + toggle = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled)); + sendNormal = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Send Location And Coordinates"); + sendDSM = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Send DSM Formatted Waypoint"); + sendSBE = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Send SBE Formatted Waypoint"); + delete = new GuiButton(0, width / 2 - 100, (int) (height * 0.8), EnumChatFormatting.RED + "Delete Waypoint"); + + this.buttonList.add(toggle); + this.buttonList.add(sendNormal); + this.buttonList.add(sendDSM); + this.buttonList.add(sendSBE); + this.buttonList.add(delete); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + super.drawScreen(mouseX, mouseY, partialTicks); + + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + + RenderUtils.drawCenteredText(waypoint.location + " @ " + waypoint.getPos(), width, 10, 1D); + } + + @Override + public void actionPerformed(GuiButton button) { + CrystalHollowWaypoints.Waypoint waypoint = CrystalHollowWaypoints.waypoints.get(id); + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + if (button == goBack) { + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + DankersSkyblockMod.guiToOpen = "crystalwaypoints"; + } else if (button == toggle) { + waypoint.toggle(); + toggle.displayString = "Set Visibility: " + Utils.getColouredBoolean(waypoint.toggled); + } else if (button == sendNormal) { + player.sendChatMessage(waypoint.location + " @ " + waypoint.getPos()); + } else if (button == sendDSM) { + player.sendChatMessage("$DSMCHWP:" + waypoint.getFormattedWaypoint()); + } else if (button == sendSBE) { + player.sendChatMessage("$SBECHWP:" + waypoint.getFormattedWaypoint()); + } else if (button == delete) { + CrystalHollowWaypoints.waypoints.remove(id); + mc.displayGuiScreen(new CrystalHollowWaypointsGui(1)); + return; + } + CrystalHollowWaypoints.waypoints.set(id, waypoint); + } + +} |