Package crazypants.enderio.conduit.geom

Examples of crazypants.enderio.conduit.geom.CollidableComponent


    return onNeighborBlockChange(world.getBlock(tileX, tileY, tileZ));
  }

  @Override
  public Collection<CollidableComponent> createCollidables(CacheKey key) {
    return Collections.singletonList(new CollidableComponent(getCollidableType(), ConduitGeometryUtil.instance.getBoundingBox(getBaseConduitType(), key.dir,
        key.isStub, key.offset), key.dir, null));
  }
View Full Code Here


      if(cb.getFacadeId() != null) {
        tex = cb.getFacadeId().getIcon(target.sideHit,
            cb.getFacadeMetadata());
      }
    } else if(target.hitInfo instanceof CollidableComponent) {
      CollidableComponent cc = (CollidableComponent) target.hitInfo;
      IConduit con = cb.getConduit(cc.conduitType);
      if(con != null) {
        tex = con.getTextureForState(cc);
      }
    }
View Full Code Here

  @Override
  public ItemStack getPickBlock(MovingObjectPosition target, World world, int
      x, int y, int z) {
    if(target != null && target.hitInfo instanceof CollidableComponent) {
      CollidableComponent cc = (CollidableComponent) target.hitInfo;
      TileConduitBundle bundle = (TileConduitBundle) world.getTileEntity(x,
          y, z);
      IConduit conduit = bundle.getConduit(cc.conduitType);
      if(conduit != null) {
        return conduit.createItem();
View Full Code Here

    if(ConduitUtil.isSolidFacadeRendered(bundle, player)) {
      setBlockBounds(0, 0, 0, 1, 1, 1);
      MovingObjectPosition hitPos = super.collisionRayTrace(world, x, y, z,
          origin, direction);
      if(hitPos != null) {
        hits.add(new RaytraceResult(new CollidableComponent(null,
            BoundingBox.UNIT_CUBE, ForgeDirection.UNKNOWN, null), hitPos));
      }
    } else {

      Collection<CollidableComponent> components =
View Full Code Here

    if(key.dir == ForgeDirection.UNKNOWN) {
      return baseCollidables;
    }

    BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
    CollidableComponent cc = new CollidableComponent(IPowerConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);

    List<CollidableComponent> result = new ArrayList<CollidableComponent>();
    result.addAll(baseCollidables);
    result.add(cc);
View Full Code Here

    if(key.dir == ForgeDirection.UNKNOWN) {
      return baseCollidables;
    }

    BoundingBox bb = ConduitGeometryUtil.instance.createBoundsForConnectionController(key.dir, key.offset);
    CollidableComponent cc = new CollidableComponent(IRedstoneConduit.class, bb, key.dir, COLOR_CONTROLLER_ID);

    List<CollidableComponent> result = new ArrayList<CollidableComponent>();
    result.addAll(baseCollidables);
    result.add(cc);
View Full Code Here

    List<CollidableComponent> result = super.getCollidableComponents();
    BoundingBox[] aabb = RedstoneSwitchBounds.getInstance().getAABB();

    for (BoundingBox bb : aabb) {
      result.add(new CollidableComponent(IRedstoneConduit.class, bb.translate(trans), ForgeDirection.UNKNOWN, SWITCH_TAG));
    }

    return result;
  }
View Full Code Here

          bb = bb.expandBy(cBB.bound);
        }
      }
      if(bb != null) {
        bb = bb.scale(1.05, 1.05, 1.05);
        CollidableComponent cc = new CollidableComponent(null, bb, ForgeDirection.UNKNOWN,
            ConduitConnectorType.INTERNAL);
        result.add(cc);
        cachedConnectors.add(cc);
      }
    }

    //2nd algorithm
    for (IConduit con : conduits) {

      if(con.hasConnections()) {
        List<CollidableComponent> cores = new ArrayList<CollidableComponent>();
        addConduitCores(cores, con);
        if(cores.size() > 1) {
          BoundingBox bb = cores.get(0).bound;
          float area = bb.getArea();
          for (CollidableComponent cc : cores) {
            bb = bb.expandBy(cc.bound);
          }
          if(bb.getArea() > area * 1.5f) {
            bb = bb.scale(1.05, 1.05, 1.05);
            CollidableComponent cc = new CollidableComponent(null, bb, ForgeDirection.UNKNOWN,
                ConduitConnectorType.INTERNAL);
            result.add(cc);
            cachedConnectors.add(cc);
          }
        }
      }
    }

    // External Connectors
    Set<ForgeDirection> externalDirs = new HashSet<ForgeDirection>();
    for (IConduit con : conduits) {
      Set<ForgeDirection> extCons = con.getExternalConnections();
      if(extCons != null) {
        for (ForgeDirection dir : extCons) {
          if(con.getConnectionMode(dir) != ConnectionMode.DISABLED) {
            externalDirs.add(dir);
          }
        }
      }
    }
    for (ForgeDirection dir : externalDirs) {
      BoundingBox bb = ConduitGeometryUtil.instance.getExternalConnectorBoundingBox(dir);
      CollidableComponent cc = new CollidableComponent(null, bb, dir, ConduitConnectorType.EXTERNAL);
      result.add(cc);
      cachedConnectors.add(cc);
    }

    connectorsDirty = false;
View Full Code Here

TOP

Related Classes of crazypants.enderio.conduit.geom.CollidableComponent

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.