コード例 #1
0
 public static void renderItemIntoGUI(
     FontRenderer fontRenderer,
     ItemStack itemStack,
     int x,
     int y,
     float opacity,
     float scale,
     int zLevel) {
   IIcon icon = itemStack.getIconIndex();
   GL11.glDisable(GL11.GL_LIGHTING);
   FMLClientHandler.instance()
       .getClient()
       .renderEngine
       .bindTexture(TextureMap.locationItemsTexture);
   int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0);
   float red = (overlayColour >> 16 & 255) / 255.0F;
   float green = (overlayColour >> 8 & 255) / 255.0F;
   float blue = (overlayColour & 255) / 255.0F;
   GL11.glColor4f(red, green, blue, opacity);
   Tessellator tessellator = Tessellator.instance;
   tessellator.startDrawingQuads();
   tessellator.addVertexWithUV(x, y + 16 * scale, zLevel, icon.getMinU(), icon.getMaxV());
   tessellator.addVertexWithUV(
       x + 16 * scale, y + 16 * scale, zLevel, icon.getMaxU(), icon.getMaxV());
   tessellator.addVertexWithUV(x + 16 * scale, y, zLevel, icon.getMaxU(), icon.getMinV());
   tessellator.addVertexWithUV(x, y, zLevel, icon.getMinU(), icon.getMinV());
   tessellator.draw();
   GL11.glEnable(GL11.GL_LIGHTING);
 }
コード例 #2
0
  private void DrawIconAtXY(
      IIcon IIcon, String base, float x, float y, int w, int h, boolean semitransparent) {

    if (IIcon == null) return;

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    tessellator.addVertexWithUV(x, y + h, this.zLevel, IIcon.getMinU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y + h, this.zLevel, IIcon.getMaxU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y, this.zLevel, IIcon.getMaxU(), IIcon.getMinV());
    tessellator.addVertexWithUV(x, y, this.zLevel, IIcon.getMinU(), IIcon.getMinV());

    tessellator.draw();
  }
コード例 #3
0
  protected void renderParticleQuad(
      Tessellator tessellator,
      float partialTickTime,
      Double3 currentPos,
      Double3 previousPos,
      Double3 vec1,
      Double3 vec2,
      IIcon icon,
      double scale) {
    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();

    Double3 center =
        new Double3(
            previousPos.x + (currentPos.x - previousPos.x) * partialTickTime - interpPosX,
            previousPos.y + (currentPos.y - previousPos.y) * partialTickTime - interpPosY,
            previousPos.z + (currentPos.z - previousPos.z) * partialTickTime - interpPosZ);

    addVertex(tessellator, center.sub(vec1.scale(scale)), maxU, maxV);
    addVertex(tessellator, center.sub(vec2.scale(scale)), maxU, minV);
    addVertex(tessellator, center.add(vec1.scale(scale)), minU, minV);
    addVertex(tessellator, center.add(vec2.scale(scale)), minU, maxV);
  }
コード例 #4
0
  private void renderWhirlwind(
      EntityWhirlwind whirlwind, double x, double y, double z, float f, float f1) {
    GL11.glPushMatrix();

    Minecraft.getMinecraft().renderEngine.bindTexture(rLoc);

    Tessellator tessellator = Tessellator.instance;
    IIcon IIcon = AMParticleIcons.instance.getIconByName("wind");

    GL11.glTranslated(x, y, z);

    float f4 = 1.0F;
    float f5 = 0.5F;
    float f6 = 0.25F;
    float min_u = IIcon.getMinU();
    float min_v = IIcon.getMinV();
    float max_u = IIcon.getMaxU();
    float max_v = IIcon.getMaxV();

    GL11.glRotatef(180F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.setBrightness(0xF00F0);
    tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, min_u, max_v);
    tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, max_u, max_v);
    tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, max_u, min_v);
    tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, min_u, min_v);
    tessellator.draw();

    GL11.glPopMatrix();
  }
コード例 #5
0
  void drawSpike(
      IIcon icon, double r, double h, double x, double y, double z, double dx, double dz) {
    Tessellator tessellator = Tessellator.instance;

    double u0 = icon.getMinU();
    double u1 = icon.getMaxU();
    double v0 = icon.getMaxV();
    double v1 = icon.getMinV();

    double tx = x + dx;
    double ty = y + h;
    double tz = z + dz;

    tessellator.addVertexWithUV(x + r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(x + r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);

    tessellator.addVertexWithUV(x - r, y + 0, z + r, u1, v0);
    tessellator.addVertexWithUV(x + r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);

    tessellator.addVertexWithUV(x + r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(x - r, y + 0, z - r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);

    tessellator.addVertexWithUV(x - r, y + 0, z - r, u1, v0);
    tessellator.addVertexWithUV(x - r, y + 0, z + r, u0, v0);
    tessellator.addVertexWithUV(tx, ty, tz, u1, v1);
    tessellator.addVertexWithUV(tx, ty, tz, u0, v1);
  }
コード例 #6
0
  private void renderEntityOnFire(
      Entity par1Entity, double par2, double par4, double par6, float par8) {
    GL11.glDisable(GL11.GL_LIGHTING);
    IIcon icon = Blocks.fire.getFireIcon(0);
    IIcon icon1 = Blocks.fire.getFireIcon(1);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) par2, (float) par4, (float) par6);
    float f1 = par1Entity.width * 1.4F;

    EntityFlameFireball entityFireball = (EntityFlameFireball) par1Entity;
    f1 *= entityFireball.fireballMaxGrowth / entityFireball.fireballGrowth;

    GL11.glScalef(f1, f1, f1);
    Tessellator tessellator = Tessellator.instance;
    float f2 = 0.5F;
    float f3 = 0.0F;
    float f4 = par1Entity.height / f1;
    float f5 = (float) (par1Entity.posY - par1Entity.boundingBox.minY);
    GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float) ((int) f4) * 0.02F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float f6 = 0.0F;
    int i = 0;
    tessellator.startDrawingQuads();

    while (f4 > 0.0F) {
      IIcon icon2 = i % 2 == 0 ? icon : icon1;
      this.bindTexture(TextureMap.locationBlocksTexture);
      float f7 = icon2.getMinU();
      float f8 = icon2.getMinV();
      float f9 = icon2.getMaxU();
      float f10 = icon2.getMaxV();

      if (i / 2 % 2 == 0) {
        float f11 = f9;
        f9 = f7;
        f7 = f11;
      }

      tessellator.addVertexWithUV(
          (double) (f2 - f3), (double) (0.0F - f5), (double) f6, (double) f9, (double) f10);
      tessellator.addVertexWithUV(
          (double) (-f2 - f3), (double) (0.0F - f5), (double) f6, (double) f7, (double) f10);
      tessellator.addVertexWithUV(
          (double) (-f2 - f3), (double) (1.4F - f5), (double) f6, (double) f7, (double) f8);
      tessellator.addVertexWithUV(
          (double) (f2 - f3), (double) (1.4F - f5), (double) f6, (double) f9, (double) f8);
      f4 -= 0.45F;
      f5 -= 0.45F;
      f2 *= 0.9F;
      f6 += 0.03F;
      ++i;
    }

    tessellator.draw();
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_LIGHTING);
  }
コード例 #7
0
  private static void renderCoreWithTex(final IIcon cone, final Tessellator tex) {
    final float minU = cone.getMinU();
    final float minV = cone.getMinV();
    final float maxU = cone.getMaxU();
    final float maxV = cone.getMaxV();

    renderNorthFace(tex, minU, minV, maxU, maxV);
    renderWestFace(tex, minU, minV, maxU, maxV);
    renderSouthFace(tex, minU, minV, maxU, maxV);
    renderEastFace(tex, minU, minV, maxU, maxV);
  }
コード例 #8
0
    void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
      tessellator = Tessellator.instance;

      i0u0 = icon.getMinU();
      i0uh = icon.getInterpolatedU(8.0D);
      i0u1 = icon.getMaxU();
      i0v0 = icon.getMinV();
      i0v1 = icon.getMaxV();

      i1u0 = icon1.getInterpolatedU(7.0D);
      i1u1 = icon1.getInterpolatedU(9.0D);
      i1v0 = icon1.getMinV();
      i1vh = icon1.getInterpolatedV(8.0D);
      i1v1 = icon1.getMaxV();
      i1v = i1v1 - i1v0;

      i2u0 = icon2.getInterpolatedU(7.0D);
      i2u1 = icon2.getInterpolatedU(9.0D);
      i2v0 = icon2.getMinV();
      i2v1 = icon2.getMaxV();
      i2v = i2v1 - i2v0;

      x0 = x;
      xh = x0 + 0.5D;
      x1 = x + 1;
      xp0 = x0 + 0.5D - 0.0625D;
      xp1 = x0 + 0.5D + 0.0625D;

      z0 = z;
      zh = z0 + 0.5D;
      z1 = z + 1;
      zp0 = z0 + 0.5D - 0.0625D;
      zp1 = z0 + 0.5D + 0.0625D;

      y0 = y;
      y1 = y + 1;
    }
