Package net.minecraft.util

Examples of net.minecraft.util.AxisAlignedBB


      for (ForgeDirection s : ForgeDirection.VALID_DIRECTIONS)
      {
        IFacadePart fPart = iFacadeContainer.getFacade( s );
        if ( fPart != null )
        {
          AxisAlignedBB b = null;
          fPart.setThinFacades( useThinFacades );
          AxisAlignedBB pb = fPart.getPrimaryBox();
          for (AxisAlignedBB bb : boxes)
          {
            if ( bb.intersectsWith( pb ) )
            {
              if ( b == null )
View Full Code Here


    return item;
  }

  private void shootPaintBalls(ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2)
  {
    AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
        Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ),
        Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );

    Entity entity = null;
    List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
    double closest = 9999999.0D;
    int l;

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

      if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
      {
        if ( entity1.isEntityAlive() )
        {
          // prevent killing / flying of mounts.
          if ( entity1.riddenByEntity == p )
            continue;

          float f1 = 0.3F;

          AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
          MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );

          if ( movingObjectPosition != null )
          {
            double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
View Full Code Here

    boolean hasDestroyedSomething = true;
    while (penetration > 0 && hasDestroyedSomething)
    {
      hasDestroyedSomething = false;

      AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
          Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ),
          Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );

      Entity entity = null;
      List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
      double closest = 9999999.0D;
      int l;

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

        if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
        {
          if ( entity1.isEntityAlive() )
          {
            // prevent killing / flying of mounts.
            if ( entity1.riddenByEntity == p )
              continue;

            float f1 = 0.3F;

            AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
            MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );

            if ( movingObjectPosition != null )
            {
              double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
View Full Code Here

  @Override
  @SideOnly(Side.CLIENT)
  final public AxisAlignedBB getSelectedBoundingBoxFromPool(World w, int x, int y, int z)
  {
    ICustomCollision collisionHandler = null;
    AxisAlignedBB b = null;

    if ( this instanceof ICustomCollision )
      collisionHandler = (ICustomCollision) this;
    else
    {
      AEBaseTile te = getTileEntity( w, x, y, z );
      if ( te instanceof ICustomCollision )
        collisionHandler = (ICustomCollision) te;
    }

    if ( collisionHandler != null )
    {
      if ( Platform.isClient() )
      {
        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );

        Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, x, y, z, Minecraft.getMinecraft().thePlayer, true );
        AxisAlignedBB br = null;

        double lastDist = 0;

        for (AxisAlignedBB bb : bbs)
        {
          setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );

          MovingObjectPosition r = super.collisionRayTrace( w, x, y, z, ld.a, ld.b );

          setBlockBounds( 0, 0, 0, 1, 1, 1 );

          if ( r != null )
          {
            double xLen = (ld.a.xCoord - r.hitVec.xCoord);
            double yLen = (ld.a.yCoord - r.hitVec.yCoord);
            double zLen = (ld.a.zCoord - r.hitVec.zCoord);

            double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
            if ( br == null || lastDist > thisDist )
            {
              lastDist = thisDist;
              br = bb;
            }
          }
        }

        if ( br != null )
        {
          br.setBounds( br.minX + x, br.minY + y, br.minZ + z, br.maxX + x, br.maxY + y, br.maxZ + z );
          return br;
        }
      }

      for (AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, x, y, z, null, false ))
View Full Code Here

                if ( eatForReal )
                {
                  energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
                  w.setBlock( x, y, z, Platform.air, 0, 3 );

                  AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
                  for (Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ))
                  {
                    if ( ei instanceof EntityItem )
                    {
                      EntityItem item = (EntityItem) ei;
View Full Code Here

            box.maxZ = z;
        return box;
    }

    public static <T extends Entity> List<T> getNearbyEntities(World world, Class<T> entityClass, float x, float minY, float maxY, float z, float radius) {
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, minY, z, x + 1, maxY, z + 1);
        box = box.expand(radius, 0, radius);
        return (List<T>) world.getEntitiesWithinAABB(entityClass, box);
    }
View Full Code Here

        box = box.expand(radius, 0, radius);
        return (List<T>) world.getEntitiesWithinAABB(entityClass, box);
    }

    public static <T extends Entity> List<T> getEntitiesAt(World world, Class<T> entityClass, int x, int y, int z) {
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
        return (List<T>) world.selectEntitiesWithinAABB(entityClass, box, IEntitySelector.selectAnything);
    }
View Full Code Here

        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
        return (List<T>) world.selectEntitiesWithinAABB(entityClass, box, IEntitySelector.selectAnything);
    }

    public static <T extends Entity> T getEntityAt(World world, Class<T> entityClass, int x, int y, int z) {
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
        List<T> entities = (List<T>) world.selectEntitiesWithinAABB(entityClass, box, IEntitySelector.selectAnything);
        if (!entities.isEmpty())
            return entities.get(0);
        return null;
    }
View Full Code Here

                side = ForgeDirection.EAST;
            }
        } else if (isReversed() != isMirrored()) {
            side = ForgeDirection.NORTH;
        }
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
        box = MiscTools.addCoordToAABB(box, side.offsetX, 0, side.offsetZ);
        box = MiscTools.addCoordToAABB(box, side.offsetX + 1, 1, side.offsetZ + 1);
        box = box.offset(getX(), getY(), getZ());
        return box;
    }
View Full Code Here

            }
        }
        if (isMirrored()) {
            side = ForgeDirection.EAST;
        }
        AxisAlignedBB box = AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
        box = box.addCoord(side.offsetX, side.offsetY, side.offsetZ);
        box = box.addCoord(side.offsetX + 1, side.offsetY + 1, side.offsetZ + 1);
        box = box.offset(getX(), getY(), getZ());
        return box;
    }
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.