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;
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; }
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 ";