コード例 #9
0
  private void DrawPartialIconAtXY(
      IIcon IIcon,
      float pct_x,
      float pct_y,
      float x,
      float y,
      float w,
      float h,
      boolean semitransparent) {
    if (IIcon == null) return;

    mc.renderEngine.bindTexture(items);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    tessellator.addVertexWithUV(x, y + (h * pct_y), this.zLevel, IIcon.getMinU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(
        x + (w * pct_x), y + (h * pct_y), this.zLevel, IIcon.getMaxU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + (w * pct_x), y, this.zLevel, IIcon.getMaxU(), IIcon.getMinV());
    tessellator.addVertexWithUV(x, y, this.zLevel, IIcon.getMinU(), IIcon.getMinV());

    tessellator.draw();
  }
コード例 #10
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    IIcon icon = RenderBlocks.getInstance().getBlockIconFromSideAndMetadata(block, 0, 0);

    float minU = icon.getMinU();
    float minV = icon.getMinV();
    float maxU = icon.getMaxU();
    float maxV = icon.getMaxV();

    Tessellator t = Tessellator.instance;

    int lightValue = block.getMixedBrightnessForBlock(world, x, y, z);
    t.setColorOpaque_F(1.0F, 1.0F, 1.0F);

    // Bottom
    t.addVertexWithUV(x + 0, y + 0, z + 0, minU, minV);
    t.addVertexWithUV(x + 1, y + 0, z + 0, maxU, minV);
    t.addVertexWithUV(x + 1, y + 0, z + 1, maxU, maxV);
    t.addVertexWithUV(x + 0, y + 0, z + 1, minU, maxV);
    // Top
    t.addVertexWithUV(x + 0, y + 1, z + 1, minU, maxV);
    t.addVertexWithUV(x + 1, y + 1, z + 1, maxU, maxV);
    t.addVertexWithUV(x + 1, y + 1, z + 0, maxU, minV);
    t.addVertexWithUV(x + 0, y + 1, z + 0, minU, minV);
    // Side
    t.addVertexWithUV(x + 0, y + 0, z + 1, minU, maxV);
    t.addVertexWithUV(x + 0, y + 1, z + 1, maxU, maxV);
    t.addVertexWithUV(x + 0, y + 1, z + 0, maxU, minV);
    t.addVertexWithUV(x + 0, y + 0, z + 0, minU, minV);
    // Side
    t.addVertexWithUV(x + 1, y + 0, z + 0, minU, minV);
    t.addVertexWithUV(x + 1, y + 1, z + 0, maxU, minV);
    t.addVertexWithUV(x + 1, y + 1, z + 1, maxU, maxV);
    t.addVertexWithUV(x + 1, y + 0, z + 1, minU, maxV);
    // Side
    t.addVertexWithUV(x + 1, y + 0, z + 1, minU, maxV);
    t.addVertexWithUV(x + 1, y + 1, z + 1, maxU, maxV);
    t.addVertexWithUV(x + 0, y + 1, z + 1, maxU, minV);
    t.addVertexWithUV(x + 0, y + 0, z + 1, minU, minV);
    // Side
    t.addVertexWithUV(x + 0, y + 0, z + 0, minU, minV);
    t.addVertexWithUV(x + 0, y + 1, z + 0, maxU, minV);
    t.addVertexWithUV(x + 1, y + 1, z + 0, maxU, maxV);
    t.addVertexWithUV(x + 1, y + 0, z + 0, minU, maxV);

    return false;
  }
コード例 #11
0
 private void renderLiquid(TileEntity tile, double par2, double par4, double par6) {
   GL11.glTranslated(par2, par4, par6);
   TileEntityFillingStation tr = (TileEntityFillingStation) tile;
   double dx = 0;
   double dz = 0;
   double ddx = 0;
   double ddz = 0;
   switch (tr.getBlockMetadata()) {
     case 0:
       dx = 0.25;
       break;
     case 1:
       ddx = 0.25;
       break;
     case 2:
       dz = 0.25;
       break;
     case 3:
       ddz = 0.25;
       break;
   }
   if (!tr.isEmpty() && tr.isInWorld()) {
     Fluid f = tr.getFluid();
     if (!f.equals(FluidRegistry.LAVA)) {
       GL11.glEnable(GL11.GL_BLEND);
     }
     ReikaLiquidRenderer.bindFluidTexture(f);
     IIcon ico = f.getIcon();
     float u = ico.getMinU();
     float v = ico.getMinV();
     float du = ico.getMaxU();
     float dv = ico.getMaxV();
     double h = 0.0625 + 14D / 16D * tr.getLevel() / tr.CAPACITY;
     Tessellator v5 = Tessellator.instance;
     if (f.getLuminosity() > 0) ReikaRenderHelper.disableLighting();
     v5.startDrawingQuads();
     v5.setNormal(0, 1, 0);
     v5.addVertexWithUV(dx + 0, h, -ddz + 1, u, dv);
     v5.addVertexWithUV(-ddx + 1, h, -ddz + 1, du, dv);
     v5.addVertexWithUV(-ddx + 1, h, dz + 0, du, v);
     v5.addVertexWithUV(dx + 0, h, dz + 0, u, v);
     v5.draw();
     ReikaRenderHelper.enableLighting();
   }
   GL11.glTranslated(-par2, -par4, -par6);
   GL11.glDisable(GL11.GL_BLEND);
 }
コード例 #12
0
  public void render(double x, double y, double z, int color, boolean inworld) {
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    Tessellator v5 = Tessellator.instance;
    spline.render(v5, 0.5, 0.5, 0.5, color, inworld, true, 32);

    IIcon ico = ChromaIcons.FADE.getIcon();
    float u = ico.getMinU();
    float v = ico.getMinV();
    float du = ico.getMaxU();
    float dv = ico.getMaxV();
    BlendMode.ADDITIVEDARK.apply();
    ReikaTextureHelper.bindTerrainTexture();
    GL11.glPushMatrix();
    GL11.glTranslated(0.5, 0.5, 0.5);

    if (inworld) {
      RenderManager rm = RenderManager.instance;
      double dx = x - RenderManager.renderPosX;
      double dy = y - RenderManager.renderPosY;
      double dz = z - RenderManager.renderPosZ;
      double[] angs = ReikaPhysicsHelper.cartesianToPolar(dx, dy, dz);
      GL11.glRotated(angs[2], 0, 1, 0);
      GL11.glRotated(90 - angs[1], 1, 0, 0);
    }

    double d = 1.25;

    double pz = 0.05;

    v5.startDrawingQuads();
    int a = 160;
    v5.setColorRGBA_I(ReikaColorAPI.getColorWithBrightnessMultiplier(color, a / 255F), a);
    v5.addVertexWithUV(-d, -d, pz, u, v);
    v5.addVertexWithUV(d, -d, pz, du, v);
    v5.addVertexWithUV(d, d, pz, du, dv);
    v5.addVertexWithUV(-d, d, pz, u, dv);
    v5.draw();

    BlendMode.DEFAULT.apply();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_LIGHTING);
  }
コード例 #13
0
  private void drawRectangleFromIcon(int x, int y, IIcon icon, int width, int height) {
    if (icon == null) return;
    double minU = icon.getMinU();
    double maxU = icon.getMaxU();
    double minV = icon.getMinV();
    double maxV = icon.getMaxV();

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(x + 0, y + height, 0, minU, minV + (maxV - minV) * height / 16.0D);
    tessellator.addVertexWithUV(
        x + width,
        y + height,
        0,
        minU + (maxU - minU) * width / 16.0D,
        minV + (maxV - minV) * height / 16.0D);
    tessellator.addVertexWithUV(x + width, y + 0, 0, minU + (maxU - minU) * width / 16.0D, minV);
    tessellator.addVertexWithUV(x + 0, y + 0, 0, minU, minV);
    tessellator.draw();
  }
コード例 #14
0
 private void drawCrossedSquares(
     IBlockAccess blockAccess,
     double x,
     double y,
     double z,
     float size,
     Block block,
     int meta,
     RenderBlocks renderer) {
   Tessellator tessellator = Tessellator.instance;
   IIcon icon = renderer.getBlockIcon(block, blockAccess, (int) x, (int) y, (int) z, meta);
   if (renderer.hasOverrideBlockTexture()) {
     icon = renderer.overrideBlockTexture;
   }
   double minU = (double) icon.getMinU();
   double minV = (double) icon.getMinV();
   double maxU = (double) icon.getMaxU();
   double maxV = (double) icon.getMaxV();
   double scaledSize = 0.45D * (double) size;
   double minX = x + 0.5D - scaledSize;
   double maxX = x + 0.5D + scaledSize;
   double minZ = z + 0.5D - scaledSize;
   double maxZ = z + 0.5D + scaledSize;
   tessellator.addVertexWithUV(minX, y + (double) size, minZ, minU, minV);
   tessellator.addVertexWithUV(minX, y + 0.0D, minZ, minU, maxV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, maxZ, maxU, maxV);
   tessellator.addVertexWithUV(maxX, y + (double) size, maxZ, maxU, minV);
   tessellator.addVertexWithUV(maxX, y + (double) size, maxZ, minU, minV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, maxZ, minU, maxV);
   tessellator.addVertexWithUV(minX, y + 0.0D, minZ, maxU, maxV);
   tessellator.addVertexWithUV(minX, y + (double) size, minZ, maxU, minV);
   tessellator.addVertexWithUV(minX, y + (double) size, maxZ, minU, minV);
   tessellator.addVertexWithUV(minX, y + 0.0D, maxZ, minU, maxV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, minZ, maxU, maxV);
   tessellator.addVertexWithUV(maxX, y + (double) size, minZ, maxU, minV);
   tessellator.addVertexWithUV(maxX, y + (double) size, minZ, minU, minV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, minZ, minU, maxV);
   tessellator.addVertexWithUV(minX, y + 0.0D, maxZ, maxU, maxV);
   tessellator.addVertexWithUV(minX, y + (double) size, maxZ, maxU, minV);
 }
