Package appeng.helpers

Examples of appeng.helpers.ICustomCollision


  }

  @Override
  public MovingObjectPosition collisionRayTrace(World w, int x, int y, int z, Vec3 a, Vec3 b)
  {
    ICustomCollision collisionHandler = 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 )
    {
      Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, x, y, z, null, true );
      MovingObjectPosition br = null;

      double lastDist = 0;

      for (AxisAlignedBB bb : bbs)
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 ))
      {
        if ( b == null )
          b = bx;
        else
        {
View Full Code Here

  @Override
  // NOTE: WAS FINAL, changed for Immibis
  public void addCollisionBoxesToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
  {
    ICustomCollision collisionHandler = 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 && bb != null )
    {
      List<AxisAlignedBB> tmp = new ArrayList<AxisAlignedBB>();
      collisionHandler.addCollidingBlockToList( w, x, y, z, bb, tmp, e );
      for (AxisAlignedBB b : tmp)
      {
        b.minX += x;
        b.minY += y;
        b.minZ += z;
View Full Code Here

TOP

Related Classes of appeng.helpers.ICustomCollision

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.