Package net.minecraft.util

Examples of net.minecraft.util.AxisAlignedBB


                    }
                }
            }
        }

        AxisAlignedBB box = this.boundingBox.expand(0.2D, 0.4D, 0.2D);

        final List<Entity> var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box);

        if (var15 != null && !var15.isEmpty())
        {
View Full Code Here


                if (player.boundingBox.minY - blockYmax < 0.001D && player.boundingBox.minY - blockYmax > -0.5D)
                {
                    player.onGround = true;
                    if (b.canCollideCheck(player.worldObj.getBlockMetadata(xx, playerFeetOnY, zz), false))
                    {
                        AxisAlignedBB collisionBox = b.getCollisionBoundingBoxFromPool(player.worldObj, xx, playerFeetOnY, zz);
                        if (collisionBox != null && collisionBox.intersectsWith(player.boundingBox))
                        {
                          player.posY -= player.boundingBox.minY - blockYmax;
                        player.boundingBox.offset(0, blockYmax - player.boundingBox.minY, 0);
                        }
                    }
View Full Code Here

                    player.mountEntity(this);
                }
            }
        }

        AxisAlignedBB box = this.boundingBox.expand(0.2D, 0.4D, 0.2D);

        final List<Entity> var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box);

        if (var15 != null && !var15.isEmpty())
        {
View Full Code Here

        if (this.timeUntilLaunch > 0 && this.launchPhase == EnumLaunchPhase.IGNITED.ordinal())
        {
            this.timeUntilLaunch--;
        }

        AxisAlignedBB box = null;

        box = this.boundingBox.expand(0.2D, 0.2D, 0.2D);

        final List<?> var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
View Full Code Here

        Vec3 look = target.toVec3();
        double reachDistance = this.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.getBoundingBox(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z);

        @SuppressWarnings("unchecked")
        List<Entity> entitiesHit = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
        double closestEntity = reachDistance;

        if (entitiesHit == null || entitiesHit.isEmpty())
        {
            return null;
        }
        for (Entity entityHit : entitiesHit)
        {
            if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null)
            {
                float border = entityHit.getCollisionBorderSize();
                AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
                MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint);

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

        Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance, playerPosition.yCoord
                + playerLook.yCoord * reachDistance, playerPosition.zCoord + playerLook.zCoord * reachDistance);

        double playerBorder = 1.1 * reachDistance;
        AxisAlignedBB boxToScan = player.boundingBox.expand(playerBorder, playerBorder, playerBorder);
        // AxisAlignedBB boxToScan =
        // player.boundingBox.addCoord(playerLook.xCoord * reachDistance,
        // playerLook.yCoord * reachDistance, playerLook.zCoord
        // * reachDistance);

        List entitiesHit = world.getEntitiesWithinAABBExcludingEntity(player, boxToScan);
        double closestEntity = reachDistance;

        if (entitiesHit == null || entitiesHit.isEmpty()) {
            return null;
        }
        for (Entity entityHit : (Iterable<Entity>) entitiesHit) {
            if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null) {
                float border = entityHit.getCollisionBorderSize();
                AxisAlignedBB aabb = entityHit.boundingBox.expand((double) border, (double) border, (double) border);
                MovingObjectPosition hitMOP = aabb.calculateIntercept(playerPosition, playerViewOffset);

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

  }

  @Override
  public void canSpawnEvent(CheckSpawn event) {
    if(event.entity instanceof EntitySlime && event.y > 50.0D && event.y < 70.0D && event.world.rand.nextFloat() < 0.5F && event.world.rand.nextFloat() < event.world.getCurrentMoonPhaseFactor() && event.world.getBlockLightValue(MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z)) <= event.world.rand.nextInt(8)) {
      AxisAlignedBB boundingBox = event.entityLiving.boundingBox;
     
      if(event.world.checkNoEntityCollision(boundingBox) && event.world.getCollidingBoundingBoxes(event.entityLiving, boundingBox).isEmpty() && !event.world.isAnyLiquid(boundingBox)) {
        // Allow the spawning
        event.setResult(Result.ALLOW);
      }
View Full Code Here

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

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

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

            if (d2 < d0 || d0 == 0.0D) {
              entity = entity1;
              d0 = d2;
            }
          }
        }
      }

      if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
      }

      if (movingobjectposition != null) {
        if (movingobjectposition.entityHit != null) {
          if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.field_146042_b), 0.0F)) {
            this.field_146043_c = movingobjectposition.entityHit;
          }
        } else {
          this.field_146051_au = true;
        }
      }

      if (!this.field_146051_au) {
        this.moveEntity(this.motionX, this.motionY, this.motionZ);
        float f5 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
        this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

        for (this.rotationPitch = (float) (Math.atan2(this.motionY, f5) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
          ;
        }

        while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
          this.prevRotationPitch += 360.0F;
        }

        while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
          this.prevRotationYaw -= 360.0F;
        }

        while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
          this.prevRotationYaw += 360.0F;
        }

        this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
        this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
        float f6 = 0.92F;

        if (this.onGround || this.isCollidedHorizontally) {
          f6 = 0.5F;
        }

        byte b0 = 5;
        double d10 = 0.0D;

        for (int j = 0; j < b0; ++j) {
          double d3 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (j + 0) / b0 - 0.125D + 0.125D;
          double d4 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (j + 1) / b0 - 0.125D + 0.125D;
          AxisAlignedBB axisalignedbb1 = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, d3, this.boundingBox.minZ, this.boundingBox.maxX, d4,
              this.boundingBox.maxZ);

          if (this.worldObj.isAABBInMaterial(axisalignedbb1, Material.water)) {
            d10 += 1.0D / b0;
          }