コード例 #15
0
 private void func_77026_a(Tessellator par1Tessellator, IIcon par2Icon) {
   float f = par2Icon.getMinU();
   float f1 = par2Icon.getMaxU();
   float f2 = par2Icon.getMinV();
   float f3 = par2Icon.getMaxV();
   float f4 = 1.0F;
   float f5 = 0.5F;
   float f6 = 0.25F;
   GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
   GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
   par1Tessellator.startDrawingQuads();
   par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
   par1Tessellator.addVertexWithUV(
       (double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3);
   par1Tessellator.addVertexWithUV(
       (double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3);
   par1Tessellator.addVertexWithUV(
       (double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2);
   par1Tessellator.addVertexWithUV(
       (double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2);
   par1Tessellator.draw();
 }
コード例 #16
0
 private void drawFluids(int recipe) {
   CentrifugeRecipe r = (CentrifugeRecipe) arecipes.get(recipe);
   ItemStack in = r.input;
   FluidStack fs = RecipesCentrifuge.getRecipes().getFluidResult(in);
   if (fs != null) {
     Fluid f = fs.getFluid();
     IIcon ico = f.getIcon();
     float u = ico.getMinU();
     float v = ico.getMinV();
     float du = ico.getMaxU();
     float dv = ico.getMaxV();
     ReikaTextureHelper.bindTerrainTexture();
     Tessellator v5 = Tessellator.instance;
     v5.startDrawingQuads();
     int x = 147;
     for (int i = 0; i < 4; i++) {
       int y = 1 + i * 16;
       v5.addVertexWithUV(x, y, 0, u, v);
       v5.addVertexWithUV(x, y + 16, 0, u, dv);
       v5.addVertexWithUV(x + 16, y + 16, 0, du, dv);
       v5.addVertexWithUV(x + 16, y, 0, du, v);
     }
     v5.addVertexWithUV(x, 65, 0, u, v);
     v5.addVertexWithUV(x, 68, 0, u, dv);
     v5.addVertexWithUV(x + 16, 68, 0, du, dv);
     v5.addVertexWithUV(x + 16, 65, 0, du, v);
     v5.draw();
     FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
     String s =
         f.getLocalizedName()
             + " ("
             + fs.amount
             + " mB) ("
             + RecipesCentrifuge.getRecipes().getFluidChance(in)
             + "%)";
     int l = fr.getStringWidth(s);
     fr.drawString(s, 166 - l, 70, 0);
   }
 }
コード例 #17
0
  public void renderItem(IItemRenderer.ItemRenderType aType, ItemStack aStack, Object... data) {
    if (GT_Utility.isStackInvalid(aStack)) {
      return;
    }
    GT_MetaGenerated_Tool aItem = (GT_MetaGenerated_Tool) aStack.getItem();
    GL11.glEnable(3042);
    if (aType == IItemRenderer.ItemRenderType.ENTITY) {
      if (RenderItem.renderInFrame) {
        GL11.glScalef(0.85F, 0.85F, 0.85F);
        GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(-0.5D, -0.42D, 0.0D);
      } else {
        GL11.glTranslated(-0.5D, -0.42D, 0.0D);
      }
    }
    GL11.glColor3f(1.0F, 1.0F, 1.0F);

    IToolStats tToolStats = aItem.getToolStats(aStack);
    if (tToolStats != null) {
      IIconContainer aIcon = tToolStats.getIcon(false, aStack);
      if (aIcon != null) {
        IIcon tIcon = aIcon.getIcon();
        IIcon tOverlay = aIcon.getOverlayIcon();
        if (tIcon != null) {
          Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
          GL11.glBlendFunc(770, 771);
          short[] tModulation = tToolStats.getRGBa(false, aStack);
          GL11.glColor3f(tModulation[0] / 255.0F, tModulation[1] / 255.0F, tModulation[2] / 255.0F);
          if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
            GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
          } else {
            ItemRenderer.renderItemIn2D(
                Tessellator.instance,
                tIcon.getMaxU(),
                tIcon.getMinV(),
                tIcon.getMinU(),
                tIcon.getMaxV(),
                tIcon.getIconWidth(),
                tIcon.getIconHeight(),
                0.0625F);
          }
          GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        if (tOverlay != null) {
          Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
          GL11.glBlendFunc(770, 771);
          if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
            GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
          } else {
            ItemRenderer.renderItemIn2D(
                Tessellator.instance,
                tOverlay.getMaxU(),
                tOverlay.getMinV(),
                tOverlay.getMinU(),
                tOverlay.getMaxV(),
                tOverlay.getIconWidth(),
                tOverlay.getIconHeight(),
                0.0625F);
          }
        }
      }
      aIcon = tToolStats.getIcon(true, aStack);
      if (aIcon != null) {
        IIcon tIcon = aIcon.getIcon();
        IIcon tOverlay = aIcon.getOverlayIcon();
        if (tIcon != null) {
          Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
          GL11.glBlendFunc(770, 771);
          short[] tModulation = tToolStats.getRGBa(true, aStack);
          GL11.glColor3f(tModulation[0] / 255.0F, tModulation[1] / 255.0F, tModulation[2] / 255.0F);
          if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
            GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
          } else {
            ItemRenderer.renderItemIn2D(
                Tessellator.instance,
                tIcon.getMaxU(),
                tIcon.getMinV(),
                tIcon.getMinU(),
                tIcon.getMaxV(),
                tIcon.getIconWidth(),
                tIcon.getIconHeight(),
                0.0625F);
          }
          GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        if (tOverlay != null) {
          Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
          GL11.glBlendFunc(770, 771);
          if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
            GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
          } else {
            ItemRenderer.renderItemIn2D(
                Tessellator.instance,
                tOverlay.getMaxU(),
                tOverlay.getMinV(),
                tOverlay.getMinU(),
                tOverlay.getMaxV(),
                tOverlay.getIconWidth(),
                tOverlay.getIconHeight(),
                0.0625F);
          }
        }
      }
      if ((aType == IItemRenderer.ItemRenderType.INVENTORY)
          && (GT_MetaGenerated_Tool.getPrimaryMaterial(aStack) != Materials._NULL)) {
        long tDamage = GT_MetaGenerated_Tool.getToolDamage(aStack);
        long tMaxDamage = GT_MetaGenerated_Tool.getToolMaxDamage(aStack);
        if (tDamage <= 0L) {
          aIcon = gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[8];
        } else if (tDamage >= tMaxDamage) {
          aIcon = gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[0];
        } else {
          aIcon =
              gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[
                  ((int)
                      java.lang.Math.max(
                          0L, java.lang.Math.min(7L, (tMaxDamage - tDamage) * 8L / tMaxDamage)))];
        }
        if (aIcon != null) {
          IIcon tIcon = aIcon.getIcon();
          IIcon tOverlay = aIcon.getOverlayIcon();
          if (tIcon != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
            GL11.glBlendFunc(770, 771);
            if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
              GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
            } else {
              ItemRenderer.renderItemIn2D(
                  Tessellator.instance,
                  tIcon.getMaxU(),
                  tIcon.getMinV(),
                  tIcon.getMinU(),
                  tIcon.getMaxV(),
                  tIcon.getIconWidth(),
                  tIcon.getIconHeight(),
                  0.0625F);
            }
          }
          if (tOverlay != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
            GL11.glBlendFunc(770, 771);
            if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
              GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
            } else {
              ItemRenderer.renderItemIn2D(
                  Tessellator.instance,
                  tOverlay.getMaxU(),
                  tOverlay.getMinV(),
                  tOverlay.getMinU(),
                  tOverlay.getMaxV(),
                  tOverlay.getIconWidth(),
                  tOverlay.getIconHeight(),
                  0.0625F);
            }
          }
        }
        Long[] tStats = aItem.getElectricStats(aStack);
        if ((tStats != null) && (tStats[3].longValue() < 0L)) {
          long tCharge = aItem.getRealCharge(aStack);
          if (tCharge <= 0L) {
            aIcon = gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[0];
          } else if (tCharge >= tStats[0].longValue()) {
            aIcon = gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[8];
          } else {
            aIcon =
                gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[
                    (7
                        - (int)
                            java.lang.Math.max(
                                0L,
                                java.lang.Math.min(
                                    6L,
                                    (tStats[0].longValue() - tCharge)
                                        * 7L
                                        / tStats[0].longValue())))];
          }
        } else {
          aIcon = null;
        }
        if (aIcon != null) {
          IIcon tIcon = aIcon.getIcon();
          IIcon tOverlay = aIcon.getOverlayIcon();
          if (tIcon != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
            GL11.glBlendFunc(770, 771);
            if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
              GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
            } else {
              ItemRenderer.renderItemIn2D(
                  Tessellator.instance,
                  tIcon.getMaxU(),
                  tIcon.getMinV(),
                  tIcon.getMinU(),
                  tIcon.getMaxV(),
                  tIcon.getIconWidth(),
                  tIcon.getIconHeight(),
                  0.0625F);
            }
          }
          if (tOverlay != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile());
            GL11.glBlendFunc(770, 771);
            if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) {
              GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F);
            } else {
              ItemRenderer.renderItemIn2D(
                  Tessellator.instance,
                  tOverlay.getMaxU(),
                  tOverlay.getMinV(),
                  tOverlay.getMinU(),
                  tOverlay.getMaxV(),
                  tOverlay.getIconWidth(),
                  tOverlay.getIconHeight(),
                  0.0625F);
            }
          }
        }
      }
    }
    GL11.glDisable(3042);
  }
