private void renderGlow(
      TileEntityChromaLamp te, double par2, double par4, double par6, float par8) {
    ElementTagCompound tag = te.getColors();
    Tessellator v5 = Tessellator.instance;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    BlendMode.ADDITIVEDARK.apply();
    ReikaTextureHelper.bindTexture(ChromatiCraft.class, "Textures/clouds/bubble.png");
    int tick = te.getTicksExisted();
    double s = 0.3875;
    double h = 0.875;

    for (CrystalElement e : tag.elementSet()) {
      GL11.glPushMatrix();
      double ang = Math.toRadians(map[e.ordinal()]);
      double ang2 = e.ordinal() * 22.5;
      double vu = Math.cos(ang);
      double vv = Math.sin(ang);
      int alpha = Math.max(0, (int) (255 * Math.sin(Math.toRadians(ang2 + tick + par8))));
      double u = (vu * (tick) % 32) / 32D;
      double v = (vv * (tick) % 32) / 32D;
      double du = 1 + u;
      double dv = 1 + v;
      int color = ReikaColorAPI.mixColors(e.getColor(), 0, alpha / 255F);
      v5.startDrawingQuads();
      v5.setColorOpaque_I(color);
      v5.setBrightness(240);
      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, 0, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, u, v);

      v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, du, v);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, u, v);
      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, u, dv);
      v5.addVertexWithUV(0.5 + s, h, 0.5 + s, du, dv);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 + s, du, v);
      v5.addVertexWithUV(0.5 + s, 0, 0.5 - s, u, v);

      v5.addVertexWithUV(0.5 - s, 0, 0.5 - s, du, v);
      v5.addVertexWithUV(0.5 - s, 0, 0.5 + s, u, v);
      v5.addVertexWithUV(0.5 - s, h, 0.5 + s, u, dv);
      v5.addVertexWithUV(0.5 - s, h, 0.5 - s, du, dv);
      v5.draw();
      GL11.glPopMatrix();
    }
    BlendMode.DEFAULT.apply();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
  }
예제 #2
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);
  }
  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();
  }
  @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();
  }