コード例 #1
0
  /**
   * Gets all the selection boxes for this block
   *
   * @return A list with the selection boxes
   */
  @Override
  public List<AxisAlignedBB> getSelectionBoxes() {

    List<AxisAlignedBB> aabbs = getOcclusionBoxes();
    for (int i = 0; i < 6; i++) {
      if (connections[i]) {
        ForgeDirection d = ForgeDirection.getOrientation(i);
        if (d == ForgeDirection.UP || d == ForgeDirection.DOWN) d = d.getOpposite();
        Vector3Cube c = sideBB.clone().rotate90Degrees(d);
        aabbs.add(c.toAABB());
      }
    }
    return aabbs;
  }
コード例 #2
0
  public boolean isConnected(ForgeDirection dir, PneumaticTube otherTube) {

    if (otherTube != null
        && otherTube.color != TubeColor.NONE
        && color != TubeColor.NONE
        && color != otherTube.color) return false;
    if (dir == ForgeDirection.UP || dir == ForgeDirection.DOWN) dir = dir.getOpposite();
    return world == null || !checkOcclusion(sideBB.clone().rotate90Degrees(dir).toAABB());
  }
コード例 #3
0
  @Override
  public void renderBase(int pass) {

    Tessellator t = Tessellator.instance;
    Vector3Cube vector =
        new Vector3Cube(pixel * 3, 0.0, pixel * 3, 1.0 - (pixel * 3), pixel * 2, 1.0 - pixel * 3);
    IIcon topIcon = IconSupplier.cagedLampFootTop;
    IIcon sideIcon = IconSupplier.cagedLampFootSide;

    double minU = topIcon.getInterpolatedU(vector.getMinX() * 16);
    double maxU = topIcon.getInterpolatedU(vector.getMaxX() * 16);
    double minV = topIcon.getInterpolatedV(vector.getMinZ() * 16);
    double maxV = topIcon.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    //        minU = sideIcon.getInterpolatedU(vector.getMinX() * 16);
    //        maxU = sideIcon.getInterpolatedU(vector.getMaxX() * 16);
    //        minV = sideIcon.getInterpolatedV(vector.getMinY() * 16);
    //        maxV = sideIcon.getInterpolatedV(vector.getMaxY() * 16);
    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, maxV);

    // And now, the cage itself!
    // No. Not Nicholas Cage. The lamp-cage!
    vector =
        new Vector3Cube(
            pixel * 4, pixel * 2, pixel * 4, 1.0 - (pixel * 4), 1.0 - (pixel * 4), 1.0 - pixel * 4);
    topIcon = IconSupplier.cagedLampCageTop;
    sideIcon = IconSupplier.cagedLampCageSide;

    minU = topIcon.getInterpolatedU(vector.getMinX() * 16);
    maxU = topIcon.getInterpolatedU(vector.getMaxX() * 16);
    minV = topIcon.getInterpolatedV(vector.getMinZ() * 16);
    maxV = topIcon.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    minU = sideIcon.getInterpolatedU(vector.getMinX() * 16);
    maxU = sideIcon.getInterpolatedU(vector.getMaxX() * 16);
    minV = sideIcon.getInterpolatedV(vector.getMinY() * 16);
    maxV = sideIcon.getInterpolatedV(vector.getMaxY() * 16);
    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
  }
コード例 #4
0
  @Override
  public void renderLamp(int pass, int r, int g, int b) {

    Tessellator t = Tessellator.instance;
    IIcon iconToUseTop;
    IIcon iconToUseSide;
    if (power == 0) {
      iconToUseSide = IconSupplier.cagedLampLampInactive;
      iconToUseTop = IconSupplier.cagedLampLampInactiveTop;
    } else {
      iconToUseSide = IconSupplier.cagedLampLampActive;
      iconToUseTop = IconSupplier.cagedLampLampActiveTop;

      t.setColorRGBA(r, g, b, 20);
      // RenderHelper.drawTesselatedCube(new Vector3Cube(pixel * 4.5, pixel * 2, pixel * 4.5, 1.0 -
      // (pixel*4.5), 1.0 - (pixel * 4.5), 1.0 - pixel * 4.5));
      t.setColorRGBA(r, g, b, 255);
    }

    Vector3Cube vector =
        new Vector3Cube(
            pixel * 5, pixel * 2, pixel * 5, 1.0 - (pixel * 5), 1.0 - (pixel * 5), 1.0 - pixel * 5);

    double minU = iconToUseTop.getInterpolatedU(vector.getMinX() * 16);
    double maxU = iconToUseTop.getInterpolatedU(vector.getMaxX() * 16);
    double minV = iconToUseTop.getInterpolatedV(vector.getMinZ() * 16);
    double maxV = iconToUseTop.getInterpolatedV(vector.getMaxZ() * 16);

    // Top side
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, maxV);

    minU = iconToUseSide.getInterpolatedU(vector.getMinX() * 16);
    maxU = iconToUseSide.getInterpolatedU(vector.getMaxX() * 16);
    minV = iconToUseSide.getInterpolatedV(vector.getMinZ() * 16);
    maxV = iconToUseSide.getInterpolatedV(vector.getMaxZ() * 16);

    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), maxU, maxV);

    // Draw north side
    t.setNormal(0, 0, -1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMinZ(), minU, maxV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMinZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMinZ(), maxU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMinZ(), maxU, maxV);

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertexWithUV(vector.getMinX(), vector.getMinY(), vector.getMaxZ(), minU, maxV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMinY(), vector.getMaxZ(), minU, minV);
    t.addVertexWithUV(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ(), maxU, minV);
    t.addVertexWithUV(vector.getMinX(), vector.getMaxY(), vector.getMaxZ(), maxU, maxV);
  }