コード例 #18
0
  private void renderPylon(int posX, int posY) {
    float mod = 2000F;
    int tick = (int) ((System.currentTimeMillis() / (double) mod) % 16);
    CrystalElement e1 = CrystalElement.elements[tick];
    CrystalElement e2 = CrystalElement.elements[(tick + 1) % 16];
    float mix = (float) (System.currentTimeMillis() % (double) mod) / mod;
    mix = Math.min(mix * 2, 1);
    int c1 = e1.getColor();
    int c2 = e2.getColor();
    int color = ReikaColorAPI.mixColors(c2, c1, mix);
    ReikaTextureHelper.bindTerrainTexture();
    Tessellator v5 = Tessellator.instance;
    v5.setBrightness(240);
    v5.startDrawingQuads();
    v5.setColorOpaque_I(color);
    IIcon ico = ChromaIcons.ROUNDFLARE.getIcon();
    GL11.glEnable(GL11.GL_BLEND);
    BlendMode.ADDITIVEDARK.apply();
    float u = ico.getMinU();
    float v = ico.getMinV();
    float du = ico.getMaxU();
    float dv = ico.getMaxV();
    int w = 96;
    int x = posX + 115;
    int y = posY - 4;
    v5.addVertexWithUV(x, y + w, 0, u, dv);
    v5.addVertexWithUV(x + w, y + w, 0, du, dv);
    v5.addVertexWithUV(x + w, y, 0, du, v);
    v5.addVertexWithUV(x, y, 0, u, v);

    ico = ChromaIcons.BIGFLARE.getIcon();
    u = ico.getMinU();
    v = ico.getMinV();
    du = ico.getMaxU();
    dv = ico.getMaxV();
    w = 8;

    Iterator<PylonParticle> it = particles.iterator();
    while (it.hasNext()) {
      PylonParticle p = it.next();
      v5.addVertexWithUV(p.posX, p.posY + w, 0, u, dv);
      v5.addVertexWithUV(p.posX + w, p.posY + w, 0, du, dv);
      v5.addVertexWithUV(p.posX + w, p.posY, 0, du, v);
      v5.addVertexWithUV(p.posX, p.posY, 0, u, v);

      p.move(180D / ReikaRenderHelper.getFPS());

      p.age++;
      if (!ReikaMathLibrary.isValueInsideBounds(posX, posX + xSize - 8, p.posX)
          || !ReikaMathLibrary.isValueInsideBounds(posY, posY + 80, p.posY)) {
        it.remove();
      }
    }

    v5.draw();

    if (rand.nextInt(50) == 0) {
      particles.add(new PylonParticle(245, 40, rand.nextInt(360)));
    }

    BlendMode.DEFAULT.apply();
  }
コード例 #19
0
  @Override
  public void renderTileEntityAt(
      TileEntity tile, double par2, double par4, double par6, float par8) {
    TileEntityPageExtractor te = (TileEntityPageExtractor) tile;
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glTranslated(par2, par4, par6);

    boolean hasBook = te.getStackInSlot(0) != null;
    double t = System.currentTimeMillis() / 10D;
    Tessellator v5 = Tessellator.instance;

    if (!te.isInWorld() || MinecraftForgeClient.getRenderPass() == 0) {
      GL11.glColor4f(1, 1, 1, 1);
      ReikaTextureHelper.bindTerrainTexture();
      v5.startDrawingQuads();
      v5.setBrightness(
          te.isInWorld()
              ? te.getBlockType()
                  .getMixedBrightnessForBlock(te.worldObj, te.xCoord, te.yCoord, te.zCoord)
              : 240);
      v5.setColorOpaque_I(0xffffff);
      IIcon ico = Blocks.stone_slab.getIcon(0, 0);
      double u = ico.getMinU();
      double v = ico.getMinV();
      double du = ico.getMaxU();
      double dv = ico.getMaxV();

      ico = Blocks.stone_slab.getIcon(2, 0);
      double u2 = ico.getMinU();
      double v2 = ico.getMinV();
      double du2 = ico.getMaxU();
      double dv2 = ico.getInterpolatedV(8);

      double h = 0.1875;
      double s = 0.375;

      v5.setNormal(0, 1, 0);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u, v);

      v5.setColorOpaque_I(0xa0a0a0);
      v5.addVertexWithUV(1, 0, 0, u2, dv2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du2, v2);
      v5.addVertexWithUV(1, 0, 1, du2, dv2);

      v5.addVertexWithUV(0, 0, 1, u2, v2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, du2, dv2);
      v5.addVertexWithUV(0, 0, 0, du2, v2);

      v5.setColorOpaque_I(0x909090);
      v5.addVertexWithUV(1, 0, 1, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, du2, dv2);
      v5.addVertexWithUV(0, 0, 1, du2, v2);

      v5.addVertexWithUV(0, 0, 0, u2, dv2);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, u2, v2);
      v5.addVertexWithUV(0.5 + s, h, 0.5 - s, du2, v2);
      v5.addVertexWithUV(1, 0, 0, du2, dv2);

      v5.setColorOpaque_I(0x707070);
      v5.addVertexWithUV(0, 0, 0, u, v);
      v5.addVertexWithUV(1, 0, 0, du, v);
      v5.addVertexWithUV(1, 0, 1, du, dv);
      v5.addVertexWithUV(0, 0, 1, u, dv);
      v5.draw();

      if (hasBook) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0.5, 0.5);
        GL11.glRotated(90, 0, 0, 1);
        double a = (t / 2D) % 360D;
        double da1 = 5 * Math.sin(t / 32D);
        double da2 = 8 * Math.cos(t / 48D);
        GL11.glRotated(a, 1, 0, 0);
        GL11.glRotated(da1, 0, 1, 0);
        GL11.glRotated(da2, 0, 0, 1);
        this.bindTexture(bookTex);
        book.render(null, 0, 0, 0, 1.05F, 0, 0.0625F);
        GL11.glPopMatrix();
      }
    }

    if (!te.isInWorld() || MinecraftForgeClient.getRenderPass() == 1) {

      GL11.glEnable(GL11.GL_BLEND);
      BlendMode.ADDITIVEDARK.apply();
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      GL11.glDepthMask(false);

      for (BasicVariablePoint point : points) {
        double r = 0.75 + 0.25 * Math.sin(t / 50D + Math.toRadians(point.hashCode() / 32D % 360D));
        DecimalPosition pos = point.asPosition();
        if (hasBook) {
          ChromaFX.renderBeam(
              0.5,
              0.5,
              0.5,
              0.5 + r * pos.xCoord,
              0.5 + r * pos.yCoord,
              0.5 + r * pos.zCoord,
              par8,
              255,
              0.125);
        } else {
          r /= 2;
        }
        if (te.isInWorld() && !Minecraft.getMinecraft().isGamePaused()) {
          EntityBlurFX fx =
              new EntityBlurFX(
                  te.worldObj,
                  te.xCoord + 0.5 + pos.xCoord * r,
                  te.yCoord + 0.5 + pos.yCoord * r,
                  te.zCoord + 0.5 + pos.zCoord * r);
          fx.setRapidExpand()
              .setScale(0.625F)
              .setLife(8)
              .setAlphaFading()
              .setIcon(ChromaIcons.FADE_GENTLE);
          Minecraft.getMinecraft().effectRenderer.addEffect(fx);
        }
        point.update();
      }

      GL11.glEnable(GL11.GL_TEXTURE_2D);
      ReikaTextureHelper.bindTerrainTexture();

      GL11.glTranslated(0.5, 0.5, 0.5);

      RenderManager rm = RenderManager.instance;
      if (te.isInWorld()) {
        GL11.glRotatef(-rm.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(rm.playerViewX, 1.0F, 0.0F, 0.0F);
      } else {
        GL11.glTranslated(0, 0.125, 0);
        GL11.glRotated(180 + 45, 0, 1, 0);
        GL11.glRotated(30, 1, 0, 0);
      }

      ChromaIcons[] icons =
          hasBook
              ? new ChromaIcons[] {
                ChromaIcons.HEXFLARE, ChromaIcons.BLURFLARE, ChromaIcons.RADIATE,
              }
              : new ChromaIcons[] {
                ChromaIcons.CONCENTRIC2REV, ChromaIcons.ROSES_WHITE,
              };

      for (int i = 0; i < icons.length; i++) {
        IIcon ico = icons[i].getIcon();

        double sb = hasBook ? 0.75 : 0.5;

        double s = sb - 0.1875 * i;

        double u = ico.getMinU();
        double v = ico.getMinV();
        double du = ico.getMaxU();
        double dv = ico.getMaxV();

        v5.startDrawingQuads();
        v5.setBrightness(240);
        v5.addVertexWithUV(-s, s, 0, u, dv);
        v5.addVertexWithUV(s, s, 0, du, dv);
        v5.addVertexWithUV(s, -s, 0, du, v);
        v5.addVertexWithUV(-s, -s, 0, u, v);
        v5.draw();
      }
    }

    GL11.glPopMatrix();
    GL11.glPopAttrib();
  }
