コード例 #1
0
 private void renderLiquidPart(
     IBlockAccess world,
     int x,
     int y,
     int z,
     Block block,
     RenderBlocks renderer,
     CastingChannelLogic logic) {
   FluidStack liquid = logic.liquid;
   int color = block.colorMultiplier(world, x, y, z);
   float red = (color >> 16 & 0xFF) / 255.0F;
   float green = (color >> 8 & 0xFF) / 255.0F;
   float blue = (color & 0xFF) / 255.0F;
   Fluid fluid = liquid.getFluid();
   if (fluid.canBePlacedInWorld())
     BlockSkinRenderHelper.renderMetadataBlock(
         Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
   else
     BlockSkinRenderHelper.renderLiquidBlock(
         fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
 }
コード例 #2
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;
  }