aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/rosegoldaddons/utils')
-rw-r--r--src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java47
-rw-r--r--src/main/java/rosegoldaddons/utils/RenderUtils.java13
2 files changed, 59 insertions, 1 deletions
diff --git a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
index 6eed707..51ba356 100644
--- a/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
+++ b/src/main/java/rosegoldaddons/utils/OpenSkyblockGui.java
@@ -11,14 +11,19 @@ import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import rosegoldaddons.commands.Backpack;
import rosegoldaddons.commands.LobbySwap;
+import rosegoldaddons.commands.Rosepet;
import java.util.List;
+import java.util.Locale;
public class OpenSkyblockGui {
int windowId;
+ int windowId2;
+ int windowClicks = 0;
boolean openingWardrobe = false;
boolean lobbySwapping = false;
boolean openingBP = false;
+ boolean openingPets = false;
@SubscribeEvent
public void guiDraw(GuiScreenEvent.BackgroundDrawnEvent event) {
@@ -147,8 +152,48 @@ public class OpenSkyblockGui {
}).start();
}
+ @SubscribeEvent
+ public void guiDraw4(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!Rosepet.openPetS || openingPets) return;
+ new Thread(() -> {
+ try {
+ openingPets = 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")) {
+ if (!Rosepet.name.equals("")) {
+ int i;
+ for (i = 0; i < invSlots.size(); i++) {
+ if (!invSlots.get(i).getHasStack()) continue;
+
+ if (StringUtils.stripControlCodes(invSlots.get(i).getStack().getDisplayName()).toLowerCase().contains(Rosepet.name.toLowerCase())) {
+ clickSlot(invSlots.get(i));
+ Rosepet.openPetS = false;
+ }
+ }
+ }
+ }
+ }
+ }
+ openingPets = 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);
+ Minecraft.getMinecraft().playerController.windowClick(windowId, slot.slotNumber, 2, 0, Minecraft.getMinecraft().thePlayer);
+ }
+
+ private void clickSlot2(Slot slot) {
+ if(windowClicks == 0)
+ windowId2 = Minecraft.getMinecraft().thePlayer.openContainer.windowId;
+ Minecraft.getMinecraft().playerController.windowClick(windowId + windowClicks, slot.slotNumber, 2, 0, Minecraft.getMinecraft().thePlayer);
+ windowClicks++;
}
}
diff --git a/src/main/java/rosegoldaddons/utils/RenderUtils.java b/src/main/java/rosegoldaddons/utils/RenderUtils.java
index 5d3e2f2..cfd7d1d 100644
--- a/src/main/java/rosegoldaddons/utils/RenderUtils.java
+++ b/src/main/java/rosegoldaddons/utils/RenderUtils.java
@@ -679,4 +679,17 @@ public class RenderUtils {
tessellator.draw();
}
+ public static void enableChams() {
+ GL11.glEnable(32823);
+ GlStateManager.enablePolygonOffset();
+ GlStateManager.doPolygonOffset(1.0F, -1000000.0F);
+ }
+
+ public static void disableChams() {
+ GL11.glDisable(32823);
+ GlStateManager.doPolygonOffset(1.0F, 1000000.0F);
+ GlStateManager.disablePolygonOffset();
+ }
+
+
} \ No newline at end of file