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
|
package rosegoldaddons.utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import rosegoldaddons.Main;
import rosegoldaddons.commands.Rosedrobe;
import rosegoldaddons.commands.Rosepet;
import scala.Int;
import tv.twitch.chat.Chat;
import java.util.List;
public class OpenSkyblockGui {
private static boolean openTrades = false;
@SubscribeEvent
public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
if(!Rosedrobe.openWardrobe && !openTrades && !Rosepet.openPetS) return;
if (event.gui instanceof GuiChest) {
Container container = ((GuiChest) event.gui).inventorySlots;
if (container instanceof ContainerChest) {
String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText();
if (Rosedrobe.openWardrobe) {
if (chestName.contains("Pets")) {
clickSlot(48, 0, 0);
clickSlot(32, 0, 1);
if (Rosedrobe.slot > 0) {
clickSlot(Rosedrobe.slot + 35, 0, 2);
Main.mc.thePlayer.closeScreen();
}
Rosedrobe.openWardrobe = false;
}
} else if (openTrades) {
if (chestName.contains("Pets")) {
clickSlot(48, 0, 0);
clickSlot(22, 0, 1);
openTrades = false;
}
} else if (Rosepet.openPetS) {
if (chestName.contains("Pets")) {
int currPage = 1;
int lastPage = 1;
if(chestName.startsWith("(")) {
currPage = Integer.parseInt(chestName.substring(chestName.indexOf("(")+1, chestName.indexOf("/")));
lastPage = Integer.parseInt(chestName.substring(chestName.indexOf("/")+1, chestName.indexOf(")")));
}
String petName = Rosepet.name;
int petSlot = Rosepet.petSlot;
if(petSlot != 0) {
clickSlot(petSlot - 1, 0, 0);
Rosepet.petSlot = 0;
Rosepet.openPetS = false;
return;
}
if (!petName.equals("")) {
List<Slot> chestInventory = ((GuiChest) Main.mc.currentScreen).inventorySlots.inventorySlots;
for (Slot slot : chestInventory) {
if (!slot.getHasStack()) continue;
if (slot.getStack().getDisplayName().contains(petName)) {
clickSlot(slot.slotNumber, 0, 0);
Main.mc.thePlayer.closeScreen();
Rosepet.openPetS = false;
return;
}
}
if (currPage < lastPage) {
clickSlot(53, 0, 0);
} else {
Rosepet.openPetS = false;
Main.mc.thePlayer.closeScreen();
ChatUtils.sendMessage("No pet named "+petName+" found.");
}
} else {
ChatUtils.sendMessage("Invalid Pet Name");
Rosepet.openPetS = false;
}
}
}
}
}
}
public static void openTradesMenu() {
openTrades = true;
Main.mc.thePlayer.sendChatMessage("/pets");
}
private void clickSlot(int slot, int type, int windowAdd) {
Main.mc.playerController.windowClick(Main.mc.thePlayer.openContainer.windowId + windowAdd, slot, type, 0, Main.mc.thePlayer);
}
}
|