diff options
Diffstat (limited to 'src')
7 files changed, 57 insertions, 27 deletions
diff --git a/src/main/java/rosegoldaddons/Main.java b/src/main/java/rosegoldaddons/Main.java index 6ca7fc0..16d8dd5 100644 --- a/src/main/java/rosegoldaddons/Main.java +++ b/src/main/java/rosegoldaddons/Main.java @@ -10,8 +10,10 @@ import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; @@ -54,6 +56,7 @@ public class Main { public static boolean nukeWood = false; public static boolean placeCane = false; private static boolean firstLoginThisSession = true; + private static boolean oldanim = false; //Hello decompiler and / or source code checker! this is just some funny stuff, you do not have to worry about it! private final String[] cumsters = {"W0FETUlOXSBNaW5pa2xvb24=", "W0FETUlOXSBQbGFuY2tl", "W0FETUlOXSBKYXlhdmFybWVu", "W0FETUlOXSBEY3Ry"}; @@ -175,6 +178,16 @@ public class Main { } } + @Mod.EventHandler + public void post(FMLPostInitializationEvent event) { + Loader.instance().getActiveModList().forEach(modContainer -> { + if (modContainer.getModId().equals("oldanimations")) { + oldanim = true; + } + }); + } + + @SubscribeEvent public void onConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { if(firstLoginThisSession) { @@ -185,9 +198,9 @@ public class Main { msg1.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://cheatersgetbanned.me")); ChatComponentText msg2 = new ChatComponentText("§0§7Thanks to Harry282 (SBClient):§b https://github.com/Harry282/Skyblock-Client"); msg2.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/Harry282/Skyblock-Client")); - ChatComponentText msg3 = new ChatComponentText("§0§7Thanks to pizza boy (Pizza Client): https://github.com/PizzaboiBestLegit/Pizza-Client"); + ChatComponentText msg3 = new ChatComponentText("§0§7Thanks to pizza boy (Pizza Client):§b https://github.com/PizzaboiBestLegit/Pizza-Client"); msg3.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://github.com/PizzaboiBestLegit/Pizza-Client")); - ChatComponentText msg4 = new ChatComponentText("§0§7Check out the RoseGoldAddons Discord Server!"); + ChatComponentText msg4 = new ChatComponentText("§0§7Check out the RoseGoldAddons §bDiscord Server!"); msg4.setChatStyle(ChatUtils.createClickStyle(ClickEvent.Action.OPEN_URL, "https://discord.gg/Tmk2hwzdxm")); Minecraft.getMinecraft().thePlayer.addChatMessage(msg1); Minecraft.getMinecraft().thePlayer.addChatMessage(msg2); @@ -199,6 +212,16 @@ public class Main { } }).start(); } + if(oldanim) { + new Thread(() -> { + try { + Thread.sleep(6000); + ChatUtils.sendMessage("§l§4Old Animations Mod was detected in your mods folder. This mod breaks some key RoseGoldAddons features, please uninstall it before asking for support as it is known to cause a lot of issues. Thanks."); + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + } } @SubscribeEvent 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); diff --git a/src/main/java/rosegoldaddons/utils/ChatUtils.java b/src/main/java/rosegoldaddons/utils/ChatUtils.java index 4295c77..43107eb 100644 --- a/src/main/java/rosegoldaddons/utils/ChatUtils.java +++ b/src/main/java/rosegoldaddons/utils/ChatUtils.java @@ -18,7 +18,9 @@ public class ChatUtils { /* § */ public static void sendMessage(String message) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] "+message)); + if (Minecraft.getMinecraft().thePlayer != null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§f[§aRoseGoldAddons§f] " + message)); + } } public static ChatStyle createClickStyle(ClickEvent.Action action, String value) { |