Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MovingObjectPosition getAimBlock(int yOffset, boolean noYaw) {
- EntityLiving entityliving = this;
- float f = 1.0F;
- float f1 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
- float f3 = entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * f;
- if (noYaw) f3 = 0.00001F;
- //int i = (int)Math.floor((double)(f3 / 90F) + 0.5D);
- //f3 = (float)i * 90F;
- double d = entityliving.prevPosX + (entityliving.posX - entityliving.prevPosX) * (double)f;
- double d1 = ((entityliving.prevPosY + (entityliving.posY - entityliving.prevPosY) * (double)f + 1.6200000000000001D)) - (double)entityliving.yOffset + yOffset;
- double d2 = entityliving.prevPosZ + (entityliving.posZ - entityliving.prevPosZ) * (double)f;
- Vec3D vec3d = Vec3D.createVector(d, d1, d2);
- float f4 = MathHelper.cos(-f3 * 0.01745329F - 3.141593F);
- float f5 = MathHelper.sin(-f3 * 0.01745329F - 3.141593F);
- float f6 = -MathHelper.cos(-f1 * 0.01745329F - 0.7853982F);
- float f7 = MathHelper.sin(-f1 * 0.01745329F - 0.7853982F);
- float f8 = f5 * f6;
- float f9 = f7;
- float f10 = f4 * f6;
- //entityliving.info = f3;
- double d3 = 2.0D;
- Vec3D vec3d1 = vec3d.addVector((double)f8 * d3, (double)f9 * d3, (double)f10 * d3); // \/ water collide check
- MovingObjectPosition movingobjectposition = entityliving.worldObj.rayTraceBlocks_do(vec3d, vec3d1, true);
- int id = -1;
- if(movingobjectposition == null) {
- return null;
- }
- if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
- //id = worldObj.getBlockId(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
- //System.out.println(movingobjectposition.blockX + " - " + movingobjectposition.blockY + " - " + movingobjectposition.blockZ);
- }
- return movingobjectposition;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement