forked from RepoMirrors/kami-blue
Merge pull request #134 from blockparole/aura
Aura: added tick delay wait mode
This commit is contained in:
commit
30d296d9c8
|
@ -23,20 +23,23 @@ import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by 086 on 12/12/2017.
|
* Created by 086 on 12/12/2017.
|
||||||
* Updated by hub on 27 October 2019
|
* Updated by hub on 31 October 2019
|
||||||
*/
|
*/
|
||||||
@Module.Info(name = "Aura", category = Module.Category.COMBAT, description = "Hits entities around you")
|
@Module.Info(name = "Aura", category = Module.Category.COMBAT, description = "Hits entities around you")
|
||||||
public class Aura extends Module {
|
public class Aura extends Module {
|
||||||
|
|
||||||
private Setting<Boolean> players = register(Settings.b("Players", true));
|
private Setting<Boolean> attackPlayers = register(Settings.b("Players", true));
|
||||||
private Setting<Boolean> animals = register(Settings.b("Animals", false));
|
private Setting<Boolean> attackMobs = register(Settings.b("Mobs", false));
|
||||||
private Setting<Boolean> mobs = register(Settings.b("Mobs", false));
|
private Setting<Boolean> attackAnimals = register(Settings.b("Animals", false));
|
||||||
private Setting<Double> range = register(Settings.d("Range", 5.5d));
|
private Setting<Double> hitRange = register(Settings.d("Hit Range", 5.5d));
|
||||||
private Setting<Boolean> wait = register(Settings.b("Wait", true));
|
private Setting<Boolean> ignoreWalls = register(Settings.b("Ignore Walls", true));
|
||||||
private Setting<Boolean> walls = register(Settings.b("Walls", false));
|
private Setting<WaitMode> waitMode = register(Settings.e("Mode", WaitMode.DYNAMIC));
|
||||||
private Setting<Boolean> switchTo32k = register(Settings.b("32k Switch", false));
|
private Setting<Integer> waitTick = register(Settings.integerBuilder("Tick Delay").withMinimum(0).withValue(3).withVisibility(o -> waitMode.getValue().equals(WaitMode.STATIC)).build());
|
||||||
|
private Setting<Boolean> switchTo32k = register(Settings.b("32k Switch", true));
|
||||||
private Setting<Boolean> onlyUse32k = register(Settings.b("32k Only", false));
|
private Setting<Boolean> onlyUse32k = register(Settings.b("32k Only", false));
|
||||||
|
|
||||||
|
private int waitCounter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
|
|
||||||
|
@ -49,7 +52,7 @@ public class Aura extends Module {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait.getValue()) {
|
if (waitMode.getValue().equals(WaitMode.DYNAMIC)) {
|
||||||
if (mc.player.getCooledAttackStrength(getLagComp()) < 1) {
|
if (mc.player.getCooledAttackStrength(getLagComp()) < 1) {
|
||||||
return;
|
return;
|
||||||
} else if (mc.player.ticksExisted % 2 != 0) {
|
} else if (mc.player.ticksExisted % 2 != 0) {
|
||||||
|
@ -57,6 +60,15 @@ public class Aura extends Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (waitMode.getValue().equals(WaitMode.STATIC) && waitTick.getValue() > 0) {
|
||||||
|
if (waitCounter < waitTick.getValue()) {
|
||||||
|
waitCounter++;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
waitCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<Entity> entityIterator = Minecraft.getMinecraft().world.loadedEntityList.iterator();
|
Iterator<Entity> entityIterator = Minecraft.getMinecraft().world.loadedEntityList.iterator();
|
||||||
while (entityIterator.hasNext()) {
|
while (entityIterator.hasNext()) {
|
||||||
Entity target = entityIterator.next();
|
Entity target = entityIterator.next();
|
||||||
|
@ -66,23 +78,23 @@ public class Aura extends Module {
|
||||||
if (target == mc.player) {
|
if (target == mc.player) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (mc.player.getDistance(target) > range.getValue()) {
|
if (mc.player.getDistance(target) > hitRange.getValue()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (((EntityLivingBase) target).getHealth() <= 0) {
|
if (((EntityLivingBase) target).getHealth() <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (((EntityLivingBase) target).hurtTime != 0 && wait.getValue()) {
|
if (waitMode.getValue().equals(WaitMode.DYNAMIC) && ((EntityLivingBase) target).hurtTime != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!walls.getValue() && (!mc.player.canEntityBeSeen(target) && !canEntityFeetBeSeen(target))) {
|
if (!ignoreWalls.getValue() && (!mc.player.canEntityBeSeen(target) && !canEntityFeetBeSeen(target))) {
|
||||||
continue; // If walls is on & you can't see the feet or head of the target, skip. 2 raytraces needed
|
continue; // If walls is on & you can't see the feet or head of the target, skip. 2 raytraces needed
|
||||||
}
|
}
|
||||||
if (players.getValue() && target instanceof EntityPlayer && !Friends.isFriend(target.getName())) {
|
if (attackPlayers.getValue() && target instanceof EntityPlayer && !Friends.isFriend(target.getName())) {
|
||||||
attack(target);
|
attack(target);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (EntityUtil.isPassive(target) ? animals.getValue() : (EntityUtil.isMobAggressive(target) && mobs.getValue())) {
|
if (EntityUtil.isPassive(target) ? attackAnimals.getValue() : (EntityUtil.isMobAggressive(target) && attackMobs.getValue())) {
|
||||||
// We want to skip this if switchTo32k.getValue() is true,
|
// We want to skip this if switchTo32k.getValue() is true,
|
||||||
// because it only accounts for tools and weapons.
|
// because it only accounts for tools and weapons.
|
||||||
// Maybe someone could refactor this later? :3
|
// Maybe someone could refactor this later? :3
|
||||||
|
@ -168,7 +180,7 @@ public class Aura extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getLagComp() {
|
private float getLagComp() {
|
||||||
if (wait.getValue()) {
|
if (waitMode.getValue().equals(WaitMode.DYNAMIC)) {
|
||||||
return -(20 - LagCompensator.INSTANCE.getTickRate());
|
return -(20 - LagCompensator.INSTANCE.getTickRate());
|
||||||
}
|
}
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
|
@ -178,4 +190,8 @@ public class Aura extends Module {
|
||||||
return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null;
|
return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum WaitMode {
|
||||||
|
DYNAMIC, STATIC
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue