Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //use this code to get the angle in degrees, ive changed it so it reverses the angle to oopsite of facing entitiy
- double var16 = this.posX - this.entityToAttack.posX;
- double var18 = this.posZ - this.entityToAttack.posZ;
- this.rotationYaw = (float)(Math.atan2(var18, var16) * 180.0D / 3.1415927410125732D) - 90.0F;
- //now, using that angle, get a new relative position based on your entities coords, fyi center = this, in your case
- //offset angle
- float look = 0F;
- //distance, might wanna use 8 or something
- double dist = 1F;
- double gatherX = center.posX + ((double)(-Math.sin((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
- double gatherY = center.posY-0.5 + (double)(-MathHelper.sin(center.rotationPitch / 180.0F * 3.1415927F) * dist) - 0D; //center.posY - 0D;
- double gatherZ = center.posZ + ((double)(Math.cos((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
- //now you have coords to try, do basic checks like if its a valid movable to location then pathfind to it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement