Пример #1
0
  public void commit() {
    // get or create a data model
    RenderData writable = mWritables.poll();
    if (writable == null) writable = new RenderData();

    // copy readable into writable
    writable.copy(mWritable);

    // enqueue the model
    mReadables.add(writable);
  }
Пример #2
0
  public void renderAModelAt(
      TileEntityDynamicTank tileEntity, double x, double y, double z, float partialTick) {
    if (tileEntity.clientHasStructure
        && tileEntity.isRendering
        && tileEntity.structure != null
        && tileEntity.structure.fluidStored != null
        && tileEntity.structure.fluidStored.amount != 0) {
      RenderData data = new RenderData();

      data.location = tileEntity.structure.renderLocation;
      data.height = tileEntity.structure.volHeight;
      data.length = tileEntity.structure.volLength;
      data.width = tileEntity.structure.volWidth;

      bindTexture(MekanismRenderer.getBlocksTexture());

      if (data.location != null
          && data.height >= 3
          && tileEntity.structure.fluidStored.getFluid() != null) {
        push();

        GL11.glTranslated(
            getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));

        MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
        MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid());

        DisplayInteger[] displayList =
            getListAndRender(
                data, tileEntity.structure.fluidStored.getFluid(), tileEntity.getWorldObj());

        if (tileEntity.structure.fluidStored.getFluid().isGaseous()) {
          GL11.glColor4f(
              1F,
              1F,
              1F,
              Math.min(
                  1,
                  ((float) tileEntity.structure.fluidStored.amount
                          / (float) tileEntity.clientCapacity)
                      + MekanismRenderer.GAS_RENDER_BASE));
          displayList[getStages(data.height) - 1].render();
        } else {
          displayList[
              Math.min(
                  getStages(data.height) - 1,
                  (int) (tileEntity.prevScale * ((float) getStages(data.height) - 1)))]
              .render();
        }

        MekanismRenderer.glowOff();
        MekanismRenderer.resetColor();

        pop();

        for (ValveData valveData : tileEntity.valveViewing) {
          push();

          GL11.glTranslated(
              getX(valveData.location.xCoord),
              getY(valveData.location.yCoord),
              getZ(valveData.location.zCoord));

          MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());

          getValveDisplay(
                  ValveRenderData.get(data, valveData),
                  tileEntity.structure.fluidStored.getFluid(),
                  tileEntity.getWorldObj())
              .render();

          MekanismRenderer.glowOff();
          MekanismRenderer.resetColor();

          pop();
        }
      }
    }
  }