コード例 #1
0
  private int[] getDisplayLists(int liquidId, World world) {

    if (stage.containsKey(liquidId)) return stage.get(liquidId);

    int[] d = new int[displayStages];
    stage.put(liquidId, d);

    BlockInterface block = new BlockInterface();

    // Retrieve the texture depending on type of item.
    if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null)
      block.texture = Block.blocksList[liquidId].blockIndexInTexture;
    else if (Item.itemsList[liquidId] != null)
      block.texture = Item.itemsList[liquidId].getIconFromDamage(0);
    else return null;

    for (int s = 0; s < displayStages; ++s) {
      d[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d[s], 4864 /* GL_COMPILE */);

      block.minX = 0.5 - 4F * factor + 0.01;
      block.minY = 0;
      block.minZ = 0.5 - 4F * factor + 0.01;

      block.maxX = 0.5 + 4F * factor - 0.01;
      block.maxY = (float) s / (float) displayStages;
      block.maxZ = 0.5 + 4F * factor - 0.01;

      RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }

    return d;
  }
コード例 #2
0
  public void doRenderItem(
      TravelingItem travellingItem, double x, double y, double z, float light, EnumColor color) {

    if (travellingItem == null || travellingItem.getItemStack() == null) return;

    float renderScale = 0.7f;
    ItemStack itemstack = travellingItem.getItemStack();
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glTranslatef(0, 0.25F, 0);
    GL11.glScalef(renderScale, renderScale, renderScale);
    dummyEntityItem.setEntityItemStack(itemstack);
    customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, 0);
    if (color != null) {
      func_110628_a(TextureMap.field_110575_b);
      BlockInterface block = new BlockInterface();

      block.texture = PipeIconProvider.TYPE.ItemBox.getIcon();

      float pix = 0.0625F;

      float min = -4 * pix;
      float max = 4 * pix;

      block.minY = min;
      block.maxY = max;

      block.minZ = min;
      block.maxZ = max;

      block.minX = min;
      block.maxX = max;

      int cHex = color.getLightHex();
      float r = (float) (cHex >> 16 & 0xff) / 255F;
      float g = (float) (cHex >> 8 & 0xff) / 255F;
      float b = (float) (cHex & 0xff) / 255F;
      GL11.glColor4f(r, g, b, 1.0F);
      RenderEntityBlock.INSTANCE.renderBlock(block, null, 0, 0, 0, false, true);
    }
    GL11.glPopMatrix();
  }
コード例 #3
0
  private DisplayFluidList getDisplayFluidLists(int liquidId, World world) {
    if (displayFluidLists.containsKey(liquidId)) {
      return displayFluidLists.get(liquidId);
    }

    DisplayFluidList d = new DisplayFluidList();
    displayFluidLists.put(liquidId, d);

    BlockInterface block = new BlockInterface();

    Fluid fluid = FluidRegistry.getFluid(liquidId);
    if (fluid.getBlockID() > 0) {
      block.baseBlock = Block.blocksList[fluid.getBlockID()];
    } else {
      block.baseBlock = Block.waterStill;
    }
    block.texture = fluid.getStillIcon();

    float size = Utils.pipeMaxPos - Utils.pipeMinPos;

    // render size

    for (int s = 0; s < LIQUID_STAGES; ++s) {
      float ratio = (float) s / (float) LIQUID_STAGES;

      // SIDE HORIZONTAL

      d.sideHorizontal[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.sideHorizontal[s], 4864 /* GL_COMPILE */);

      block.minX = 0.0F;
      block.minZ = Utils.pipeMinPos + 0.01F;

      block.maxX = block.minX + size / 2F + 0.01F;
      block.maxZ = block.minZ + size - 0.02F;

      block.minY = Utils.pipeMinPos + 0.01F;
      block.maxY = block.minY + (size - 0.02F) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // SIDE VERTICAL

      d.sideVertical[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.sideVertical[s], 4864 /* GL_COMPILE */);

      block.minY = Utils.pipeMaxPos - 0.01;
      block.maxY = 1;

      block.minX = 0.5 - (size / 2 - 0.01) * ratio;
      block.maxX = 0.5 + (size / 2 - 0.01) * ratio;

      block.minZ = 0.5 - (size / 2 - 0.01) * ratio;
      block.maxZ = 0.5 + (size / 2 - 0.01) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // CENTER HORIZONTAL

      d.centerHorizontal[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.centerHorizontal[s], 4864 /* GL_COMPILE */);

      block.minX = Utils.pipeMinPos + 0.01;
      block.minZ = Utils.pipeMinPos + 0.01;

      block.maxX = block.minX + size - 0.02;
      block.maxZ = block.minZ + size - 0.02;

      block.minY = Utils.pipeMinPos + 0.01;
      block.maxY = block.minY + (size - 0.02F) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();

      // CENTER VERTICAL

      d.centerVertical[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(d.centerVertical[s], 4864 /* GL_COMPILE */);

      block.minY = Utils.pipeMinPos + 0.01;
      block.maxY = Utils.pipeMaxPos - 0.01;

      block.minX = 0.5 - (size / 2 - 0.02) * ratio;
      block.maxX = 0.5 + (size / 2 - 0.02) * ratio;

      block.minZ = 0.5 - (size / 2 - 0.02) * ratio;
      block.maxZ = 0.5 + (size / 2 - 0.02) * ratio;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }

    return d;
  }
コード例 #4
0
  private void initializeDisplayPowerList(World world) {
    if (initialized) return;

    initialized = true;

    BlockInterface block = new BlockInterface();
    block.texture =
        BuildCraftTransport.instance.pipeIconProvider.getIcon(
            PipeIconProvider.TYPE.Power_Normal.ordinal());

    float size = Utils.pipeMaxPos - Utils.pipeMinPos;

    for (int s = 0; s < POWER_STAGES; ++s) {
      displayPowerList[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(displayPowerList[s], 4864 /* GL_COMPILE */);

      float minSize = 0.005F;

      float unit = (size - minSize) / 2F / POWER_STAGES;

      block.minY = 0.5 - (minSize / 2F) - unit * s;
      block.maxY = 0.5 + (minSize / 2F) + unit * s;

      block.minZ = 0.5 - (minSize / 2F) - unit * s;
      block.maxZ = 0.5 + (minSize / 2F) + unit * s;

      block.minX = 0;
      block.maxX = 0.5 + (minSize / 2F) + unit * s;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }

    block.texture =
        BuildCraftTransport.instance.pipeIconProvider.getIcon(
            PipeIconProvider.TYPE.Power_Overload.ordinal());

    size = Utils.pipeMaxPos - Utils.pipeMinPos;

    for (int s = 0; s < POWER_STAGES; ++s) {
      displayPowerListOverload[s] = GLAllocation.generateDisplayLists(1);
      GL11.glNewList(displayPowerListOverload[s], 4864 /* GL_COMPILE */);

      float minSize = 0.005F;

      float unit = (size - minSize) / 2F / POWER_STAGES;

      block.minY = 0.5 - (minSize / 2F) - unit * s;
      block.maxY = 0.5 + (minSize / 2F) + unit * s;

      block.minZ = 0.5 - (minSize / 2F) - unit * s;
      block.maxZ = 0.5 + (minSize / 2F) + unit * s;

      block.minX = 0;
      block.maxX = 0.5 + (minSize / 2F) + unit * s;

      RenderEntityBlock.INSTANCE.renderBlock(block, world, 0, 0, 0, false, true);

      GL11.glEndList();
    }
  }