View Full Code Here

    boolean isOpen = (meta & 4) == 4;
    int rotation = (meta & 3)
    rotation = isMirrored ? (rotation == 0 ? 3 : rotation == 1 ? 0 : rotation == 2 ? 1 : 2) : rotation;
    isOpen = isMirrored ? !isOpen : isOpen;

    AxisAlignedBB box;
    switch(rotation) {
    case 0 :
      if(!isOpen) box = AxisAlignedBB.getBoundingBox(x - 0.005 / 16F, y + 14.5 / 16F, z + 10 / 16F, x + 3.005 / 16F, y + 20.5 / 16F, z + 15 / 16F);
      else box = AxisAlignedBB.getBoundingBox(x + 10 / 16F, y + 14.5 / 16F, z - 0.005 / 16F, x + 15 / 16F, y + 20.5 / 16F, z + 3.005 / 16F);
      break;
    case 1 :
      if(!isOpen) box = AxisAlignedBB.getBoundingBox(x + 1 / 16F, y + 14.5 / 16F, z - 0.005 / 16F, x + 6 / 16F, y + 20.5 / 16F, z + 3.005 / 16F);
      else box = AxisAlignedBB.getBoundingBox(x + 12.995 / 16F, y + 14.5 / 16F, z + 10 / 16F, x + 16.005 / 16F, y + 20.5 / 16F, z + 15 / 16F);
      break;
    case 2 :
      if(!isOpen) box = AxisAlignedBB.getBoundingBox(x + 12.995 / 16F, y + 14.5 / 16F, z + 1 / 16F, x + 16.005 / 16F, y + 20.5 / 16F, z + 6 / 16F);
      else box = AxisAlignedBB.getBoundingBox(x + 1 / 16F, y + 14.5 / 16F, z + 12.995 / 16F, x + 6 / 16F, y + 20.5 / 16F, z + 16.005 / 16F);
      break;
    default :
      if(!isOpen) box = AxisAlignedBB.getBoundingBox(x + 10 / 16F, y + 14.5 / 16F, z + 12.995 / 16F, x + 15 / 16F, y + 20.5 / 16F, z + 16.005 / 16F);
      else box = AxisAlignedBB.getBoundingBox(x - 0.005 / 16F, y + 14.5 / 16F, z + 1 / 16F, x + 3.005 / 16F, y + 20.5 / 16F, z + 6 / 16F);
      break;
    }
   
    return box.isVecInside(hitVec) ? box : null;
  }
View Full Code Here

    if ((target == null) || (target.typeOfHit != MovingObjectType.BLOCK)) return;
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
   
    AxisAlignedBB box = null;
    Block block = world.getBlock(x, y, z);
    TileEntity tileEntity = world.getTileEntity(x, y, z);
   
    if (block instanceof TileArmorStand)
      box = getArmorStandHighlightBox(player, world, x, y, z, target.hitVec);
    else if (block == Blocks.iron_door)
      box = getIronDoorHightlightBox(player, world, x, y, z, target.hitVec, block);
    else if (tileEntity instanceof IHasAttachments)
      box = getAttachmentPointsHighlightBox(player, tileEntity, target);
   
    if (box == null) return;
   
    double xOff = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks;
    double yOff = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks;
    double zOff = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks;
    box.offset(-xOff, -yOff, -zOff);
       
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
    GL11.glLineWidth(2.0F);
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.