Package net.minecraft.util

Examples of net.minecraft.util.AxisAlignedBB


        Entity entity1 = (Entity)list.get(j);

        if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || delayBeforeCanPickup == 0))
        {
          float f = 1.0F;
          AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
          MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);

          if (movingobjectposition1 != null)
          {
            double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
View Full Code Here


      setDead();
      return;
    }

    if(ticksExisted > 45) {
      AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(radius, radius, radius);
      List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);

      if(entities.isEmpty())
        return;
View Full Code Here

      for(int j = 0; j < list.size(); ++j) {
        Entity entity1 = (Entity) list.get(j);

        if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) {
          float f = 0.3F;
          AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
          MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);

          if(movingobjectposition1 != null) {
            double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

            if (d1 < d0 || d0 == 0.0D) {
View Full Code Here

    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);

    @SuppressWarnings("unchecked")
    List<Entity> entitiesInBounds = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
    double closestEntity = reachDistance;
   
    if (entitiesInBounds == null || entitiesInBounds.isEmpty())
    {
      return null;
    }
    for (Entity possibleHits : entitiesInBounds)
    {
      if (possibleHits != null && possibleHits.canBeCollidedWith() && possibleHits.boundingBox != null)
      {
        float border = possibleHits.getCollisionBorderSize();
        AxisAlignedBB aabb = possibleHits.boundingBox.expand(border, border, border);
        MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, target.toVec3());

        if (hitMOP != null)
        {
          if (aabb.isVecInside(startingPosition))
          {
            if (0.0D < closestEntity || closestEntity == 0.0D)
            {
              pickedEntity = new MovingObjectPosition(possibleHits);
              if (pickedEntity != null)
View Full Code Here

      int z = supertile.zCoord;
      int w = 2;
      int h = 3;
      int l = 16;

      AxisAlignedBB axis = null;
      switch(orientation) {
      case 0 :
        axis = AxisAlignedBB.getBoundingBox(x - w, y - h, z - l, x + w + 1, y + h, z);
        break;
      case 1 :
View Full Code Here

      double z1 = supertile.zCoord + 0.5;

      double maxDist = getMaxDistance();
      double range = getRange();

      AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, y1 - range, z1 - range, x1 + range, y1 + range, z1 + range);
      List<EntityLivingBase> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);

      for(EntityLivingBase entity : entities) {
        if(entity instanceof EntityPlayer || entity instanceof IBossDisplayData)
          continue;
View Full Code Here

        }
    }

    private void addCollisionBox(World world, int x, int y, int z, AxisAlignedBB aabb, List list)
    {
        AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(world, x, y, z);

        if (axisalignedbb1 != null && aabb.intersectsWith(axisalignedbb1))
        {
            list.add(axisalignedbb1);
        }
View Full Code Here

            Block block = this.worldObj.getBlock(this.hitVec.x, this.hitVec.y, this.hitVec.z);

            if (block.getMaterial() != Material.air)
            {
                block.setBlockBoundsBasedOnState(this.worldObj, this.hitVec.x, this.hitVec.y, this.hitVec.z);
                AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.hitVec.x, this.hitVec.y, this.hitVec.z);

                if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ)))
                {
                    this.inGround = true;
                }
            }
        }

        if (this.arrowShake > 0)
        {
            --this.arrowShake;
        }

        if (this.inGround)
        {
            if (this.hitVec != null)
            {
                Block block = this.worldObj.getBlock(this.hitVec.x, this.hitVec.y, this.hitVec.z);
                int j = this.worldObj.getBlockMetadata(this.hitVec.x, this.hitVec.y, this.hitVec.z);

                if (block == this.hitBlock && j == this.inData)
                {
                    if (this.shootingEntity != null)
                    {
                        this.shootingEntity.motionX = (this.posX - this.shootingEntity.posX) / 16.0F;
                        this.shootingEntity.motionY = (this.posY - this.shootingEntity.posY) / 16.0F;
                        this.shootingEntity.motionZ = (this.posZ - this.shootingEntity.posZ) / 16.0F;
                    }

                    if (!this.worldObj.isRemote && this.ticksInGround < 5)
                    {
                        this.updatePullingEntity(true);
                    }

                    ++this.ticksInGround;

                    if (this.ticksInGround == 1200)
                    {
                        this.setDead();
                    }
                }
                else
                {
                    this.inGround = false;
                    this.motionX *= this.rand.nextFloat() * 0.2F;
                    this.motionY *= this.rand.nextFloat() * 0.2F;
                    this.motionZ *= this.rand.nextFloat() * 0.2F;
                    this.ticksInGround = 0;
                    this.ticksInAir = 0;
                }
            }
        }
        else
        {
            this.rotationRoll += 5;
            ++this.ticksInAir;

            if (!this.worldObj.isRemote)
            {
                this.updatePullingEntity(false);
            }

            if (this.shootingEntity != null && this.getDistanceSqToEntity(this.shootingEntity) >= 40 * 40)
            {
                this.setDead();
            }

            Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
            Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
            MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
            vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
            vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

            if (movingobjectposition != null)
            {
                vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
            }

            Entity entity = null;
            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
            double d0 = 0.0D;
            int i;
            float f1;

            for (i = 0; i < list.size(); ++i)
            {
                Entity entity1 = (Entity) list.get(i);

                if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
                {
                    f1 = 0.3F;
                    AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
                    MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3);

                    if (movingobjectposition1 != null)
                    {
                        double d1 = vec31.distanceTo(movingobjectposition1.hitVec);

View Full Code Here

                final Entity var30 = (Entity) var28.get(var29);

                if (var30.canBeCollidedWith())
                {
                    final float var31 = var30.getCollisionBorderSize();
                    final AxisAlignedBB var32 = var30.boundingBox.expand(var31, var31, var31);

                    if (var32.isVecInside(var13))
                    {
                        var26 = true;
                    }
                }
            }
View Full Code Here

                }

                Vector3 thisPos = new Vector3(this).translate(0.5F);
                Vector3 minPos = new Vector3(thisPos).translate(-distance);
                Vector3 maxPos = new Vector3(thisPos).translate(distance);
                AxisAlignedBB matchingRegion = AxisAlignedBB.getBoundingBox(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z);
                List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, matchingRegion);

                boolean foundPlayer = false;

                for (int i = 0; i < playersWithin.size(); i++)
View Full Code Here

TOP

Related Classes of net.minecraft.util.AxisAlignedBB

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.