コード例 #20
0
  public boolean renderGreekFire(
      IBlockAccess blockAccess,
      BlockGreekFire block,
      int p_147801_2_,
      int p_147801_3_,
      int p_147801_4_) {
    Tessellator tessellator = Tessellator.instance;
    IIcon iicon = block.getFireIcon(0);
    IIcon iicon1 = block.getFireIcon(1);
    IIcon iicon2 = iicon;

    tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
    tessellator.setBrightness(
        block.getMixedBrightnessForBlock(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_));
    double d0 = (double) iicon2.getMinU();
    double d1 = (double) iicon2.getMinV();
    double d2 = (double) iicon2.getMaxU();
    double d3 = (double) iicon2.getMaxV();
    float f = 1.4F;
    double d5;
    double d6;
    double d7;
    double d8;
    double d9;
    double d10;
    double d11;

    if (!World.doesBlockHaveSolidTopSurface(blockAccess, p_147801_2_, p_147801_3_ - 1, p_147801_4_)
        && !block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_ - 1, p_147801_4_, UP)) {
      float f2 = 0.2F;
      float f1 = 0.0625F;
      boolean sides = false;

      if ((p_147801_2_ + p_147801_3_ + p_147801_4_ & 1) == 1) {
        d0 = (double) iicon1.getMinU();
        d1 = (double) iicon1.getMinV();
        d2 = (double) iicon1.getMaxU();
        d3 = (double) iicon1.getMaxV();
      }

      if ((p_147801_2_ / 2 + p_147801_3_ / 2 + p_147801_4_ / 2 & 1) == 1) {
        d5 = d2;
        d2 = d0;
        d0 = d5;
      }

      if (block.canCatchFire(blockAccess, p_147801_2_ - 1, p_147801_3_, p_147801_4_, EAST)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) p_147801_2_ + f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_ + 1, p_147801_3_, p_147801_4_, WEST)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1 - 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) ((float) (p_147801_2_ + 1) - f2),
            (double) ((float) p_147801_3_ + f + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_ - 1, SOUTH)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) p_147801_4_ + f2),
            d2,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_, p_147801_4_ + 1, NORTH)) {
        sides = true;
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d0,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d2,
            d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d2,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) (p_147801_3_ + 0) + f1),
            (double) (p_147801_4_ + 1 - 0),
            d0,
            d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1),
            (double) ((float) p_147801_3_ + f + f1),
            (double) ((float) (p_147801_4_ + 1) - f2),
            d0,
            d1);
      }

      if (block.canCatchFire(blockAccess, p_147801_2_, p_147801_3_ + 1, p_147801_4_, DOWN)) {
        sides = true;
        d5 = (double) p_147801_2_ + 0.5D + 0.5D;
        d6 = (double) p_147801_2_ + 0.5D - 0.5D;
        d7 = (double) p_147801_4_ + 0.5D + 0.5D;
        d8 = (double) p_147801_4_ + 0.5D - 0.5D;
        d9 = (double) p_147801_2_ + 0.5D - 0.5D;
        d10 = (double) p_147801_2_ + 0.5D + 0.5D;
        d11 = (double) p_147801_4_ + 0.5D - 0.5D;
        double d12 = (double) p_147801_4_ + 0.5D + 0.5D;
        d0 = (double) iicon.getMinU();
        d1 = (double) iicon.getMinV();
        d2 = (double) iicon.getMaxU();
        d3 = (double) iicon.getMaxV();
        ++p_147801_3_;
        f = -0.2F;

        if ((p_147801_2_ + p_147801_3_ + p_147801_4_ & 1) == 0) {
          tessellator.addVertexWithUV(
              d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
          tessellator.addVertexWithUV(
              d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
          tessellator.addVertexWithUV(
              d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
          tessellator.addVertexWithUV(
              d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
          d0 = (double) iicon1.getMinU();
          d1 = (double) iicon1.getMinV();
          d2 = (double) iicon1.getMaxU();
          d3 = (double) iicon1.getMaxV();
          tessellator.addVertexWithUV(
              d10, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
          tessellator.addVertexWithUV(
              d6, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
          tessellator.addVertexWithUV(
              d6, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
          tessellator.addVertexWithUV(
              d10, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        } else {
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d12, d2, d1);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d8, d2, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d8, d0, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d12, d0, d1);
          d0 = (double) iicon1.getMinU();
          d1 = (double) iicon1.getMinV();
          d2 = (double) iicon1.getMaxU();
          d3 = (double) iicon1.getMaxV();
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
          tessellator.addVertexWithUV(
              (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        }
      }
      if (!sides) {
        double d4 = (double) p_147801_2_ + 0.5D + 0.2D;
        d5 = (double) p_147801_2_ + 0.5D - 0.2D;
        d6 = (double) p_147801_4_ + 0.5D + 0.2D;
        d7 = (double) p_147801_4_ + 0.5D - 0.2D;
        d8 = (double) p_147801_2_ + 0.5D - 0.3D;
        d9 = (double) p_147801_2_ + 0.5D + 0.3D;
        d10 = (double) p_147801_4_ + 0.5D - 0.3D;
        d11 = (double) p_147801_4_ + 0.5D + 0.3D;
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
        d0 = (double) iicon1.getMinU();
        d1 = (double) iicon1.getMinV();
        d2 = (double) iicon1.getMaxU();
        d3 = (double) iicon1.getMaxV();
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
        d4 = (double) p_147801_2_ + 0.5D - 0.5D;
        d5 = (double) p_147801_2_ + 0.5D + 0.5D;
        d6 = (double) p_147801_4_ + 0.5D - 0.5D;
        d7 = (double) p_147801_4_ + 0.5D + 0.5D;
        d8 = (double) p_147801_2_ + 0.5D - 0.4D;
        d9 = (double) p_147801_2_ + 0.5D + 0.4D;
        d10 = (double) p_147801_4_ + 0.5D - 0.4D;
        d11 = (double) p_147801_4_ + 0.5D + 0.4D;
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
        tessellator.addVertexWithUV(
            d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
        tessellator.addVertexWithUV(
            d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
        tessellator.addVertexWithUV(
            d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
        tessellator.addVertexWithUV(
            d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
        d0 = (double) iicon.getMinU();
        d1 = (double) iicon.getMinV();
        d2 = (double) iicon.getMaxU();
        d3 = (double) iicon.getMaxV();
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
        tessellator.addVertexWithUV(
            (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
      }
    } else {
      double d4 = (double) p_147801_2_ + 0.5D + 0.2D;
      d5 = (double) p_147801_2_ + 0.5D - 0.2D;
      d6 = (double) p_147801_4_ + 0.5D + 0.2D;
      d7 = (double) p_147801_4_ + 0.5D - 0.2D;
      d8 = (double) p_147801_2_ + 0.5D - 0.3D;
      d9 = (double) p_147801_2_ + 0.5D + 0.3D;
      d10 = (double) p_147801_4_ + 0.5D - 0.3D;
      d11 = (double) p_147801_4_ + 0.5D + 0.3D;
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
      d0 = (double) iicon1.getMinU();
      d1 = (double) iicon1.getMinV();
      d2 = (double) iicon1.getMaxU();
      d3 = (double) iicon1.getMaxV();
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
      d4 = (double) p_147801_2_ + 0.5D - 0.5D;
      d5 = (double) p_147801_2_ + 0.5D + 0.5D;
      d6 = (double) p_147801_4_ + 0.5D - 0.5D;
      d7 = (double) p_147801_4_ + 0.5D + 0.5D;
      d8 = (double) p_147801_2_ + 0.5D - 0.4D;
      d9 = (double) p_147801_2_ + 0.5D + 0.4D;
      d10 = (double) p_147801_4_ + 0.5D - 0.4D;
      d11 = (double) p_147801_4_ + 0.5D + 0.4D;
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d0, d1);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d0, d3);
      tessellator.addVertexWithUV(
          d4, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d2, d3);
      tessellator.addVertexWithUV(
          d8, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d2, d1);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 1), d0, d1);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 1), d0, d3);
      tessellator.addVertexWithUV(
          d5, (double) (p_147801_3_ + 0), (double) (p_147801_4_ + 0), d2, d3);
      tessellator.addVertexWithUV(
          d9, (double) ((float) p_147801_3_ + f), (double) (p_147801_4_ + 0), d2, d1);
      d0 = (double) iicon.getMinU();
      d1 = (double) iicon.getMinV();
      d2 = (double) iicon.getMaxU();
      d3 = (double) iicon.getMaxV();
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d11, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d7, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d7, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d11, d2, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) ((float) p_147801_3_ + f), d10, d0, d1);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 1), (double) (p_147801_3_ + 0), d6, d0, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) (p_147801_3_ + 0), d6, d2, d3);
      tessellator.addVertexWithUV(
          (double) (p_147801_2_ + 0), (double) ((float) p_147801_3_ + f), d10, d2, d1);
    }

    return true;
  }
コード例 #21
0
  private void renderHeavyNoseCone(
      ItemRenderType type,
      RenderBlocks render,
      ItemStack item,
      float translateX,
      float translateY,
      float translateZ) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);

    for (int i = 0; i < 2; i++) {
      GL11.glPushMatrix();

      if (i == 1) {
        SpaceRace race =
            SpaceRaceManager.getSpaceRaceFromPlayer(
                FMLClientHandler.instance().getClientPlayerEntity().getGameProfile().getName());
        Vector3 color = null;

        if (race != null) {
          color = race.getTeamColor();
        }

        if (color == null) {
          color = new Vector3(1, 1, 1);
        }

        GL11.glColor4f(color.floatX(), color.floatY(), color.floatZ(), 1.0F);
      }

      IIcon iicon = FMLClientHandler.instance().getClientPlayerEntity().getItemIcon(item, i);

      if (iicon == null) {
        GL11.glPopMatrix();
        return;
      }

      FMLClientHandler.instance()
          .getClient()
          .getTextureManager()
          .bindTexture(
              FMLClientHandler.instance()
                  .getClient()
                  .getTextureManager()
                  .getResourceLocation(item.getItemSpriteNumber()));
      VersionUtil.setMipMap(false, false);
      Tessellator tessellator = Tessellator.instance;
      float f = iicon.getMinU();
      float f1 = iicon.getMaxU();
      float f2 = iicon.getMinV();
      float f3 = iicon.getMaxV();
      float f4 = 0.0F;
      float f5 = 1.0F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glScalef(1.0F, -1.0F, 1.0F);
      float f6 = 16.0F;
      GL11.glScalef(f6, f6, f6);
      GL11.glTranslatef(-f4, -f5, 0.0F);
      ItemRenderer.renderItemIn2D(
          tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
      GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
  }
コード例 #22
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_fence) {
      renderer.setRenderBounds(.375, 0, .375, .625, 1, .625);
      renderer.renderStandardBlock(block, x, y, z);
      BlockMetalDecoration md = (BlockMetalDecoration) block;

      if (md.canConnectFenceTo(world, x + 1, y, z)) {
        renderer.setRenderBounds(.625, .375, .4375, 1, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.625, .75, .4375, 1, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x - 1, y, z)) {
        renderer.setRenderBounds(0, .375, .4375, .375, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(0, .75, .4375, .375, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z + 1)) {
        renderer.setRenderBounds(.4375, .375, .625, .5625, .5625, 1);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, .625, .5625, .9375, 1);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z - 1)) {
        renderer.setRenderBounds(.4375, .375, 0, .5625, .5625, .375);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, 0, .5625, .9375, .375);
        renderer.renderStandardBlock(block, x, y, z);
      }
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_scaffolding) {
      renderer.setRenderBoundsFromBlock(block);
      float f = .015625f;
      float f1 = 0;
      renderer.renderFromInside = true;
      renderer.renderMinX += block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY += block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ += block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX -= block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY -= block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ -= block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderStandardBlock(block, x, y, z);
      renderer.renderMinX -= block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY -= block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ -= block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX += block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY += block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ += block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderFromInside = false;
      return renderer.renderStandardBlock(block, x, y, z);
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_lantern)
    //		{
    //			if(world.isAirBlock(x,y-1,z)&&!world.isAirBlock(x,y+1,z))
    //			{
    //				renderer.uvRotateWest = 3;
    //				renderer.uvRotateEast = 3;
    //				renderer.uvRotateNorth = 3;
    //				renderer.uvRotateSouth = 3;
    //				renderer.setRenderBounds(.3125f,.875f,.3125f, .6875f,1,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.1875f,.25f, .75f,.875f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.uvRotateWest = 0;
    //				renderer.uvRotateEast = 0;
    //				renderer.uvRotateNorth = 0;
    //				renderer.uvRotateSouth = 0;
    //			}
    //			else
    //			{
    //				renderer.setRenderBounds(.3125f,0,.3125f, .6875f,.125f,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.125f,.25f, .75f,.8125f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //			}
    //			return true;
    //		}
    {
      TileEntityLantern tile = (TileEntityLantern) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_structuralArm) {
      Tessellator tes = ClientUtils.tes();
      IIcon iSide = block.getIcon(2, 3);
      IIcon iTop = block.getIcon(0, 3);

      int f =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).facing
              : 0;
      boolean inv =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).inverted
              : false;
      ForgeDirection fd = ForgeDirection.getOrientation(f);
      int rowTop = 0;
      while (rowTop < 8) {
        if (world.getTileEntity(x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .inverted
                == inv) rowTop++;
        else break;
      }
      int rowBot = 0;
      while (rowBot < 8) {
        if (world.getTileEntity(x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .inverted
                == inv) rowBot++;
        else break;
      }
      double rowTotal = rowTop + rowBot + 1;
      double yTop = 1 - rowTop / rowTotal;
      double yBot = rowBot / rowTotal;

      double d3 = iTop.getInterpolatedU(0);
      double d4 = iTop.getInterpolatedU(16);
      double d5 = iTop.getInterpolatedV(0);
      double d6 = iTop.getInterpolatedV(16);
      double d7 = d4;
      double d8 = d3;
      double d9 = d5;
      double d10 = d6;

      double y11 = f == 5 || f == 3 ? yBot : yTop;
      double y10 = f == 5 || f == 2 ? yBot : yTop;
      double y00 = f == 4 || f == 2 ? yBot : yTop;
      double y01 = f == 4 || f == 3 ? yBot : yTop;

      // SIDE 0
      ClientUtils.BlockLightingInfo info =
          ClientUtils.calculateBlockLighting(0, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0), z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0), z + 0, d3, d5);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0), z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0), z + 1, d4, d6);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0) + .0001, z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0) + .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0) + .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0) + .0001, z + 0, d7, d9);

      // SIDE 1
      info = ClientUtils.calculateBlockLighting(1, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11), z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10), z + 0, d7, d9);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00), z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01), z + 1, d8, d10);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10) - .0001, z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11) - .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01) - .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00) - .0001, z + 0, d3, d5);

      // SIDE 2
      info = ClientUtils.calculateBlockLighting(2, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0 + .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0 + .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 3
      info = ClientUtils.calculateBlockLighting(3, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1 - .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1 - .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 4
      info = ClientUtils.calculateBlockLighting(4, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      // SIDE 5
      info = ClientUtils.calculateBlockLighting(5, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));

      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_connectorStructural) {
      TileEntityConnectorStructural tile =
          (TileEntityConnectorStructural) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_wallMount) {
      TileEntityWallmountMetal tile = (TileEntityWallmountMetal) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else {
      renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
      return renderer.renderStandardBlock(block, x, y, z);
    }
  }
コード例 #23
0
  protected void renderSoup(
      EntityFoodBase entity,
      byte meta,
      FoodType.Soup soup,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    Tessellator tessellator = Tessellator.instance;
    IIcon iicon = entity.getSoupIcon(meta);
    if (iicon == null) return;

    float f14 = iicon.getMinU();
    float f15 = iicon.getMaxU();
    float f4 = iicon.getMinV();
    float f5 = iicon.getMaxV();

    double x;
    double y;
    double z;

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if (soup == FoodType.Soup.Drink) {
      GL11.glColor4f(2.0F, 2.0F, 2.0F, 0.9F);
    } else {
      GL11.glColor4f(2.0F, 2.0F, 2.0F, 1.0F);
    }
    GL11.glTranslatef((float) par2, (float) par4 + 0.5F, (float) par6);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glRotatef(par8, 0.0F, 1.0F, 0.0F);

    this.bindTexture(TextureMap.locationItemsTexture);

    if (soup != FoodType.Soup.Rice && soup != FoodType.Soup.Rice) {
      if (soup == FoodType.Soup.Soup) {
        x = 0.2D;
        y = 0.45D;
        z = 0.2D;
      } else if (soup == FoodType.Soup.WoodSoup) {
        x = 0.25D;
        y = 0.43D;
        z = 0.25D;
      } else if (soup == FoodType.Soup.Drink) {
        x = 0.15D;
        y = 0.3D;
        z = 0.15D;
      } else {
        x = 0.25D;
        y = 0.5D;
        z = 0.25D;
      }

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-x, y, -z, f14, f5);
      tessellator.addVertexWithUV(x, y, -z, f15, f5);
      tessellator.addVertexWithUV(x, y, z, f15, f4);
      tessellator.addVertexWithUV(-x, y, z, f14, f4);
      tessellator.draw();
    } else if (soup == FoodType.Soup.WoodRice) {

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f14, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f15, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.25D, 0.5D, -0.25D, f14, f5);
      tessellator.addVertexWithUV(0.25D, 0.5D, -0.25D, f15, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(0.25D, 0.5D, 0.25D, f14, f5);
      tessellator.addVertexWithUV(-0.25D, 0.5D, 0.25D, f15, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.25D, 0.5D, -0.25D, f14, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f15, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.25D, 0.5D, 0.25D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f14, f5);
      tessellator.addVertexWithUV(0.25D, 0.5D, -0.25D, f15, f5);
      tessellator.addVertexWithUV(0.25D, 0.5D, 0.25D, f15, f4);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();
    } else if (soup == FoodType.Soup.Rice) {
      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f14, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f15, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.2D, 0.45D, -0.2D, f14, f5);
      tessellator.addVertexWithUV(0.2D, 0.45D, -0.2D, f15, f5);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(0.2D, 0.45D, 0.2D, f14, f5);
      tessellator.addVertexWithUV(-0.2D, 0.45D, 0.2D, f15, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(-0.2D, 0.45D, -0.2D, f14, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, -0.1D, f15, f5);
      tessellator.addVertexWithUV(-0.1D, 0.3D, 0.1D, f15, f4);
      tessellator.addVertexWithUV(-0.2D, 0.45D, 0.2D, f14, f4);
      tessellator.draw();

      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      tessellator.addVertexWithUV(0.1D, 0.3D, -0.1D, f14, f5);
      tessellator.addVertexWithUV(0.2D, 0.45D, -0.2D, f15, f5);
      tessellator.addVertexWithUV(0.2D, 0.45D, 0.2D, f15, f4);
      tessellator.addVertexWithUV(0.1D, 0.3D, 0.1D, f14, f4);
      tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
  }
コード例 #24
0
  @Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) {
    int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata();
    int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90;

    TileRepairer repairer = (TileRepairer) tileentity;

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    bindTexture(modelTex);
    GL11.glTranslatef(0F, 2F, 1F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    model.render();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glScalef(1F, -1F, -1F);

    ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0);
    if (item != null) {
      GL11.glPushMatrix();
      final float scale = 0.5F;
      GL11.glScalef(scale, scale, scale);
      GL11.glTranslatef(-0.5F, (float) (-2.5F + Math.sin(repairer.ticksExisted / 10F) * 0.1F), 0F);

      float deg = repairer.ticksExisted * 0.75F % 360F;
      GL11.glTranslatef(1F / 2F, 1F / 2F, 1F / 32F);
      GL11.glRotatef(deg, 0F, 1F, 0F);
      GL11.glTranslatef(-1F / 2F, -1F / 2F, -1F / 32F);

      bindTexture(TextureMap.locationItemsTexture);

      int renderPass = 0;
      do {
        IIcon icon = item.getItem().getIcon(item, renderPass);
        if (icon != null) {
          Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
          GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
          float f = icon.getMinU();
          float f1 = icon.getMaxU();
          float f2 = icon.getMinV();
          float f3 = icon.getMaxV();
          ItemRenderer.renderItemIn2D(
              Tessellator.instance,
              f1,
              f2,
              f,
              f3,
              icon.getIconWidth(),
              icon.getIconHeight(),
              1F / 16F);
          GL11.glColor3f(1F, 1F, 1F);
        }
        renderPass++;
      } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
      GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    bindTexture(modelTex);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    model.renderGlass();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glScalef(1F, -1F, -1F);

    renderOverlay(
        (TileRepairer) tileentity,
        ((TileRepairer) tileentity).tookLastTick ? repair : repairOff,
        1.25F);
    GL11.glPopMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
  }
コード例 #25
0
  protected void drawGuiContainerBackgroundLayer(
      float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(hollowBG);
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

    this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture);

    for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
      Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i1);
      if (slot.getHasStack() && slot.getStack().getItem() instanceof IArmorInsect) {
        IArmorInsect armor = (IArmorInsect) slot.getStack().getItem();

        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        IIcon icon = ItemBioModArmor.getBackgroundIcon(armor.getType());

        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition,
            this.guiTop + slot.yDisplayPosition + 16,
            zLevel,
            icon.getMinU(),
            icon.getMaxV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition + 16,
            this.guiTop + slot.yDisplayPosition + 16,
            zLevel,
            icon.getMaxU(),
            icon.getMaxV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition + 16,
            this.guiTop + slot.yDisplayPosition,
            zLevel,
            icon.getMaxU(),
            icon.getMinV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition,
            this.guiTop + slot.yDisplayPosition,
            zLevel,
            icon.getMinU(),
            icon.getMinV());
        tessellator.draw();

        GL11.glPopMatrix();
      } else if (slot.getHasStack()
          && (slot.getStack().getItem() instanceof ItemBank
              || slot.getStack().getItem() instanceof ItemEater)) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        IIcon icon = ItemBioModArmor.getBackgroundIcon(SocketType.EATER);

        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition,
            this.guiTop + slot.yDisplayPosition + 16,
            zLevel,
            icon.getMinU(),
            icon.getMaxV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition + 16,
            this.guiTop + slot.yDisplayPosition + 16,
            zLevel,
            icon.getMaxU(),
            icon.getMaxV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition + 16,
            this.guiTop + slot.yDisplayPosition,
            zLevel,
            icon.getMaxU(),
            icon.getMinV());
        tessellator.addVertexWithUV(
            this.guiLeft + slot.xDisplayPosition,
            this.guiTop + slot.yDisplayPosition,
            zLevel,
            icon.getMinU(),
            icon.getMinV());
        tessellator.draw();

        GL11.glPopMatrix();
      }
    }
  }
