blob: 9a4c839dd44fa8fa0b7a2df9b1450c5f45f11bac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package me.Danker.features;
import me.Danker.commands.ToggleCommand;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class AutoSwapToPickBlock {
static int pickBlockBind;
static boolean pickBlockBindSwapped = false;
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
if (!ToggleCommand.swapToPickBlockToggled || !Utils.inSkyblock) return;
Minecraft mc = Minecraft.getMinecraft();
GameSettings gameSettings = mc.gameSettings;
if (event.gui instanceof GuiChest) {
Container containerChest = ((GuiChest) event.gui).inventorySlots;
if (containerChest instanceof ContainerChest) {
IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory();
String inventoryName = inventory.getDisplayName().getUnformattedText();
if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (") || inventoryName.startsWith("What starts with:") || inventoryName.startsWith("Select all the") || inventoryName.startsWith("Change all to same color!") || inventoryName.startsWith("Correct all the panes!") || inventoryName.startsWith("Click in order!") || inventoryName.startsWith("Click the button on time!") || inventoryName.startsWith("Harp -")) {
if (!pickBlockBindSwapped) {
pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode();
gameSettings.keyBindPickBlock.setKeyCode(-100);
pickBlockBindSwapped = true;
}
} else {
if (pickBlockBindSwapped) {
gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind);
pickBlockBindSwapped = false;
}
}
}
} else {
if (pickBlockBindSwapped) {
gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind);
pickBlockBindSwapped = false;
}
}
}
}
|