Ejemplo n.º 1
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);
  }
Ejemplo n.º 2
0
 protected boolean renderRaycastedBeam(Vec3 direction, Vec3 offset, T caster) {
   return renderRaycastedBeam(caster.getPosition(1), direction, offset, caster);
 }