コード例 #26
0
  private boolean renderBlockWoodLadder(
      IBlockAccess blockAccess,
      int x,
      int y,
      int z,
      BlockWoodLadder block,
      int modelID,
      RenderBlocks renderer) {
    int color = block.colorMultiplier(blockAccess, x, y, z);
    float r = (float) (color >> 16 & 255) / 255.0F;
    float g = (float) (color >> 8 & 255) / 255.0F;
    float b = (float) (color & 255) / 255.0F;
    if (EntityRenderer.anaglyphEnable) {
      float f3 = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F;
      float f4 = (r * 30.0F + g * 70.0F) / 100.0F;
      float f5 = (r * 30.0F + b * 70.0F) / 100.0F;
      r = f3;
      g = f4;
      b = f5;
    }
    TileEntityMetadata tile = (TileEntityMetadata) blockAccess.getTileEntity(x, y, z);
    int meta = tile.getTileMetadata();
    int direction = meta & 7;

    Tessellator tessellator = Tessellator.instance;
    IIcon icon = renderer.getBlockIconFromSideAndMetadata(block, 0, meta);
    if (renderer.hasOverrideBlockTexture()) {
      icon = renderer.overrideBlockTexture;
    }
    tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
    tessellator.setColorOpaque_F(r, g, b);
    double minU = (double) icon.getMinU();
    double minV = (double) icon.getMinV();
    double maxU = (double) icon.getMaxU();
    double maxV = (double) icon.getMaxV();
    double d4 = 0.0D;
    double d5 = 0.05000000074505806D;

    if (direction == 5) {
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 1) + d4, (double) (z + 1) + d4, minU, minV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 0) - d4, (double) (z + 1) + d4, minU, maxV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 0) - d4, (double) (z + 0) - d4, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 1) + d4, (double) (z + 0) - d4, maxU, minV);
    }
    if (direction == 4) {
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 0) - d4, (double) (z + 1) + d4, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 1) + d4, (double) (z + 1) + d4, maxU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 1) + d4, (double) (z + 0) - d4, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 0) - d4, (double) (z + 0) - d4, minU, maxV);
    }
    if (direction == 3) {
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 0) - d4, (double) z + d5, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 1) + d4, (double) z + d5, maxU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 1) + d4, (double) z + d5, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 0) - d4, (double) z + d5, minU, maxV);
    }
    if (direction == 2) {
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 1) + d4, (double) (z + 1) - d5, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 0) - d4, (double) (z + 1) - d5, minU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 0) - d4, (double) (z + 1) - d5, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 1) + d4, (double) (z + 1) - d5, maxU, minV);
    }
    return true;
  }
