diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-06 10:46:52 -0500 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-06 10:46:52 -0500 |
commit | 9a1e3f204296783a1de0d78a0b7e8b3441039a0a (patch) | |
tree | 2a703e082ffa57a8d5156417341f91af146f01e9 /src/main | |
parent | 9ec9e1cb376ab39471a3a9fe3888d52626b3ee3b (diff) | |
download | SkyblockMod-9a1e3f204296783a1de0d78a0b7e8b3441039a0a.tar.gz SkyblockMod-9a1e3f204296783a1de0d78a0b7e8b3441039a0a.tar.bz2 SkyblockMod-9a1e3f204296783a1de0d78a0b7e8b3441039a0a.zip |
Feature: Auto-Swap LMB to pick block
Diffstat (limited to 'src/main')
4 files changed, 45 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 47c5313..6bd4652 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -14,6 +14,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItemFrame; @@ -120,6 +121,8 @@ public class DankersSkyblockMod static int chronomatronMouseClicks = 0; static int lastUltraSequencerClicked = 0; static ItemStack[] experimentTableSlots = new ItemStack[54]; + static int pickBlockBind; + static boolean pickBlockBindSwapped = false; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -3003,6 +3006,30 @@ public class DankersSkyblockMod @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { + Minecraft mc = Minecraft.getMinecraft(); + GameSettings gameSettings = mc.gameSettings; + if (event.gui instanceof GuiChest) { + Container containerChest = ((GuiChest) event.gui).inventorySlots; + if (containerChest instanceof ContainerChest) { + GuiChest chest = (GuiChest) event.gui; + IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); + String inventoryName = inventory.getDisplayName().getUnformattedText(); + if(ToggleCommand.swapToPickBlockInExperimentsToggled) { + if(inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (")) { + if(!pickBlockBindSwapped) { + pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode(); + gameSettings.keyBindPickBlock.setKeyCode(-100); + pickBlockBindSwapped = true; + } + } else { + if(pickBlockBindSwapped) { + gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind); + pickBlockBindSwapped = false; + } + } + } + } + } clickInOrderSlots = new Slot[36]; lastChronomatronRound = 0; chronomatronPattern.clear(); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 2f72fd4..81bda6b 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -51,6 +51,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean ultrasequencerToggled; public static boolean chronomatronToggled; public static boolean superpairsToggled; + public static boolean swapToPickBlockInExperimentsToggled; @Override public String getCommandName() { @@ -63,7 +64,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + "lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + - "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/list>"; + "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/pickblockinexperiments/list>"; } @Override @@ -273,6 +274,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "Superpairs", superpairsToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Superpairs solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + superpairsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "pickblockinexperiments": + swapToPickBlockInExperimentsToggled = !swapToPickBlockInExperimentsToggled; + ConfigHandler.writeBooleanConfig("toggles", "PickBlockInExperiments", superpairsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto-swap to pick block in experiments has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + swapToPickBlockInExperimentsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java index 42c9b66..b27ff16 100644 --- a/src/main/java/me/Danker/gui/ExperimentsGui.java +++ b/src/main/java/me/Danker/gui/ExperimentsGui.java @@ -15,6 +15,7 @@ public class ExperimentsGui extends GuiScreen { private GuiButton ultrasequencer; private GuiButton chronomatron; private GuiButton superpairs; + private GuiButton pickBlock; @Override public boolean doesGuiPauseGame() { @@ -33,11 +34,14 @@ public class ExperimentsGui extends GuiScreen { ultrasequencer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled)); chronomatron = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled)); superpairs = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled)); + pickBlock = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockInExperimentsToggled)); + this.buttonList.add(goBack); this.buttonList.add(ultrasequencer); this.buttonList.add(chronomatron); this.buttonList.add(superpairs); + this.buttonList.add(pickBlock); } @Override @@ -62,6 +66,10 @@ public class ExperimentsGui extends GuiScreen { ToggleCommand.superpairsToggled = !ToggleCommand.superpairsToggled; ConfigHandler.writeBooleanConfig("toggles", "Superpairs", ToggleCommand.superpairsToggled); superpairs.displayString = "Superpairs Solver: " + Utils.getColouredBoolean(ToggleCommand.superpairsToggled); + } else if (button == pickBlock) { + ToggleCommand.swapToPickBlockInExperimentsToggled = !ToggleCommand.swapToPickBlockInExperimentsToggled; + ConfigHandler.writeBooleanConfig("toggles", "PickBlockInExperiments", ToggleCommand.swapToPickBlockInExperimentsToggled); + pickBlock.displayString = "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockInExperimentsToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 0d0ccb1..3ed5601 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -204,6 +204,8 @@ public class ConfigHandler { if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false); if (!hasKey("toggles", "Superpairs")) writeBooleanConfig("toggles", "Superpairs", false); + if (!hasKey("toggles", "PickBlockInExperiments")) writeBooleanConfig("toggles", "PickBlockInExperiments", false); + if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -448,6 +450,7 @@ public class ConfigHandler { ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron"); ToggleCommand.superpairsToggled = getBoolean("toggles", "Superpairs"); + ToggleCommand.swapToPickBlockInExperimentsToggled = getBoolean("toggles", "PickBlockInExperiments"); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { |