diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-04-28 02:37:21 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-04-28 02:37:21 -0400 |
commit | 827fb6fc502e1e7159d15c1decfa35968668bb6f (patch) | |
tree | 210df625e8d1bc9604c72d651741f54aaf48e406 /src/main/java/me/Danker | |
parent | d35e43b33b98796acc7b8dc76bc06848d0ee3129 (diff) | |
download | SkyblockMod-827fb6fc502e1e7159d15c1decfa35968668bb6f.tar.gz SkyblockMod-827fb6fc502e1e7159d15c1decfa35968668bb6f.tar.bz2 SkyblockMod-827fb6fc502e1e7159d15c1decfa35968668bb6f.zip |
Add keybind for adding waypoint
Diffstat (limited to 'src/main/java/me/Danker')
3 files changed, 34 insertions, 9 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 2139549..1816a3c 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -70,7 +70,7 @@ public class DankersSkyblockMod { public static String titleText = ""; public static int tickAmount = 1; public static int repoTickAmount = 1; - public static KeyBinding[] keyBindings = new KeyBinding[3]; + public static KeyBinding[] keyBindings = new KeyBinding[4]; public static boolean usingLabymod = false; public static boolean usingOAM = false; static boolean OAMWarning = false; @@ -188,6 +188,7 @@ public class DankersSkyblockMod { 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); @@ -457,14 +458,8 @@ 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 diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java index 795c49c..a8ee0f9 100644 --- a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -2,10 +2,12 @@ package me.Danker.features; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; +import me.Danker.gui.crystalhollowwaypoints.CrystalHollowAddWaypointGui; import me.Danker.handlers.ScoreboardHandler; import me.Danker.utils.RenderUtils; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; @@ -15,6 +17,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.ArrayList; @@ -178,6 +181,18 @@ public class CrystalHollowWaypoints { } @SubscribeEvent + public void onKey(InputEvent.KeyInputEvent event) { + if (!Utils.tabLocation.equals("Crystal Hollows")) return; + + if (DankersSkyblockMod.keyBindings[3].isPressed()) { + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + + mc.displayGuiScreen(new CrystalHollowAddWaypointGui((int) player.posX, (int) player.posY, (int) player.posZ)); + } + } + + @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) { for (Waypoint waypoint : waypoints) { diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java index df91f04..52c0fba 100644 --- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java +++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowAddWaypointGui.java @@ -23,6 +23,18 @@ public class CrystalHollowAddWaypointGui extends GuiScreen { private GuiTextField z; private GuiButton add; + private int xPos = -1; + private int yPos = -1; + private int zPos = -1; + + public CrystalHollowAddWaypointGui() {} + + public CrystalHollowAddWaypointGui(int x, int y, int z) { + xPos = x; + yPos = y; + zPos = z; + } + @Override public boolean doesGuiPauseGame() { return false; @@ -49,10 +61,13 @@ public class CrystalHollowAddWaypointGui extends GuiScreen { name.setEnabled(true); x.setVisible(true); x.setEnabled(true); + if (xPos != -1) x.setText(xPos + ""); y.setVisible(true); y.setEnabled(true); + if (yPos != -1) y.setText(yPos + ""); z.setVisible(true); z.setEnabled(true); + if (zPos != -1) z.setText(zPos + ""); this.buttonList.add(cancel); this.buttonList.add(curPos); |