From ca32b718a5d5a057f6e01ae97bafbb0e75fecc4b Mon Sep 17 00:00:00 2001 From: "Moritz Tim W." <90388353+moritz-t-w@users.noreply.github.com> Date: Tue, 7 Nov 2023 21:45:23 +0100 Subject: [PATCH] improve efficiency by checking settings first --- .../systems/modules/misc/AutoLog.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoLog.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoLog.java index 9cd1e5de18..d56e0f100e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoLog.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AutoLog.java @@ -112,24 +112,26 @@ private void onTick(TickEvent.Post event) { if (toggleOff.get()) this.toggle(); } - for (Entity entity : mc.world.getEntities()) { - if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) { - if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) { - disconnect("A non-trusted player appeared in your render distance."); + if (onlyTrusted.get() || instantDeath.get() || crystalLog.get()) { // only check all entities if needed + for (Entity entity : mc.world.getEntities()) { + if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) { + if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) { + disconnect("A non-trusted player appeared in your render distance."); + if (toggleOff.get()) this.toggle(); + break; + } + if (instantDeath.get() && PlayerUtils.isWithin(entity, 8) && DamageUtils.getSwordDamage((PlayerEntity) entity, true) + > playerHealth + mc.player.getAbsorptionAmount()) { + disconnect("Anti-32k measures."); if (toggleOff.get()) this.toggle(); break; + } } - if (PlayerUtils.isWithin(entity, 8) && instantDeath.get() && DamageUtils.getSwordDamage((PlayerEntity) entity, true) - > playerHealth + mc.player.getAbsorptionAmount()) { - disconnect("Anti-32k measures."); + if (crystalLog.get() && entity instanceof EndCrystalEntity && PlayerUtils.isWithin(entity, range.get())) { + disconnect("End Crystal appeared within specified range."); if (toggleOff.get()) this.toggle(); - break; } } - if (entity instanceof EndCrystalEntity && PlayerUtils.isWithin(entity, range.get()) && crystalLog.get()) { - disconnect("End Crystal appeared within specified range."); - if (toggleOff.get()) this.toggle(); - } } }