Пример #1
0
 protected void ApplyColor() {
   if (stat.canBeUnlocked(player, level) || player.isUnlocked(stat, level)) {
     if (level <= 0) {
       RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO, 0.5f);
     } else {
       RenderUtils.applyColor(Reference.COLOR_HOLO);
     }
   } else {
     RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO_RED, 0.5f);
   }
 }
Пример #2
0
  protected void renderBeam(
      Vec3 from,
      Vec3 to,
      Vec3 offest,
      Color color,
      ResourceLocation texture,
      float tickness,
      T viewer) {
    if (texture != null) Minecraft.getMinecraft().renderEngine.bindTexture(texture);

    RenderUtils.applyColor(color);
    glDisable(GL_CULL_FACE);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);
    glDisable(GL_LIGHTING);
    double distance = from.subtract(to).lengthVector();
    double v = -viewer.worldObj.getWorldTime() * 0.2;

    glPushMatrix();
    glTranslated(from.xCoord, from.yCoord, from.zCoord);
    glRotated(-viewer.getRotationYawHead(), 0, 1, 0);
    glRotated(viewer.rotationPitch, 1, 0, 0);
    glTranslated(offest.xCoord, offest.yCoord, offest.zCoord);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.addVertexWithUV(tickness, 0, 0, 0, v);
    t.addVertexWithUV(tickness, 0, distance, 0, v + distance * 1.5);
    t.addVertexWithUV(-tickness, 0, distance, 1, v + distance * 1.5);
    t.addVertexWithUV(-tickness, 0, 0, 1, v);

    t.addVertexWithUV(0, tickness, 0, 0, v);
    t.addVertexWithUV(0, tickness, distance, 0, v + distance * 1.5);
    t.addVertexWithUV(0, -tickness, distance, 1, v + distance * 1.5);
    t.addVertexWithUV(0, -tickness, 0, 1, v);
    t.draw();
    glPopMatrix();

    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  }