@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();
  }
예제 #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);
      }
    }
  }