diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-15 00:19:33 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-15 00:19:33 +0200 |
commit | 252dedff670a8a456ae557b8ac7f1727bb7fd1b1 (patch) | |
tree | 996f83583518b3774155f9454cea901af8bae534 /src/main/java/rosegoldaddons/features/BrewingMacro.java | |
parent | 0acbdcf7cd4ee78544b8cf7fbf8fa48dd395f693 (diff) | |
download | RGA-252dedff670a8a456ae557b8ac7f1727bb7fd1b1.tar.gz RGA-252dedff670a8a456ae557b8ac7f1727bb7fd1b1.tar.bz2 RGA-252dedff670a8a456ae557b8ac7f1727bb7fd1b1.zip |
2.5.2-pre1
Diffstat (limited to 'src/main/java/rosegoldaddons/features/BrewingMacro.java')
-rw-r--r-- | src/main/java/rosegoldaddons/features/BrewingMacro.java | 39 |
1 files changed, 20 insertions, 19 deletions
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<Slot> 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<Slot> 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(); } |