use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.
the class ObbyListener method update.
protected boolean update() {
if (updatePlaced()) {
return false;
}
module.slot = getSlot();
if (module.slot == -1) {
disableModule();
return false;
}
if (hasTimerNotPassed()) {
return false;
}
TargetResult result = getTargets(new TargetResult());
targets = result.getTargets();
return result.isValid();
}
use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.
the class ListenerWebAura method getTargets.
@Override
protected TargetResult getTargets(TargetResult result) {
switch(module.target.getValue()) {
case Closest:
module.currentTarget = EntityUtil.getClosestEnemy();
if (module.currentTarget == null || module.currentTarget.getDistanceSq(mc.player) > MathUtil.square(module.targetRange.getValue())) {
return result.setValid(false);
}
return trap(module.currentTarget, result);
case Untrapped:
module.currentTarget = null;
List<EntityPlayer> players = new ArrayList<>();
for (EntityPlayer player : mc.world.playerEntities) {
if (player == null || EntityUtil.isDead(player) || Managers.FRIENDS.contains(player) || player.equals(mc.player)) {
continue;
}
BlockPos pos = new BlockPos(player);
if (mc.world.getBlockState(pos).getBlock() == Blocks.WEB || mc.world.getBlockState(pos.up()).getBlock() == Blocks.WEB) {
continue;
}
if (mc.player.getDistanceSq(player) < MathUtil.square(module.targetRange.getValue())) {
players.add(player);
}
}
players.sort(Comparator.comparingDouble(p -> p.getDistanceSq(mc.player)));
for (EntityPlayer player : players) {
trap(player, result);
}
return result;
default:
return result.setValid(false);
}
}
use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.
the class ListenerObby method getTargets.
@Override
protected TargetResult getTargets(TargetResult result) {
if (module.calcTimer.passed(module.calcDelay.getValue())) {
HoleRunnable runnable = new HoleRunnable(module, module);
runnable.run();
module.calcTimer.reset();
}
List<BlockPos> targets = new ArrayList<>(module.safes.size() + module.unsafes.size() + module.longs.size() + module.bigs.size());
targets.addAll(module.safes);
targets.addAll(module.unsafes);
if (module.longHoles.getValue()) {
targets.addAll(module.longs);
}
if (module.bigHoles.getValue()) {
targets.addAll(module.bigs);
}
BlockPos playerPos = PositionUtil.getPosition();
if (!HoleUtil.isHole(playerPos, false)[0] && !HoleUtil.is2x1(playerPos) && !HoleUtil.is2x2(playerPos) && (!module.safety.getValue() || !Managers.SAFETY.isSafe())) {
EntityPlayer p = RotationUtil.getRotationPlayer();
Vec3d v = p.getPositionVector().add(p.motionX, p.motionY, p.motionZ);
targets.removeIf(pos -> pos.distanceSq(v.x, v.y, v.z) < MathUtil.square(module.minSelf.getValue()));
// place furthest first
targets.sort(Comparator.comparingDouble(pos -> -BlockUtil.getDistanceSq(pos)));
}
module.target = EntityUtil.getClosestEnemy();
if (module.target != null) {
targets.removeIf(p -> BlockUtil.getDistanceSq(module.target, p) > MathUtil.square(module.targetDistance.getValue()));
targets.sort(Comparator.comparingDouble(p -> BlockUtil.getDistanceSq(module.target, p)));
}
result.setTargets(targets);
return result;
}
Aggregations