コード例 #27
0
  private void renderItem(TileEntity tile, double par2, double par4, double par6) {
    TileEntityFillingStation fs = (TileEntityFillingStation) tile;
    if (!fs.isInWorld()) return;
    ItemStack is = fs.getItemForRender();
    if (is == null) return;

    double in = 0.125;
    double xoff = 0;
    double zoff = 0;

    float var11 = 0;
    switch (tile.getBlockMetadata()) {
      case 0:
        var11 = 180;
        break;
      case 1:
        var11 = 0;
        xoff = 1;
        zoff = -1;
        break;
      case 2:
        var11 = 270;
        in = -in;
        break;
      case 3:
        var11 = 90;
        xoff = 1;
        zoff = 1;
        in = -in;
        break;
    }

    GL11.glTranslated(par2, par4, par6);

    GL11.glRotatef(var11 - 90, 0.0F, 1.0F, 0.0F);

    GL11.glTranslated(xoff, 0, zoff);

    Tessellator v5 = Tessellator.instance;
    v5.startDrawingQuads();

    Item item = is.getItem();
    IItemRenderer iir = MinecraftForgeClient.getItemRenderer(is, ItemRenderType.INVENTORY);
    if (item instanceof IndexedItemSprites && !(item instanceof ItemBlockPlacer)) {
      IndexedItemSprites iis = (IndexedItemSprites) item;
      ReikaTextureHelper.bindTexture(iis.getTextureReferenceClass(), iis.getTexture(is));
      int index = iis.getItemSpriteIndex(is);
      int row = index / 16;
      int col = index % 16;

      float u = col / 16F;
      float v = row / 16F;

      float du = u + 0.0625F;
      float dv = v + 0.0625F;

      v5.addVertexWithUV(0, 0, in, u, dv);
      v5.addVertexWithUV(-1, 0, in, du, dv);
      v5.addVertexWithUV(-1, 1, in, du, v);
      v5.addVertexWithUV(0, 1, in, u, v);
    } else if (iir != null) {; // iir.renderItem(ItemRenderType.INVENTORY, is, new RenderBlocks());
    } else {
      if (ReikaItemHelper.isBlock(is)) ReikaTextureHelper.bindTerrainTexture();
      else ReikaTextureHelper.bindItemTexture();
      IIcon ico = item.getIcon(is, MinecraftForgeClient.getRenderPass());
      float u = ico.getMinU();
      float v = ico.getMinV();
      float du = ico.getMaxU();
      float dv = ico.getMaxV();

      v5.addVertexWithUV(0, 0, in, u, dv);
      v5.addVertexWithUV(-1, 0, in, du, dv);
      v5.addVertexWithUV(-1, 1, in, du, v);
      v5.addVertexWithUV(0, 1, in, u, v);
    }

    v5.draw();

    GL11.glTranslated(-xoff, 0, -zoff);

    GL11.glRotatef(-var11 + 90, 0.0F, 1.0F, 0.0F);

    GL11.glTranslated(-par2, -par4, -par6);
  }
