diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-08-21 16:18:09 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-08-21 16:18:09 -0400 |
commit | 22e6274ab106bc3dffa62b255550ce551c1b38fd (patch) | |
tree | d79ee685e4b6023be5aef594a2d60496c7b88b07 /src/main/java/me/Danker | |
parent | 3023a9d96d300706b692d313799978de848bb12f (diff) | |
download | SkyblockMod-22e6274ab106bc3dffa62b255550ce551c1b38fd.tar.gz SkyblockMod-22e6274ab106bc3dffa62b255550ce551c1b38fd.tar.bz2 SkyblockMod-22e6274ab106bc3dffa62b255550ce551c1b38fd.zip |
Add keybind for Maddox menu
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 20 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DHelpCommand.java | 4 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index c546dbd..79a9d0a 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -11,6 +11,8 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; +import org.lwjgl.input.Keyboard; + import com.google.gson.JsonObject; import me.Danker.commands.ArmourCommand; @@ -39,6 +41,7 @@ import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; @@ -54,6 +57,8 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -61,6 +66,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @@ -80,6 +86,7 @@ public class TheMod public static String titleText = ""; static int tickAmount = 1; public static String lastMaddoxCommand = "/cb placeholdervalue"; + static KeyBinding[] keyBindings = new KeyBinding[1]; @EventHandler public void init(FMLInitializationEvent event) @@ -122,6 +129,12 @@ public class TheMod String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")"; pattern = Pattern.compile(patternString); + + keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); + + for (int i = 0; i < keyBindings.length; i++) { + ClientRegistry.registerKeyBinding(keyBindings[i]); + } } @EventHandler @@ -1392,6 +1405,13 @@ public class TheMod } } + @SubscribeEvent + public void onKey(KeyInputEvent event) { + if (keyBindings[0].isPressed()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + } + } + public void increaseEmpSC() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index b69133e..4118264 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -31,6 +31,7 @@ public class DHelpCommand extends CommandBase { player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " " + TheMod.MODID + " Version " + TheMod.VERSION + "\n" + 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 + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" + @@ -47,7 +48,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /bank [player]" + EnumChatFormatting.AQUA + " - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /armor [player]" + EnumChatFormatting.AQUA + " - Uses API to get armour of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + - EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n")); + EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n")); } } |