- Joined
- Jul 11, 2020
- Messages
- 0
- Reaction score
- 25
- Points
- 0
Code:
package de.oculus.module.modules.combat;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import de.giants.event.Event;
import de.giants.event.events.PreMotionEvent;
import de.oculus.Oculus;
import de.oculus.module.Category;
import de.oculus.module.Module;
import de.oculus.utils.ChatUtils;
import de.oculus.utils.PlayerUtils;
import de.oculus.utils.RayCastUtils;
import de.oculus.utils.RotationUtil;
import de.oculus.utils.TimeUtils;
import de.oculus.values.Value;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.IAnimals;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
public class Aura extends Module {
TimeUtils delay = new TimeUtils();
Random r = new Random();
private Entity mainTarget;
public boolean canBeHit = false;
public static float yaw;
public static float pitch;
public Aura(String name, Category category) {
super(name, category);
}
@Override
protected void initModule() {
ArrayList<String> values = new ArrayList<>();
Oculus.instance.valuesManager.addValueToList(new Value("AuraParty", "Party", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraPredict", "Predict", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AutoSwordAura", "SwordAura", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraAAC", "AAC", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraNoSwing", "NoSwing", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraCrack", "Crack", true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraRange", "Range", 4, 1, 7, true, this));
Oculus.instance.valuesManager.addValueToList(new Value("AuraDelay", "Delay", 130, 3, 350, true, this));
super.initModule();
}
@Override
public void onEvent(Event e) {
if (e instanceof PreMotionEvent) {
PreMotionEvent event = (PreMotionEvent) e;
for (Object j : mc.theWorld.loadedEntityList) {
Entity e1 = (Entity) j;
mainTarget = e1;
if (checkTarget(mainTarget)) {
this.faceEntity(mainTarget);
setRotations(yaw, pitch, event);
}
} // [email protected]:nate123
}
if (delay.isDelayComplete((long) (Oculus.instance.valuesManager.findValueWithName("AuraDelay").getNumValue()
+ new Random().nextInt(8)))) {
this.delay.resetDelay();
for (Object j : mc.theWorld.loadedEntityList) {
Entity e1 = (Entity) j;
if (((e1 instanceof EntityLivingBase)) && (!(e1 instanceof EntityPlayerSP)) && (e1 != mc.thePlayer)
&& (!(e1 instanceof IAnimals)) && (!(e1 instanceof EntityVillager)) && (checkTarget(e1))) {
this.mainTarget = e1;
float[] rotations = RotationUtil.rotations(e1);
if ((e1 != null) && (rotations != null)) {
sendPacket(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, true));
// faceEntity(e1);
if (mc.thePlayer.onGround) {
sendPacket(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, true));
}
mc.playerController.attackEntity(mc.thePlayer, e1);
}
// [email protected]:pokemon34
// e1 = (Entity) RayCastUtil.getRaycastUtil()
// .getRealMouseOver(this.mc.thePlayer.getDistanceToEntity(e1),
// (EntityLivingBase) e1);
if (Oculus.instance.valuesManager.findValueWithName("AuraAAC").getBoolValue()) {
if (RayCastUtils.raycast(e1) != null) {
e1 = RayCastUtils.raycast(e1);
ChatUtils.sendClientMessage("ray");
}
if (Oculus.instance.valuesManager.findValueWithName("AuraNoSwing").getBoolValue()) {
mc.thePlayer.sendQueue
.addToSendQueue(new C02PacketUseEntity(e1, C02PacketUseEntity.Action.ATTACK));
mc.playerController.attackEntity(mc.thePlayer, e1);
} else {
mc.thePlayer.swingItem();
mc.thePlayer.sendQueue
.addToSendQueue(new C02PacketUseEntity(e1, C02PacketUseEntity.Action.ATTACK));
mc.playerController.attackEntity(mc.thePlayer, e1);
mc.thePlayer.setSprinting(true);
}
if (mc.thePlayer.isBlocking()) {
mc.thePlayer.swingItem();
mc.thePlayer.sendQueue
.addToSendQueue(new C02PacketUseEntity(e1, C02PacketUseEntity.Action.ATTACK));
mc.playerController.attackEntity(mc.thePlayer, e1);
}
}
if (Oculus.instance.valuesManager.findValueWithName("AutoSwordAura").getBoolValue()) {
mc.thePlayer.inventory.currentItem = new PlayerUtils().getBestWeaponInHotbar();
}
if (Oculus.instance.valuesManager.findValueWithName("AuraCrack").getBoolValue()) {
for (int i = 0; i < 2; i++)
mc.effectRenderer.emitParticleAtEntity(e1, EnumParticleTypes.CRIT);
}
}
}
}
}
public boolean checkEntityID(Entity target) {
boolean check;
if ((target.getEntityId() <= 1070000000) && (target.getEntityId() > -1)) {
check = true;
} else {
check = false;
}
return check;
}
public boolean checkTarget(Entity target) {
if (target == null) {
return false;
}
if (target.isDead) {
return false;
}
if (target.getName().equalsIgnoreCase("Dealer")) {
return false;
}
if ((mc.currentScreen != null) && ((mc.currentScreen instanceof GuiInventory))) {
return false;
}
if (target.getName() == mc.thePlayer.getName()) {
return false;
}
if (target == mc.thePlayer) {
return false;
}
if (!checkEntityID(target)) {
return false;
}
if (target.isInvisible()) {
return false;
}
if (!mc.thePlayer.canEntityBeSeen(target)) {
return false;
}
if (mc.thePlayer.getDistanceToEntity(target) > Oculus.instance.valuesManager.findValueWithName("AuraRange")
.getNumValue()) {
return false;
}
return true;
}
public void faceEntity(Entity target) {
float[] rotations = RotationUtil.rotations(target);
if (rotations != null) {
yaw = rotations[0] + new Random().nextInt(7);
pitch = rotations[1] - new Random().nextInt(7);
;
}
}
public void setRotations(float yaw, float pitch, PreMotionEvent playerEntity) {
playerEntity.setYaw(yaw);
playerEntity.setPitch(pitch);
}
public void sendPacket(Packet packet) {
}
@Override
public void onUpdate() {
}
}
Die rotations
public float[] rotations(final Entity target) {
double xDelta = target.posX + (target.posX - target.prevPosX) - target.lastTickPosX;
double zDelta = target.posZ + (target.posZ - target.prevPosZ) - target.lastTickPosZ;
double d = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(target);
d -= d % 0.8D;
double xMulti = 1.0D;
double zMulti = 1.0D;
boolean sprint = target.isSprinting();
xMulti = d / 0.8D * xDelta * (sprint ? 1.25D : 1.0D);
zMulti = d / 0.8D * zDelta * (sprint ? 1.25D : 1.0D);
double x = target.posX + xMulti - Minecraft.getMinecraft().thePlayer.posX;
double z = target.posZ + zMulti - Minecraft.getMinecraft().thePlayer.posZ;
double y = Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()
- (target.posY + target.getEyeHeight());
double dist = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(target);
float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90.0F;
float pitch = (float) Math.toDegrees(Math.atan2(y, dist));
return new float[] { yaw, pitch };
}
Edit by Aui: Added Code Tags
Last edited by a moderator: