diff options
author | CuzImClicks <bruno778.whiteelfie@gmail.com> | 2021-03-14 17:17:24 +0100 |
---|---|---|
committer | CuzImClicks <bruno778.whiteelfie@gmail.com> | 2021-03-14 17:17:24 +0100 |
commit | 42e10338f773cd444c92e21e83f4609140bc278a (patch) | |
tree | 657f62dd8d0787d4ae3cac8dcd532fa8ba99ac86 | |
parent | 740d6b33cb227ea0e2699e1bc24003463ec28d52 (diff) | |
download | SkyblockMod-42e10338f773cd444c92e21e83f4609140bc278a.tar.gz SkyblockMod-42e10338f773cd444c92e21e83f4609140bc278a.tar.bz2 SkyblockMod-42e10338f773cd444c92e21e83f4609140bc278a.zip |
completely reworked ArachneESP due to performance issues
-rw-r--r-- | src/main/java/me/Danker/features/ArachneESP.java | 44 |
1 files 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<String> scoreboard) { + public boolean inSpidersDen(List<String> scoreboard) { for (String s : scoreboard) { if (ScoreboardHandler.cleanSB(s).contains("Spiders Den")) { return true; @@ -52,48 +52,34 @@ public class ArachneESP { } @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<Entity> entities = world.getLoadedEntityList(); - List<String> 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<Entity> 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); + } } } |