From 252dedff670a8a456ae557b8ac7f1727bb7fd1b1 Mon Sep 17 00:00:00 2001 From: RoseGoldIsntGay Date: Sat, 15 Jan 2022 00:19:33 +0200 Subject: 2.5.2-pre1 --- .../java/rosegoldaddons/features/BrewingMacro.java | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/main/java/rosegoldaddons/features/BrewingMacro.java') diff --git a/src/main/java/rosegoldaddons/features/BrewingMacro.java b/src/main/java/rosegoldaddons/features/BrewingMacro.java index 6dffeba..f7febb3 100644 --- a/src/main/java/rosegoldaddons/features/BrewingMacro.java +++ b/src/main/java/rosegoldaddons/features/BrewingMacro.java @@ -52,12 +52,12 @@ public class BrewingMacro { if (!Main.brewingMacro) return; if (thread == null || !thread.isAlive()) { thread = new Thread(() -> { - try { - if (event.gui instanceof GuiChest) { - Container container = ((GuiChest) event.gui).inventorySlots; - if (container instanceof ContainerChest) { - String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); - int sleep = Main.configFile.alchsleep; + if (event.gui instanceof GuiChest) { + Container container = ((GuiChest) event.gui).inventorySlots; + if (container instanceof ContainerChest) { + String chestName = ((ContainerChest) container).getLowerChestInventory().getDisplayName().getUnformattedText(); + int sleep = Main.configFile.alchsleep; + try { if (Main.configFile.alchindex == 0) { if (chestName.contains("Brewing Stand")) { List chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; @@ -75,7 +75,7 @@ public class BrewingMacro { } if (sell) { if (chestName.contains("SkyBlock")) { - Thread.sleep(100); + Thread.sleep(sleep); clickSlot(22, 0, 0); } else if (chestName.contains("Trades")) { List chestInventory = ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots.inventorySlots; @@ -102,7 +102,7 @@ public class BrewingMacro { } } } - if(Main.configFile.alchclose) { + if (Main.configFile.alchclose) { Minecraft.getMinecraft().thePlayer.closeScreen(); } } @@ -114,15 +114,15 @@ public class BrewingMacro { if (!chestInventory.get(13).getHasStack()) { if (slot.getStack().getDisplayName().contains("Nether Wart") && slot.slotNumber >= 54) { clickSlot(slot.slotNumber, 0, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(13, 1, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(slot.slotNumber, 0, 0); break; } } } - if(Main.configFile.alchclose) { + if (Main.configFile.alchclose) { Minecraft.getMinecraft().thePlayer.closeScreen(); } } @@ -134,15 +134,15 @@ public class BrewingMacro { if (!chestInventory.get(13).getHasStack()) { if ((slot.getStack().getDisplayName().contains("Sugar") || slot.getStack().getDisplayName().contains("Spider Eye")) && slot.slotNumber >= 54) { clickSlot(slot.slotNumber, 0, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(13, 1, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(slot.slotNumber, 0, 0); break; } } } - if(Main.configFile.alchclose) { + if (Main.configFile.alchclose) { Minecraft.getMinecraft().thePlayer.closeScreen(); } } @@ -154,24 +154,25 @@ public class BrewingMacro { if (!chestInventory.get(13).getHasStack()) { if (slot.getStack().getDisplayName().contains("Glowstone") && slot.slotNumber >= 54) { clickSlot(slot.slotNumber, 0, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(13, 1, 0); - Thread.sleep(sleep/2); + Thread.sleep(sleep / 2); clickSlot(slot.slotNumber, 0, 0); break; } } } - if(Main.configFile.alchclose) { + if (Main.configFile.alchclose) { Minecraft.getMinecraft().thePlayer.closeScreen(); } } } + } catch (InterruptedException e) { + e.printStackTrace(); } } - } catch (Exception exception) { - exception.printStackTrace(); } + }, "brewing"); thread.start(); } -- cgit