Examples of Vec3


Examples of net.minecraft.util.Vec3

    double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
    double d1 = player.prevPosY + (player.posY - player.prevPosY) * f;
    if (!world.isRemote && player instanceof EntityPlayer)
      d1 += 1.62D;
    double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
    Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
    float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
    float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
    float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    float f6 = MathHelper.sin(-f1 * 0.017453292F);
    float f7 = f4 * f5;
    float f8 = f3 * f5;
    double d3 = range;
    Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
    return world.rayTraceBlocks(vec3, vec31, par3);
  }
View Full Code Here

Examples of net.minecraft.util.Vec3

    double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
    double d1 = player.prevPosY + (player.posY - player.prevPosY) * f;
    if (!world.isRemote && player instanceof EntityPlayer)
      d1 += 1.62D;
    double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
    Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
    float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
    float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
    float f5 = -MathHelper.cos(-f1 * 0.017453292F);
    float f6 = MathHelper.sin(-f1 * 0.017453292F);
    float f7 = f4 * f5;
    float f8 = f3 * f5;
    double d3 = range;
    if (player instanceof EntityPlayerMP)
      d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
    Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
    return world.func_147447_a(vec3, vec31, par3, !par3, par3);
  }
View Full Code Here

Examples of net.minecraft.util.Vec3

  }

  @Override
  public void onUpdate() {
    super.onUpdate();
    Vec3 vec3 = Vec3.createVectorHelper(posX, posY, posZ);
    Vec3 vec31 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);

    MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks(vec3, vec31);


    if (!worldObj.isRemote)
View Full Code Here

Examples of net.minecraft.util.Vec3

    onEntityUpdate();

    if(throwableShake > 0)
      --throwableShake;

    Vec3 vec3 = new Vector3(posX, posY, posZ).toVec3D();
    Vec3 vec31 = new Vector3(posX + motionX, posY + motionY, posZ + motionZ).toVec3D();
    MovingObjectPosition movingobjectposition = clip(vec3, vec31);

    if(movingobjectposition != null)
      vec31 = new Vector3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord).toVec3D();
View Full Code Here

