Package net.minecraft.util

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


    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

            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

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

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

    }
   

    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

            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

       
        //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

   * @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

   */
  public static MovingObjectPosition rayTrace(World world, EntityPlayer player)
  {
    double reach = Mekanism.proxy.getReach(player);

    Vec3 headVec = getHeadVec(player);
    Vec3 lookVec = player.getLook(1);
    Vec3 endVec = headVec.addVector(lookVec.xCoord*reach, lookVec.yCoord*reach, lookVec.zCoord*reach);

    return world.rayTraceBlocks(headVec, endVec, true);
  }
View Full Code Here

   * @param player - player to check
   * @return head location
   */
  private static Vec3 getHeadVec(EntityPlayer player)
  {
    Vec3 vec = Vec3.createVectorHelper(player.posX, player.posY, player.posZ);

    if(!player.worldObj.isRemote)
    {
      vec.yCoord += player.getEyeHeight();

View Full Code Here

TOP

Related Classes of net.minecraft.util.Vec3

Copyright © 2018 www.massapicom. 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.