diff options
Diffstat (limited to 'src/main/java/rosegoldaddons/features/GhostMacro.java')
-rw-r--r-- | src/main/java/rosegoldaddons/features/GhostMacro.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/main/java/rosegoldaddons/features/GhostMacro.java b/src/main/java/rosegoldaddons/features/GhostMacro.java index 8fb2dfc..79a7907 100644 --- a/src/main/java/rosegoldaddons/features/GhostMacro.java +++ b/src/main/java/rosegoldaddons/features/GhostMacro.java @@ -7,6 +7,7 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import rosegoldaddons.Main; import rosegoldaddons.utils.RenderUtils; import rosegoldaddons.utils.RotationUtils; @@ -15,23 +16,26 @@ import java.awt.*; import java.util.Random; public class GhostMacro { + private static Entity creeper; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (!Main.GhostMacro) return; + creeper = getClosestCreeper(); + if (creeper == null) return; + RotationUtils.faceEntity(creeper); + } + @SubscribeEvent public void renderWorld(RenderWorldLastEvent event) { - if (Main.GhostMacro) { - Entity entity1 = getClosestCreeper(); - if (entity1 == null) return; - RenderUtils.drawEntityBox(entity1, Color.RED, true, event.partialTicks); - RotationUtils.faceEntity(entity1); - Random r = new Random(); - if(r.nextInt(800) == 1) { - RotationUtils.antiAfk(); - } - } + if (!Main.GhostMacro) return; + if (creeper == null) return; + RenderUtils.drawEntityBox(creeper, Color.RED, true, event.partialTicks); } private static Entity getClosestCreeper() { Entity eman = null; - Double closest = Double.valueOf(9999); + double closest = 9999.0; 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); @@ -39,7 +43,8 @@ public class GhostMacro { if(Main.configFile.macroRadius != 0 && dist < Main.configFile.macroRadius) { closest = dist; eman = entity1; - } if(Main.configFile.macroRadius == 0) { + } + if(Main.configFile.macroRadius == 0) { closest = dist; eman = entity1; } |