diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features')
5 files changed, 29 insertions, 24 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(); } diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java index 4768eb0..bbde6db 100644 --- a/src/main/java/rosegoldaddons/features/EndermanMacro.java +++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java @@ -2,7 +2,6 @@ package rosegoldaddons.features; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -12,7 +11,6 @@ import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; import java.awt.*; -import java.util.Random; public class EndermanMacro { private static Entity enderman; @@ -36,6 +34,7 @@ public class EndermanMacro { private static Entity getClosestEnderman() { Entity eman = null; double closest = 9999; + if(Minecraft.getMinecraft().theWorld == null) return null; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityEnderman && !(((EntityEnderman) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); diff --git a/src/main/java/rosegoldaddons/features/GemstoneAura.java b/src/main/java/rosegoldaddons/features/GemstoneAura.java index a694818..fbbb98d 100644 --- a/src/main/java/rosegoldaddons/features/GemstoneAura.java +++ b/src/main/java/rosegoldaddons/features/GemstoneAura.java @@ -36,7 +36,7 @@ public class GemstoneAura { return; } if (event.phase == TickEvent.Phase.END) { - if(PlayerUtils.pickaxeAbilityReady) { + if(PlayerUtils.pickaxeAbilityReady && Minecraft.getMinecraft().thePlayer != null) { Minecraft.getMinecraft().playerController.sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem)); } if(currentDamage > 100) { diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 79a7907..364471b 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -36,6 +36,7 @@ public class GhostMacro { private static Entity getClosestCreeper() { Entity eman = null; double closest = 9999.0; + if(Minecraft.getMinecraft().theWorld == null) return null; for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { if (entity1 instanceof EntityCreeper && !(((EntityCreeper) entity1).getHealth() == 0)) { double dist = entity1.getDistanceSq(Minecraft.getMinecraft().thePlayer.posX, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ); diff --git a/src/main/java/rosegoldaddons/features/HardstoneAura.java b/src/main/java/rosegoldaddons/features/HardstoneAura.java index da76ff2..2aa0655 100644 --- a/src/main/java/rosegoldaddons/features/HardstoneAura.java +++ b/src/main/java/rosegoldaddons/features/HardstoneAura.java @@ -52,11 +52,11 @@ public class HardstoneAura { MovingObjectPosition fake = Minecraft.getMinecraft().objectMouseOver; fake.hitVec = new Vec3(closestStone); EnumFacing enumFacing = fake.sideHit; - if (currentDamage == 0 && enumFacing != null) { + if (currentDamage == 0 && enumFacing != null && Minecraft.getMinecraft().thePlayer != null) { Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, closestStone, enumFacing)); } MovingObjectPosition real = Minecraft.getMinecraft().objectMouseOver; - if (real != null && real.entityHit == null) { + if (real != null && real.entityHit == null && Minecraft.getMinecraft().thePlayer != null) { Minecraft.getMinecraft().thePlayer.swingItem(); } broken.add(closestStone); @@ -125,6 +125,8 @@ public class HardstoneAura { } private BlockPos closestStone() { + if(Minecraft.getMinecraft().theWorld == null) return null; + if(Minecraft.getMinecraft().thePlayer == null) return null; int r = 6; BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); @@ -162,6 +164,8 @@ public class HardstoneAura { } private Vec3 closestChest() { + if(Minecraft.getMinecraft().theWorld == null) return null; + if(Minecraft.getMinecraft().thePlayer == null) return null; int r = 6; BlockPos playerPos = Minecraft.getMinecraft().thePlayer.getPosition(); playerPos.add(0, 1, 0); |