From 5e1870a01cfd3a253f17aae1c27aee9cdaa5ab70 Mon Sep 17 00:00:00 2001 From: CuzImClicks Date: Sat, 13 Mar 2021 18:24:51 +0100 Subject: completed SlayerESP --- src/main/java/me/Danker/features/SlayerESP.java | 33 +++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/main/java/me/Danker/features') diff --git a/src/main/java/me/Danker/features/SlayerESP.java b/src/main/java/me/Danker/features/SlayerESP.java index fb17135..79fc634 100644 --- a/src/main/java/me/Danker/features/SlayerESP.java +++ b/src/main/java/me/Danker/features/SlayerESP.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -46,10 +47,19 @@ public class SlayerESP { 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) { + if (DankersSkyblockMod.tickAmount % 2 == 0 && ToggleCommand.highlightSlayers) { if (world != null) { + for (String line : ScoreboardHandler.getSidebarLines()) { + + String cleanedLine = ScoreboardHandler.cleanSB(line); + if (cleanedLine.contains("Slay the boss!")) { + slayerActive = true; + break; + } + } + if (!slayerActive) return; List entities = world.getLoadedEntityList(); for (Entity e : entities) { System.out.println(e.getName()); @@ -68,32 +78,19 @@ public class SlayerESP { @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { - //if (!Utils.inSkyblock) return; + if (!Utils.inSkyblock) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); if (message.contains("SLAYER QUEST COMPLETE!")) { slayerActive = false; } } - @SubscribeEvent - public void onAttackingEntity(AttackEntityEvent event) { - if (event.target instanceof EntityZombie || event.target instanceof EntitySpider || event.target instanceof EntityWolf) { - List scoreboard = ScoreboardHandler.getSidebarLines(); - for (String line : scoreboard) { - String cleanedLine = ScoreboardHandler.cleanSB(line); - if (cleanedLine.contains("Slay the boss!")) { - slayerActive = true; - break; - } - } - } - } @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { - //if (!Utils.inSkyblock) return; - if (slayerActive) { + if (!Utils.inSkyblock) return; + if (slayerActive && ToggleCommand.highlightSlayers) { if (zombie != null) { AxisAlignedBB aabb = new AxisAlignedBB(zombie.posX - 0.5, zombie.posY - 2, zombie.posZ - 0.5, zombie.posX + 0.5, zombie.posY, zombie.posZ + 0.5); Utils.draw3DBox(aabb, SLAYER_COLOUR, event.partialTicks); -- cgit