Examples of net.minecraft.util.Vec3

            par1Vec3.xCoord += d6 * d5;
            par1Vec3.yCoord += d7 * d5;
            par1Vec3.zCoord = d2;
          }

          Vec3 vec32 = new Vector3(par1Vec3.xCoord, par1Vec3.yCoord, par1Vec3.zCoord).toVec3D();
          l = (int)(vec32.xCoord = MathHelper.floor_double(par1Vec3.xCoord));

          if (b0 == 5) {
            --l;
            ++vec32.xCoord;
View Full Code Here

Examples of net.minecraft.util.Vec3

        {
            return false;
        }
        else
        {
            Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);

            if (var1 == null)
            {
                return false;
            }
View Full Code Here

Examples of net.minecraft.util.Vec3

    }
   

    protected Vec3 lookForBlockNearBy(int _blockID, int j, int k, int l, int i1, int j1, int k1)
    {
        Vec3 vec3d = Vec3.createVectorHelper(j, k, l);
        Vec3 vec3d1 = null;
        double d = 999999999D;
       
        int l1;

        if (i1 > j1 && i1 > k1)
        {
            l1 = i1;
        }
        else if (j1 > k1)
        {
            l1 = j1;
        }
        else
        {
            l1 = k1;
        }

        int i5 = 0;

        for (int j5 = 0; j5 <= l1; j5++)
        {
            int k5 = Math.min(i1, j5);
            int l5 = Math.min(j1, j5);
            int i6 = Math.min(k1, j5);

            if (j5 <= k1)
            {
                int i4 = l - j5;

                for (int i3 = k - l5; i3 <= k + l5; i3++)
                {
                    for (int i2 = j - k5; i2 <= j + k5; i2++)
                    {
                        if (this.taskEntityWorld.getBlockId(i2, i3, i4) == _blockID)
                        {
                            Vec3 vec3d2 = Vec3.createVectorHelper(i2, i3, i4);

                            if (vec3d1 == null || vec3d2.distanceTo(vec3d) < d)
                            {
                                vec3d1 = vec3d2;
                                d = vec3d1.distanceTo(vec3d);
                            }
                        }

                        i5++;
                    }
                }
            }

            if (j5 > 0)
            {
                if (j5 <= k1)
                {
                    int j4 = l + j5;

                    for (int j3 = k - l5; j3 <= k + l5; j3++)
                    {
                        for (int j2 = j - k5; j2 <= j + k5; j2++)
                        {
                            if (this.taskEntityWorld.getBlockId(j2, j3, j4) == _blockID)
                            {
                                Vec3 vec3d3 = Vec3.createVectorHelper(j2, j3, j4);

                                if (vec3d1 == null || vec3d3.distanceTo(vec3d) < d)
                                {
                                    vec3d1 = vec3d3;
                                    d = vec3d1.distanceTo(vec3d);
                                }
                            }

                            i5++;
                        }
                    }

                    i6--;
                }

                if (j5 <= j1)
                {
                    for (int k3 = k - j5; k3 <= k + j5; k3 += 2 * j5)
                    {
                        for (int k4 = l - i6; k4 <= l + i6; k4++)
                        {
                            for (int k2 = j - k5; k2 <= j + k5; k2++)
                            {
                                if (this.taskEntityWorld.getBlockId(k2, k3, k4) == _blockID)
                                {
                                    Vec3 vec3d4 = Vec3.createVectorHelper(k2, k3, k4);

                                    if (vec3d1 == null || vec3d4.distanceTo(vec3d) < d)
                                    {
                                        vec3d1 = vec3d4;
                                        d = vec3d1.distanceTo(vec3d);
                                    }
                                }

                                i5++;
                            }
                        }
                    }

                    l5--;
                }

                if (j5 <= i1)
                {
                    for (int l2 = j - j5; l2 <= j + j5; l2 += 2 * j5)
                    {
                        for (int l4 = l - i6; l4 <= l + i6; l4++)
                        {
                            for (int l3 = k - l5; l3 <= k + l5; l3++)
                            {
                                if (this.taskEntityWorld.getBlockId(l2, l3, l4) == _blockID)
                                {
                                    Vec3 vec3d5 = Vec3.createVectorHelper(l2, l3, l4);

                                    if (vec3d1 == null || vec3d5.distanceTo(vec3d) < d)
                                    {
                                        vec3d1 = vec3d5;
                                        d = vec3d1.distanceTo(vec3d);
                                    }
                                }
View Full Code Here

Examples of net.minecraft.util.Vec3

            return false;
        }
        else
        {
          //Look for some other block of the same type.
            Vec3 v = this.lookForWorkLocation();

            if (v == null)
            {
                return false;
            }
View Full Code Here

Examples of net.minecraft.util.Vec3

       
        //choose a spot 5-10m away from citizen in a random direction
//        candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, 5 + Utility.rng.nextInt(5));
//        candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
       
        Vec3 tempVec = this.lookForWorkLocation();       
       
        if ( tempVec != null ) {
          candidate.x = tempVec.xCoord;
          candidate.y = tempVec.yCoord;
          candidate.z = tempVec.zCoord;
View Full Code Here

Examples of net.minecraft.util.Vec3

   * @return The target hit.
   */
  public MovingObjectPosition rayTraceEntities(World world, Vector3 target)
  {
    MovingObjectPosition pickedEntity = null;
    Vec3 startingPosition = toVec3();
    Vec3 look = target.toVec3();
    double reachDistance = distance(target);
    //Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance);

    double checkBorder = 1.1 * reachDistance;
    AxisAlignedBB boxToScan = AxisAlignedBB.getAABBPool().getAABB(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.