Pan4ur / ThunderHack-Recode

1.20.6 minecraft client for Crystal / Sword hvh
https://thunderhack.onrender.com/
GNU General Public License v3.0
216 stars 55 forks source link

aura里面的attackMobsIfNoPlayers模块有点问题 #412

Open uauawa opened 2 weeks ago

uauawa commented 2 weeks ago

A44AEA72DE7AABE436CECBAB0A61F86B

In this case, this module can't be opened, and it's very brain-dead It should be changed to: public final Setting attackMobsIfNoPlayers = new Setting<>("AttackMobIfNoPlayers", new BooleanSettingGroup(false)); public final Setting offRange = new Setting<>("offRange", 5f, 1f, 20f).addToGroup(attackMobsIfNoPlayers); private final Setting notification = new Setting<>("Notification", true).addToGroup(attackMobsIfNoPlayers);

private boolean offreachboolean;

Plus distance determination:

public boolean havePlayersNear(double distance) { PlayerEntity player = mc.player; if (player == null || mc.world == null) { return false; }

    Vec3d playerPos = player.getPos();

    for (PlayerEntity pl : mc.world.getPlayers()) {
        if (pl != player && !ThunderHack.friendManager.isFriend(pl)) {
            Vec3d otherPos = pl.getPos();
            double distSq = playerPos.distanceTo(otherPos);

            if (distSq <= distance) {
                return true;
            }
        }
    }
    return false;
}

The module that controls the MOBS to turn on and off is changed to:

if(havePlayersNear(offRange.getValue()) && attackMobsIfNoPlayers.getValue().isEnabled()){ Mobs.setValue(false); if (notification.getValue()&&offreachboolean) { String content1; if (isRu()) content1 = Formatting.WHITE + "В радиусе" + Formatting.RED + offRange.getValue() +Formatting.WHITE + "кварталов есть игроки!" + " Модуль атаки мобов" +Formatting.RED+ " Off "; else content1 = Formatting.WHITE + "There are players within" + Formatting.RED + offRange.getValue() +Formatting.WHITE + "blocks!" + " AttackMobs Module is" +Formatting.RED+ " Off ";

            ThunderHack.notificationManager.publicity("Aura", content1, 2, Notification.Type.INFO);
            offreachboolean=false;
        }

    }
    else if (!havePlayersNear(offRange.getValue())  && attackMobsIfNoPlayers.getValue().isEnabled()){
        Mobs.setValue(true);
        if (notification.getValue()&&!offreachboolean) {
            String content2;
            if (isRu())
                content2 = Formatting.WHITE + "В радиусе" + Formatting.RED + offRange.getValue() +Formatting.WHITE  + "блоков нет игроков!" + " Модуль атаки мобов" +Formatting.RED+ " On ";
            else
                content2 = Formatting.WHITE + "There are no players within" + Formatting.RED + offRange.getValue() +Formatting.WHITE  + "blocks!" + " AttackMobs Module is" +Formatting.GREEN+ " On ";
            ThunderHack.notificationManager.publicity("Aura", content2, 2, Notification.Type.INFO);
            offreachboolean=true;
        }
    }else  offreachboolean=true;
Pan4ur commented 2 weeks ago

@EbatteSratte brain dead