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/java/me/Danker/DankersSkyblockMod.java | |
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/java/me/Danker/DankersSkyblockMod.java')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 27 |
1 files changed, 27 insertions, 0 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(); |