blob: 6eed707cc951d3b1622cd30316e882d0af0f5c12 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
package rosegoldaddons.utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import rosegoldaddons.commands.Backpack;
import rosegoldaddons.commands.LobbySwap;
import java.util.List;
public class OpenSkyblockGui {
int windowId;
boolean openingWardrobe = false;
boolean lobbySwapping = false;
boolean openingBP = false;
@SubscribeEvent
public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!rosegoldaddons.commands.Rosedrobe.openWardrobe || openingWardrobe) return;
new Thread(() -> {
try {
openingWardrobe = true;
if (event.gui instanceof GuiChest) {
Container container = ((GuiChest) event.gui).inventorySlots;
if (container instanceof ContainerChest) {
String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
List<Slot> invSlots = container.inventorySlots;
if (chestName.contains("Pets")) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
String slotName = StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName());
//Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(slotName));
if (slotName.equals("Go Back")) {
clickSlot(invSlots.get(i));
}
}
} else if (chestName.contains("SkyBlock")) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Wardrobe")) {
clickSlot(invSlots.get(i));
if (rosegoldaddons.commands.Rosedrobe.slot == 0)
rosegoldaddons.commands.Rosedrobe.openWardrobe = false;
}
}
} else if (chestName.contains("Wardrobe")) {
if (rosegoldaddons.commands.Rosedrobe.slot != 0) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
String slotName = "Slot " + rosegoldaddons.commands.Rosedrobe.slot + ":";
if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) {
clickSlot(invSlots.get(i));
Minecraft.getMinecraft().thePlayer.closeScreen();
rosegoldaddons.commands.Rosedrobe.openWardrobe = false;
}
}
}
}
}
}
openingWardrobe = false;
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
@SubscribeEvent
public void guiDraw2(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!LobbySwap.swapLobby || lobbySwapping) return;
new Thread(() -> {
try {
lobbySwapping = true;
if (event.gui instanceof GuiChest) {
Container container = ((GuiChest) event.gui).inventorySlots;
if (container instanceof ContainerChest) {
String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
List<Slot> invSlots = container.inventorySlots;
if (chestName.contains("SkyBlock")) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Enter the Crystal Hollows")) {
clickSlot(invSlots.get(i));
}
}
} else if (chestName.contains("Enter the")) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).equals("Confirm")) {
clickSlot(invSlots.get(i));
LobbySwap.swapLobby = false;
}
}
Thread.sleep(2000);
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(Minecraft.getMinecraft().theWorld.getWorldTime() + " ticks"));
}
}
}
lobbySwapping = false;
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
@SubscribeEvent
public void guiDraw3(GuiScreenEvent.BackgroundDrawnEvent event) {
if (!Backpack.openBP || openingBP) return;
new Thread(() -> {
try {
openingBP = true;
if (event.gui instanceof GuiChest) {
Container container = ((GuiChest) event.gui).inventorySlots;
if (container instanceof ContainerChest) {
String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
List<Slot> invSlots = container.inventorySlots;
if (chestName.contains("Storage")) {
if (Backpack.bpSlot != 0) {
int i;
for (i = 0; i < invSlots.size(); i++) {
if (!invSlots.get(i).getHasStack()) continue;
String slotName = "Slot " + Backpack.bpSlot;
if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).contains(slotName)) {
clickSlot(invSlots.get(i));
Backpack.openBP = false;
}
}
}
}
}
}
openingBP = false;
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
private void clickSlot(Slot slot) {
windowId = Minecraft.getMinecraft().thePlayer.openContainer.windowId;
Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 0, 0, Minecraft.getMinecraft().thePlayer);
}
}
|