From 42e10338f773cd444c92e21e83f4609140bc278a Mon Sep 17 00:00:00 2001 From: CuzImClicks Date: Sun, 14 Mar 2021 17:17:24 +0100 Subject: completely reworked ArachneESP due to performance issues --- src/main/java/me/Danker/features/ArachneESP.java | 44 ++++++++---------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/src/main/java/me/Danker/features/ArachneESP.java b/src/main/java/me/Danker/features/ArachneESP.java index 6187eed..d31a0bd 100644 --- a/src/main/java/me/Danker/features/ArachneESP.java +++ b/src/main/java/me/Danker/features/ArachneESP.java @@ -42,7 +42,7 @@ public class ArachneESP { arachne = null; } - public boolean isSpidersDen(List scoreboard) { + public boolean inSpidersDen(List scoreboard) { for (String s : scoreboard) { if (ScoreboardHandler.cleanSB(s).contains("Spiders Den")) { return true; @@ -51,49 +51,35 @@ public class ArachneESP { return false; } - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (!Utils.inSkyblock) return; - if (event.phase != TickEvent.Phase.START) return; - - World world = Minecraft.getMinecraft().theWorld; - if (DankersSkyblockMod.tickAmount % 2 == 0 && ToggleCommand.highlightArachne) { - if (world != null) { - - List entities = world.getLoadedEntityList(); - List scoreboard = ScoreboardHandler.getSidebarLines(); - if (!isSpidersDen(scoreboard)) return; - if (!arachneActive) return; - for (Entity e : entities) { - if (e.getName().contains("Arachne") && !e.getName().contains("Arachne's Brood")) { - arachne = e; - } - } - } - } - } - @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!Utils.inSkyblock) return; + if (!inSpidersDen(ScoreboardHandler.getSidebarLines())) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); if (message.contains("Something is awakening")){ arachneActive = true; + World world = Minecraft.getMinecraft().theWorld; + List entities = world.getLoadedEntityList(); + for (Entity e : entities) { + if (e.getName().contains("Arachne") && !e.getName().contains("Arachne's Brood")) { + arachne = e; + } + } } if (message.contains("ARACHNE DOWN!")) { arachneActive = false; + arachne = null; } } - @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (!Utils.inSkyblock) return; - if (arachneActive && ToggleCommand.highlightArachne) { - if (arachne != null) { - AxisAlignedBB aabb = new AxisAlignedBB(arachne.posX - 0.5, arachne.posY - 1, arachne.posZ - 0.5, arachne.posX + 0.5, arachne.posY, arachne.posZ + 0.5); - Utils.draw3DBox(aabb, ARACHANE_COLOUR, event.partialTicks); - } + if (arachne != null) { + if (arachneActive && ToggleCommand.highlightArachne) { + AxisAlignedBB aabb = new AxisAlignedBB(arachne.posX - 0.5, arachne.posY - 1, arachne.posZ - 0.5, arachne.posX + 0.5, arachne.posY, arachne.posZ + 0.5); + Utils.draw3DBox(aabb, ARACHANE_COLOUR, event.partialTicks); + } } } -- cgit