コード例 #28
0
  protected void doRenderItem(
      ItemRenderType type, ItemStack item, Item iconItem, FluidStack fluid) {

    IIcon icon = iconItem.getIcon(item, 0);
    IIcon mask = iconItem.getIcon(item, 1);
    boolean hasFluid = fluid != null;

    IIcon fluidIcon = hasFluid ? fluid.getFluid().getIcon(fluid) : mask;
    int fluidSheet = hasFluid ? fluid.getFluid().getSpriteNumber() : 0;
    int colorMult = hasFluid ? fluid.getFluid().getColor(fluid) : 0xFFFFFF;
    boolean isFloaty = hasFluid ? fluid.getFluid().getDensity(fluid) < 0 : false;

    if (fluid == null) {
      fluidIcon = Blocks.flowing_lava.getIcon(2, 0);
      fluidSheet = 0;
      colorMult = 0x3F3F3F;
    }
    GL11.glPushMatrix();

    Tessellator tessellator = Tessellator.instance;

    float iconMinX = icon.getMinU();
    float iconMaxX = icon.getMaxU();
    float iconMinY = icon.getMinV();
    float iconMaxY = icon.getMaxV();

    float maskMinX = mask.getMinU();
    float maskMaxX = mask.getMaxU();
    float maskMinY = mask.getMinV();
    float maskMaxY = mask.getMaxV();

    float fluidMinX = fluidIcon.getMinU();
    float fluidMaxX = fluidIcon.getMaxU();
    float fluidMinY = fluidIcon.getMinV();
    float fluidMaxY = fluidIcon.getMaxV();

    if (isFloaty && canFlip) {
      iconMaxY = icon.getMinV();
      iconMinY = icon.getMaxV();

      maskMaxY = mask.getMinV();
      maskMinY = mask.getMaxV();

      fluidMaxY = fluidIcon.getMinV();
      fluidMinY = fluidIcon.getMaxV();
    }
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(
        GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    int texture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

    if (type == ItemRenderType.INVENTORY) {
      GL11.glDisable(GL11.GL_LIGHTING);

      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV(0, 16, 0, iconMinX, iconMaxY);
      tessellator.addVertexWithUV(16, 16, 0, iconMaxX, iconMaxY);
      tessellator.addVertexWithUV(16, 0, 0, iconMaxX, iconMinY);
      tessellator.addVertexWithUV(0, 0, 0, iconMinX, iconMinY);
      tessellator.draw();

      if (hasFluid) {
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0, 16, 0.001, maskMinX, maskMaxY);
        tessellator.addVertexWithUV(16, 16, 0.001, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(16, 0, 0.001, maskMaxX, maskMinY);
        tessellator.addVertexWithUV(0, 0, 0.001, maskMinX, maskMinY);
        tessellator.draw();

        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDepthMask(false);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        bindTexture(RenderHelper.engine(), fluidSheet);
        OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO);

        tessellator.startDrawingQuads();
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 16, 0.001, fluidMinX, fluidMaxY);
        tessellator.addVertexWithUV(16, 16, 0.001, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(16, 0, 0.001, fluidMaxX, fluidMinY);
        tessellator.addVertexWithUV(0, 0, 0.001, fluidMinX, fluidMinY);
        tessellator.draw();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDepthMask(true);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glEnable(GL11.GL_LIGHTING);
    } else {
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);

      if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0.5f, 4 / -16f, 0);
        GL11.glRotatef(180, 0, 1, 0);
      }
      ItemRenderer.renderItemIn2D(
          tessellator,
          iconMaxX,
          iconMinY,
          iconMinX,
          iconMaxY,
          icon.getIconWidth(),
          icon.getIconHeight(),
          0.0625F);

      if (hasFluid) {
        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, 1);
        tessellator.addVertexWithUV(0, 0, 0.001, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(1, 0, 0.001, maskMinX, maskMaxY);
        tessellator.addVertexWithUV(1, 1, 0.001, maskMinX, maskMinY);
        tessellator.addVertexWithUV(0, 1, 0.001, maskMaxX, maskMinY);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, -1);
        tessellator.addVertexWithUV(0, 1, -0.0635, maskMinX, maskMinY);
        tessellator.addVertexWithUV(1, 1, -0.0635, maskMaxX, maskMinY);
        tessellator.addVertexWithUV(1, 0, -0.0635, maskMaxX, maskMaxY);
        tessellator.addVertexWithUV(0, 0, -0.0635, maskMinX, maskMaxY);
        tessellator.draw();

        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDepthMask(false);
        bindTexture(RenderHelper.engine(), fluidSheet);
        OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO);

        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, 1);
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 0, 0.001, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(1, 0, 0.001, fluidMinX, fluidMaxY);
        tessellator.addVertexWithUV(1, 1, 0.001, fluidMinX, fluidMinY);
        tessellator.addVertexWithUV(0, 1, 0.001, fluidMaxX, fluidMinY);
        tessellator.draw();

        tessellator.startDrawingQuads();
        tessellator.setNormal(0, 0, -1);
        tessellator.setColorOpaque_I(colorMult);
        tessellator.addVertexWithUV(0, 1, -0.0635, fluidMinX, fluidMinY);
        tessellator.addVertexWithUV(1, 1, -0.0635, fluidMaxX, fluidMinY);
        tessellator.addVertexWithUV(1, 0, -0.0635, fluidMaxX, fluidMaxY);
        tessellator.addVertexWithUV(0, 0, -0.0635, fluidMinX, fluidMaxY);
        tessellator.draw();

        GL11.glDepthMask(true);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    OpenGlHelper.glBlendFunc(
        GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glPopMatrix();
  }
コード例 #29
0
  public void renderItemStack(ItemStack stack) {
    if (stack != null) {
      Minecraft mc = Minecraft.getMinecraft();
      mc.renderEngine.bindTexture(
          stack.getItem() instanceof ItemBlock
              ? TextureMap.locationBlocksTexture
              : TextureMap.locationItemsTexture);

      float s = 0.25F;
      GL11.glScalef(s, s, s);
      GL11.glScalef(2F, 2F, 2F);
      if (!ForgeHooksClient.renderEntityItem(
          new EntityItem(
              brewery.getWorldObj(), brewery.xCoord, brewery.yCoord, brewery.zCoord, stack),
          stack,
          0F,
          0F,
          brewery.getWorldObj().rand,
          mc.renderEngine,
          RenderBlocks.getInstance(),
          1)) {
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        if (stack.getItem() instanceof ItemBlock
            && RenderBlocks.renderItemIn3d(
                Block.getBlockFromItem(stack.getItem()).getRenderType())) {
          GL11.glScalef(0.5F, 0.5F, 0.5F);
          GL11.glTranslatef(1F, 1.1F, 0F);
          GL11.glPushMatrix();
          RenderBlocks.getInstance()
              .renderBlockAsItem(
                  Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F);
          GL11.glPopMatrix();
          GL11.glTranslatef(-1F, -1.1F, 0F);
          GL11.glScalef(2F, 2F, 2F);
        } else {
          int renderPass = 0;
          do {
            IIcon icon = stack.getItem().getIcon(stack, renderPass);
            if (icon != null) {
              Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
              GL11.glColor3ub(
                  (byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
              float f = icon.getMinU();
              float f1 = icon.getMaxU();
              float f2 = icon.getMinV();
              float f3 = icon.getMaxV();

              ItemRenderer.renderItemIn2D(
                  Tessellator.instance,
                  f1,
                  f2,
                  f,
                  f3,
                  icon.getIconWidth(),
                  icon.getIconHeight(),
                  1F / 16F);
              GL11.glColor3f(1F, 1F, 1F);
            }
            renderPass++;
          } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
        }
      }
      GL11.glScalef(1F / s, 1F / s, 1F / s);

      Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    }
  }
コード例 #30
0
  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    GL11.glPushMatrix();
    try {

      if (metadata == BlockMetalDecoration.META_fence) {
        GL11.glTranslatef(-.5f, -.5f, -.5f);
        renderer.setRenderBounds(0, 0, .375, .25, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(.75, 0, .375, 1, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .8125, .4375, 1.125, .9375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .3125, .4375, 1.125, .4375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        GL11.glTranslatef(.5f, .5f, .5f);
      } else if (metadata == BlockMetalDecoration.META_scaffolding) {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      } else if (metadata == BlockMetalDecoration.META_lantern) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityLantern());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_structuralArm) {
        Tessellator tes = ClientUtils.tes();
        IIcon iSide = block.getIcon(2, 3);
        IIcon iTop = block.getIcon(0, 3);

        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        tes.startDrawing(6);
        tes.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0, 0, 0, iTop);
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 1.0F, 0.0F);
        tes.setBrightness(0xff);
        tes.addVertexWithUV(1, 1, 1, iTop.getMaxU(), iTop.getMaxV());
        tes.addVertexWithUV(1, 1, 0, iTop.getMaxU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 0, iTop.getMinU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 1, iTop.getMinU(), iTop.getMaxV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, -1.0F);
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(1, 1, 0, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 0, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, 1.0F);
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(-1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(1, 1, 0, iSide.getMinU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();
      } else if (metadata == BlockMetalDecoration.META_connectorStructural) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityConnectorStructural());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_wallMount) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityWallmountMetal());
        Tessellator.instance.draw();
      } else {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    GL11.glPopMatrix();
  }