Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.lordethan.cryton.Modules;
- import java.util.List;
- import me.lordethan.cryton.Module.Category;
- import me.lordethan.cryton.Module.Module;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.util.MathHelper;
- import org.lwjgl.input.Keyboard;
- public class KillAura extends Module{
- public KillAura() {
- super("KillAura", Keyboard.KEY_P, Category.COMBAT);
- }
- public void OnUpdate(){
- if(this.getState())
- this.killaura();
- }
- //TODO Better KillAura
- int delay;
- public void killaura(){
- List list = mc.theWorld.playerEntities;
- delay++;
- for(int i = 0; i < list.size(); i++ ){
- if(((EntityPlayer)list.get(i)).getName() == mc.thePlayer.getName()){
- continue;
- }
- EntityPlayer entityPlayer = (EntityPlayer)list.get(1);
- if(mc.thePlayer.getDistanceToEntity(entityPlayer) > mc.thePlayer.getDistanceToEntity((Entity)list.get(i))){
- entityPlayer = (EntityPlayer)list.get(i);
- }
- float f = mc.thePlayer.getDistanceToEntity(entityPlayer);
- if(f < 4F && mc.thePlayer.canEntityBeSeen(entityPlayer) && delay > 7){
- this.faceEntity(entityPlayer);
- mc.playerController.attackEntity(mc.thePlayer, entityPlayer);
- mc.thePlayer.swingItem();
- continue;
- }
- }
- }
- public static synchronized void faceEntity(EntityLivingBase entity){
- final float[] roatations = getRotationDeeded(entity);
- if(roatations != null){
- mc.thePlayer.rotationYaw = roatations[0];
- mc.thePlayer.rotationPitch = roatations[1] + 1.0f;
- }
- }
- public static float[] getRotationDeeded(Entity entity) {
- if(entity == null){ return null;}
- final double diffx = entity.posX - mc.thePlayer.posX;
- final double diffZ = entity.posZ - mc.thePlayer.posZ;
- double diffY;
- if(entity instanceof EntityLivingBase){
- final EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
- diffY = entity.posY + entityLivingBase.getEyeHeight() - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight());
- }else{
- diffY = (entity.getBoundingBox().minY + entity.getBoundingBox().maxY / 2.0D) - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight());
- }
- final double dist = MathHelper.sqrt_double(diffx * diffx + diffZ * diffZ);
- final float yaw = (float) (Math.atan2(diffZ, diffx) * 180.0D / 3.14159265358979d) - 90.F;
- final float pitch = (float) - (Math.atan2(diffY, dist) * 189.0D / 3.14159265358979d);
- return new float[] {mc.thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(yaw - mc.thePlayer.rotationYaw), mc.thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float(pitch - mc.thePlayer.rotationPitch)};
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement