コード例 #1
0
  public void renderTileEntityAt(
      TileEntityEnchantmentTable p_147500_1_,
      double p_147500_2_,
      double p_147500_4_,
      double p_147500_6_,
      float p_147500_8_) {
    GL11.glPushMatrix();
    GL11.glTranslatef(
        (float) p_147500_2_ + 0.5F, (float) p_147500_4_ + 0.75F, (float) p_147500_6_ + 0.5F);
    float f1 = (float) p_147500_1_.field_145926_a + p_147500_8_;
    GL11.glTranslatef(0.0F, 0.1F + MathHelper.sin(f1 * 0.1F) * 0.01F, 0.0F);
    float f2;

    for (f2 = p_147500_1_.field_145928_o - p_147500_1_.field_145925_p;
        f2 >= (float) Math.PI;
        f2 -= ((float) Math.PI * 2F)) {;
    }

    while (f2 < -(float) Math.PI) {
      f2 += ((float) Math.PI * 2F);
    }

    float f3 = p_147500_1_.field_145925_p + f2 * p_147500_8_;
    GL11.glRotatef(-f3 * 180.0F / (float) Math.PI, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F);
    this.bindTexture(field_147540_b);
    float f4 =
        p_147500_1_.field_145931_j
            + (p_147500_1_.field_145933_i - p_147500_1_.field_145931_j) * p_147500_8_
            + 0.25F;
    float f5 =
        p_147500_1_.field_145931_j
            + (p_147500_1_.field_145933_i - p_147500_1_.field_145931_j) * p_147500_8_
            + 0.75F;
    f4 = (f4 - (float) MathHelper.truncateDoubleToInt((double) f4)) * 1.6F - 0.3F;
    f5 = (f5 - (float) MathHelper.truncateDoubleToInt((double) f5)) * 1.6F - 0.3F;

    if (f4 < 0.0F) {
      f4 = 0.0F;
    }

    if (f5 < 0.0F) {
      f5 = 0.0F;
    }

    if (f4 > 1.0F) {
      f4 = 1.0F;
    }

    if (f5 > 1.0F) {
      f5 = 1.0F;
    }

    float f6 =
        p_147500_1_.field_145927_n
            + (p_147500_1_.field_145930_m - p_147500_1_.field_145927_n) * p_147500_8_;
    GL11.glEnable(GL11.GL_CULL_FACE);
    this.field_147541_c.render((Entity) null, f1, f4, f5, f6, 0.0F, 0.0625F);
    GL11.glPopMatrix();
  }
コード例 #2
0
  /** Args : renderPartialTicks, mouseX, mouseY */
  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    OpenGLHelper.colour(1, 1, 1);
    mc.getTextureManager().bindTexture(field_147078_C);
    int k = (width - xSize) / 2;
    int l = (height - ySize) / 2;
    drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
    OpenGLHelper.pushMatrix();
    OpenGLHelper.matrixMode(5889);
    OpenGLHelper.pushMatrix();
    OpenGLHelper.loadIdentity();
    ScaledResolution var6 = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    OpenGLHelper.viewport(
        (var6.getScaledWidth() - 320) / 2 * var6.getScaleFactor(),
        (var6.getScaledHeight() - 240) / 2 * var6.getScaleFactor(),
        320 * var6.getScaleFactor(),
        240 * var6.getScaleFactor());
    OpenGLHelper.translate(-0.34F, 0.23F, 0.0F);
    Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F);
    float var7 = 1.0F;
    OpenGLHelper.matrixMode(5888);
    OpenGLHelper.loadIdentity();
    RenderHelper.enableStandardItemLighting();
    OpenGLHelper.translate(0.0F, 3.3F, -16.0F);
    OpenGLHelper.scale(var7, var7, var7);
    float var8 = 5.0F;
    OpenGLHelper.scale(var8, var8, var8);
    OpenGLHelper.rotate(180.0F, 0.0F, 0.0F, 1.0F);
    mc.getTextureManager().bindTexture(field_147070_D);
    OpenGLHelper.rotate(20.0F, 1.0F, 0.0F, 0.0F);
    float var9 = field_147076_A + (field_147080_z - field_147076_A) * partialTicks;
    OpenGLHelper.translate((1.0F - var9) * 0.2F, (1.0F - var9) * 0.1F, (1.0F - var9) * 0.25F);
    OpenGLHelper.rotate(-(1.0F - var9) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F);
    OpenGLHelper.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    float var10 = field_147069_w + (field_147071_v - field_147069_w) * partialTicks + 0.25F;
    float var11 = field_147069_w + (field_147071_v - field_147069_w) * partialTicks + 0.75F;
    var10 = (var10 - MathHelper.truncateDoubleToInt(var10)) * 1.6F - 0.3F;
    var11 = (var11 - MathHelper.truncateDoubleToInt(var11)) * 1.6F - 0.3F;

    if (var10 < 0.0F) var10 = 0.0F;

    if (var11 < 0.0F) var11 = 0.0F;

    if (var10 > 1.0F) var10 = 1.0F;

    if (var11 > 1.0F) var11 = 1.0F;

    OpenGLHelper.enableRescaleNormal();
    field_147072_E.render((Entity) null, 0.0F, var10, var11, var9, 0.0F, 0.0625F);
    OpenGLHelper.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
    OpenGLHelper.matrixMode(5889);
    OpenGLHelper.viewport(0, 0, mc.displayWidth, mc.displayHeight);
    OpenGLHelper.popMatrix();
    OpenGLHelper.matrixMode(5888);
    OpenGLHelper.popMatrix();
    RenderHelper.disableStandardItemLighting();
    OpenGLHelper.colour(1.0F, 1.0F, 1.0F);
    EnchantmentNameParts.instance.reseedRandomGenerator(field_147075_G.enchantmentSeed);
    int var12 = field_147075_G.func_178147_e();

    for (int i1 = 0; i1 < 3; i1++) {
      int var14 = k + 60;
      int var15 = var14 + 20;
      byte var16 = 86;
      String s = EnchantmentNameParts.instance.generateNewRandomName();
      zLevel = 0.0F;
      mc.getTextureManager().bindTexture(field_147078_C);
      int j1 = field_147075_G.enchantLevels[i1];
      OpenGLHelper.colour(1.0F, 1.0F, 1.0F);

      if (j1 == 0) drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
      else {
        String s1 = "" + j1;
        FontRenderer fontrenderer = mc.standardGalacticFontRenderer;
        int k1 = 6839882;

        if ((var12 < i1 + 1 || mc.thePlayer.experienceLevel < j1)
            && !mc.thePlayer.capabilities.isCreativeMode) {
          drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 185, 108, 19);
          drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 239, 16, 16);
          fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, (k1 & 16711422) >> 1);
          k1 = 4226832;
        } else {
          int l1 = mouseX - (k + 60);
          int i2 = mouseY - (l + 14 + 19 * i1);

          if (l1 >= 0 && i2 >= 0 && l1 < 108 && i2 < 19) {
            drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 204, 108, 19);
            k1 = 16777088;
          } else drawTexturedModalRect(var14, l + 14 + 19 * i1, 0, 166, 108, 19);

          drawTexturedModalRect(var14 + 1, l + 15 + 19 * i1, 16 * i1, 223, 16, 16);
          fontrenderer.drawSplitString(s, var15, l + 16 + 19 * i1, var16, k1);
          k1 = 8453920;
        }

        fontrenderer = mc.fontRenderer;
        fontrenderer.drawStringWithShadow(
            s1, var15 + 86 - fontrenderer.getStringWidth(s1), l + 16 + 19 * i1 + 7, k1);
        OpenGLHelper.colour(1, 1, 1);
      }
    }
  }