Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ private void onSendPacket(PacketEvent.Send event) {
sendPacket(0.0625);
sendPacket(0);
}
case UpdatedNCP -> {
sendPacket(0.0000008);
sendPacket(0);
}
case Bypass -> {
sendPacket(0.11);
sendPacket(0.1100013579);
Expand Down Expand Up @@ -174,9 +178,15 @@ private void sendPacket(double height) {
double y = mc.player.getY();
double z = mc.player.getZ();

PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround(x, y + height, z, false, mc.player.horizontalCollision);
((IPlayerMoveC2SPacket) packet).meteor$setTag(1337);
PlayerMoveC2SPacket packet;

if (mode.get() == Mode.UpdatedNCP) {
packet = new PlayerMoveC2SPacket.PositionAndOnGround(x, y + height, z, false, false);
} else {
packet = new PlayerMoveC2SPacket.PositionAndOnGround(x, y + height, z, false, mc.player.horizontalCollision);
}

((IPlayerMoveC2SPacket) packet).meteor$setTag(1337);
mc.player.networkHandler.sendPacket(packet);
}

Expand All @@ -195,6 +205,7 @@ public String getInfoString() {
public enum Mode {
None,
Packet,
UpdatedNCP,
Bypass,
Jump,
MiniJump
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.minecraft.util.Hand;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.GameMode;

import java.util.ArrayList;
Expand All @@ -49,6 +50,7 @@ public class KillAura extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final SettingGroup sgTargeting = settings.createGroup("Targeting");
private final SettingGroup sgTiming = settings.createGroup("Timing");
private final SettingGroup sgElytra = settings.createGroup("Elytra Target");

// General

Expand Down Expand Up @@ -248,13 +250,62 @@ public class KillAura extends Module {
.build()
);

// Elytra Target

private final Setting<Boolean> elytraTarget = sgElytra.add(new BoolSetting.Builder()
.name("elytra-target")
.description("Automatically flies towards the target when using Elytra.")
.defaultValue(false)
.build()
);

private final Setting<Double> extraRange = sgElytra.add(new DoubleSetting.Builder()
.name("extra-range")
.description("Extra range for the Elytra Target rotations.")
.defaultValue(2.0)
.min(0)
.sliderMax(10.0)
.visible(elytraTarget::get)
.build()
);

private final Setting<Double> predictMultiplier = sgElytra.add(new DoubleSetting.Builder()
.name("prediction")
.description("How much to predict target movement.")
.defaultValue(1.5)
.min(0)
.sliderMax(5.0)
.visible(elytraTarget::get)
.build()
);

private final Setting<Boolean> autoFirework = sgElytra.add(new BoolSetting.Builder()
.name("auto-firework")
.description("Uses fireworks to maintain speed and automatically chase targets that get too far away.")
.defaultValue(true)
.visible(elytraTarget::get)
.build()
);

private final Setting<Integer> fireworkDelay = sgElytra.add(new IntSetting.Builder()
.name("firework-delay")
.description("Ticks between using fireworks.")
.defaultValue(5)
.min(1)
.sliderMax(20)
.visible(autoFirework::get)
.build()
);

private final static ArrayList<Item> FILTER = new ArrayList<>(List.of(Items.DIAMOND_SWORD, Items.DIAMOND_AXE, Items.DIAMOND_PICKAXE, Items.DIAMOND_SHOVEL, Items.DIAMOND_HOE, Items.MACE, Items.DIAMOND_SPEAR, Items.TRIDENT));
private final List<Entity> targets = new ArrayList<>();
private int switchTimer, hitTimer;
private boolean wasPathing = false;
public boolean attacking, swapped;
public static int previousSlot;

private int fireworkTimer = 0;

public KillAura() {
super(Categories.Combat, "kill-aura", "Attacks specified entities around you.");
}
Expand All @@ -263,6 +314,7 @@ public KillAura() {
public void onActivate() {
previousSlot = -1;
swapped = false;
fireworkTimer = 0;
}

@Override
Expand Down Expand Up @@ -293,19 +345,15 @@ private void onTick(TickEvent.Pre event) {
stopAttacking();
return;
}

targets.clear();
if (onlyOnLook.get()) {
Entity targeted = mc.targetedEntity;

if (targeted == null || !entityCheck(targeted)) {
stopAttacking();
return;
if (targeted != null && entityCheck(targeted, true)) {
targets.add(targeted);
}

targets.clear();
targets.add(mc.targetedEntity);
} else {
targets.clear();
TargetUtils.getList(targets, this::entityCheck, priority.get(), maxTargets.get());
TargetUtils.getList(targets, entity -> entityCheck(entity, true), priority.get(), maxTargets.get());
}

if (targets.isEmpty()) {
Expand All @@ -315,6 +363,17 @@ private void onTick(TickEvent.Pre event) {

Entity primary = targets.getFirst();

boolean isElytraActive = elytraTarget.get() && ((LivingEntity)mc.player).isGliding();
if (isElytraActive) {
runElytraTarget(primary);
}

if (!entityCheck(primary, false)) {
attacking = false;
return;
}

// Auto Switch
if (autoSwitch.get()) {
FindItemResult weaponResult = new FindItemResult(mc.player.getInventory().getSelectedSlot(), -1);
if (attackWhenHolding.get() == AttackItems.Weapons) weaponResult = InvUtils.find(this::acceptableWeapon, 0, 8);
Expand All @@ -333,12 +392,16 @@ private void onTick(TickEvent.Pre event) {
}

if (!acceptableWeapon(mc.player.getMainHandStack())) {
stopAttacking();
attacking = false;
return;
}

attacking = true;
if (rotation.get() == RotationMode.Always) Rotations.rotate(Rotations.getYaw(primary), Rotations.getPitch(primary, Target.Body));

if (!isElytraActive) {
if (rotation.get() == RotationMode.Always) Rotations.rotate(Rotations.getYaw(primary), Rotations.getPitch(primary, Target.Body));
}

if (pauseOnCombat.get() && PathManagers.get().isPathing() && !wasPathing) {
PathManagers.get().pause();
wasPathing = true;
Expand All @@ -347,6 +410,55 @@ private void onTick(TickEvent.Pre event) {
if (delayCheck()) targets.forEach(this::attack);
}

private void runElytraTarget(Entity target) {
if (target == null) return;

// Eyes pos
Vec3d targetPos = new Vec3d(target.getX(), target.getY() + target.getEyeHeight(target.getPose()), target.getZ());

if (predictMultiplier.get() > 0) {
targetPos = targetPos.add(target.getVelocity().multiply(predictMultiplier.get()));
}

Vec3d playerPos = new Vec3d(mc.player.getX(), mc.player.getY(), mc.player.getZ());
Vec3d directionToTarget = targetPos.subtract(playerPos).normalize();
double distance = playerPos.distanceTo(targetPos);
double idealDist = 1;

Vec3d steerPos = targetPos;
if (distance < idealDist) {
steerPos = targetPos.subtract(directionToTarget.multiply(idealDist - distance));
}

Rotations.rotate(Rotations.getYaw(steerPos), Rotations.getPitch(steerPos), 10, null);

Vec3d steerVec = steerPos.subtract(playerPos).normalize();
double currentSpeed = mc.player.getVelocity().length();

if (currentSpeed > 0.1) {
Vec3d newVelocity = steerVec.multiply(currentSpeed);
mc.player.setVelocity(newVelocity.x, newVelocity.y, newVelocity.z);
}

// Auto Firework
if (autoFirework.get()) {
if (fireworkTimer > 0) {
fireworkTimer--;
} else {
if (currentSpeed < 1.0 || distance > (range.get() + 2.0)) {
FindItemResult firework = InvUtils.find(item -> item.getItem() == Items.FIREWORK_ROCKET);
if (firework.found()) {
int prevSlot = mc.player.getInventory().getSelectedSlot();
InvUtils.swap(firework.slot(), false);
mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
InvUtils.swap(prevSlot, false);
fireworkTimer = fireworkDelay.get();
}
}
}
}
}

@EventHandler
private void onSendPacket(PacketEvent.Send event) {
if (event.packet instanceof UpdateSelectedSlotC2SPacket) {
Expand Down Expand Up @@ -380,16 +492,21 @@ private boolean shouldShieldBreak() {
return false;
}

private boolean entityCheck(Entity entity) {
private boolean entityCheck(Entity entity, boolean useExtraRange) {
if (entity.equals(mc.player) || entity.equals(mc.getCameraEntity())) return false;
if ((entity instanceof LivingEntity livingEntity && livingEntity.isDead()) || !entity.isAlive()) return false;

double currentRange = range.get();
if (useExtraRange && elytraTarget.get() && ((LivingEntity)mc.player).isGliding()) {
currentRange += extraRange.get();
}

Box hitbox = entity.getBoundingBox();
if (!PlayerUtils.isWithin(
MathHelper.clamp(mc.player.getX(), hitbox.minX, hitbox.maxX),
MathHelper.clamp(mc.player.getY(), hitbox.minY, hitbox.maxY),
MathHelper.clamp(mc.player.getZ(), hitbox.minZ, hitbox.maxZ),
range.get()
currentRange
)) return false;

if (!entities.get().contains(entity.getType())) return false;
Expand Down