Beispiel #1
0
  public void draw() {
    float x = 0, y = 0, z = 0, X = (float) -Math.PI, Y = 0.0f, Z = 0.0f;
    Vector3f first = new Vector3f();
    Vector3f second = new Vector3f();
    Vector3f thrird = new Vector3f();

    glPushMatrix();
    {
      glTranslatef(translate.getX(), translate.getY(), translate.getZ());
      glRotatef(angleOfRotation, rotate.getX(), rotate.getY(), rotate.getZ());
      glScalef(scale.getX(), scale.getY(), scale.getZ());
      glColor3f(color.getX(), color.getY(), color.getY());
      glDisable(GL_CULL_FACE);
      glLineWidth(10);

      glBegin(GL_LINE_STRIP);
      {
        while (X < 2 * Math.PI) {
          while (Y < 2 * Math.PI) {
            x = size * (float) Math.cos(X) * (float) Math.cos(Y);
            y = size * (float) Math.cos(X) * (float) Math.sin(Y);
            z = size * (float) Math.sin(X);
            glVertex3f(x, y, z);

            first.setX(x);
            first.setY(y);
            first.setZ(z);

            x = size * (float) Math.cos(X) * (float) Math.cos(Y);
            y = size * (float) Math.cos(X) * (float) Math.sin(Y);
            z = size * (float) Math.sin(X);
            glVertex3f(x, y, z);

            second.setX(x);
            second.setY(y);
            second.setZ(z);

            x = size * (float) Math.cos(X) * (float) Math.cos(Y);
            y = size * (float) Math.cos(X) * (float) Math.sin(Y);
            z = size * (float) Math.sin(X);
            glVertex3f(x, y, z);
            Y += 0.1;

            thrird.setX(x);
            thrird.setY(y);
            thrird.setZ(z);

            first = thrird.crossProduct(first, second, thrird);
            glNormal3f(first.getX(), first.getY(), first.getZ());
          }
          Y = 0;
          X += 0.1;
        }
      }
      glEnd();
      glEnable(GL_CULL_FACE);
      glLineWidth(1);
    }
    glPopMatrix();
  }
Beispiel #2
0
  @Override
  protected void doDisplay(I3dCamera camera) {
    float x0 = -size.x / 2;
    float y0 = -size.y / 2;
    float x1 = size.x / 2;
    float y1 = size.y / 2;

    GL11.glLineWidth(thickness);

    if (renderMode == RenderMode.SOLID) {
      GL11.glEnable(GL11.GL_LINE_STIPPLE);
      GL11.glLineStipple(stippleFactor, stipplePattern);

      GL11.glBegin(GL11.GL_LINE_LOOP);

      GL11.glVertex3d(x0, y1, 0);
      GL11.glVertex3d(x0, y0, 0);
      GL11.glVertex3d(x1, y0, 0);
      GL11.glVertex3d(x1, y1, 0);

      GL11.glEnd();

      GL11.glDisable(GL11.GL_LINE_STIPPLE);
    } else {
      GL11.glBegin(GL11.GL_QUADS);

      GL11.glVertex3d(x0, y1, 0);
      GL11.glVertex3d(x0, y0, 0);
      GL11.glVertex3d(x1, y0, 0);
      GL11.glVertex3d(x1, y1, 0);

      GL11.glEnd();
    }
  }
  public static void drawFace(
      double x,
      double y,
      double z,
      double x2,
      double y2,
      double z2,
      float red,
      float green,
      float blue,
      float lineWidth) {

    Tessellator var12 = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glLineWidth(lineWidth);
    GL11.glDisable(3553);
    var12.startDrawing(3);

    var12.setColorRGBA_F(red, green, blue, 1);
    var12.addVertex(x, y, z);
    var12.addVertex(x2, y, z2);
    var12.addVertex(x2, y2, z2);
    var12.addVertex(x, y2, z2);

    // var12.addVertex(x2, y2, z2);
    var12.draw();
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(32826);
    GL11.glEnable(3553);
    GL11.glPopMatrix();
  }
  public static void drawLine(
      double x,
      double y,
      double x2,
      double y2,
      float red,
      float green,
      float blue,
      float lineWidth,
      float fadeSpeed) {
    int count = FMLClientHandler.instance().getClient().thePlayer.ticksExisted;
    float alpha = fadeSpeed + MathHelper.sin((float) (count + x)) * 0.3F + 0.3F;

    Tessellator var12 = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glLineWidth(lineWidth);
    GL11.glDisable(3553);
    GL11.glEnable(3042);
    var12.startDrawing(3);

    var12.setColorRGBA_F(red, green, blue, alpha);
    var12.addVertex(x, y, 0.0D);
    var12.addVertex(x2, y2, 0.0D);

    var12.draw();
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(32826);
    GL11.glDisable(3042);
    GL11.glEnable(3553);
    GL11.glPopMatrix();
  }
Beispiel #5
0
 private void drawLinesAsLines(int numPts, float[] pts, float width, boolean drawAsLoop) {
   GL11.glLineWidth(width);
   GL11.glBegin(drawAsLoop ? GL11.GL_LINE_LOOP : GL11.GL_LINE_STRIP);
   for (int i = 0; i < numPts; i++) {
     GL11.glVertex2f(pts[i * 2 + 0], pts[i * 2 + 1]);
   }
   GL11.glEnd();
 }
Beispiel #6
0
 public static void draw(FloatRect rect, float width) {
   glLineWidth(width);
   glBegin(GL_LINE_LOOP);
   glVertex2f(rect.x, rect.y);
   glVertex2f(rect.x + rect.w, rect.y);
   glVertex2f(rect.x + rect.w, rect.y + rect.h);
   glVertex2f(rect.x, rect.y + rect.h);
   glEnd();
 }
Beispiel #7
0
  private void doRenderLoop() {
    try {
      while (!isDisplayable()) {
        Thread.sleep(50);
      }
      Display.setParent(this);
      Display.setVSyncEnabled(true);
      Display.create();
      mMouseState = new boolean[Mouse.getButtonCount()];
      for (int i = 0; i < mMouseState.length; i++) {
        mMouseState[i] = Mouse.isButtonDown(i);
      }

      // GL11.glsetSwapInterval(1);
      GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
      // gl11.glColor3f(1.0f, 0.0f, 0.0f);
      GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
      GL11.glClearDepth(1.0);
      GL11.glLineWidth(2);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      if (mScene.getAmbientLight() != null) {
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glLightModel(
            GL11.GL_LIGHT_MODEL_AMBIENT, Color4fLogic.toFloatBuffer(mScene.getAmbientLight()));
      }
      if (mScene.getColorMaterialFace() != JGLColorMaterialFace.UNSET) {
        initMaterial();
      }
      if (mScene.getFogMode() != JGLFogMode.UNSET) {
        initFog();
      }

      Dimension newDim;

      while (!Display.isCloseRequested() && !mCloseRequested) {
        newDim = mNewCanvasSize.getAndSet(null);
        if (newDim != null) {
          GL11.glViewport(0, 0, newDim.width, newDim.height);
          syncViewportSize();
        }
        doRender();
        doMouse();
        doKeys();
        doEye();
        Display.update();
      }

      Display.destroy();
    } catch (InterruptedException | LWJGLException e) {
      e.printStackTrace();
    }
  }
Beispiel #8
0
  public void renderLocally(float lineThickness) {
    if (_displayListWire == -1) {
      generateDisplayListWire();
    }

    glPushMatrix();
    glTranslated(0f, getPosition().y, 0f);

    glLineWidth(lineThickness);
    glCallList(_displayListWire);

    glPopMatrix();
  }
Beispiel #9
0
  public static void draw(FloatRect rect, Color3f color, float width) {
    color.drawWith();

    glLineWidth(width);
    glBegin(GL_LINE_LOOP);
    glVertex2f(rect.x, rect.y);
    glVertex2f(rect.x + rect.w, rect.y);
    glVertex2f(rect.x + rect.w, rect.y + rect.h);
    glVertex2f(rect.x, rect.y + rect.h);
    glEnd();

    color.drawWithout();
  }
  private void drawInterfaceLines(EntityPlayerSP player, float partialTicks) {
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldRenderer = tessellator.getWorldRenderer();

    double playerX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double playerY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;

    GlStateManager.pushAttrib();
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glLineWidth(10);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    Minecraft.getMinecraft().entityRenderer.disableLightmap();
    GlStateManager.pushMatrix();
    {
      worldRenderer.startDrawing(GL11.GL_LINES);
      worldRenderer.setColorOpaque(255, 0, 0);
      synchronized (TileEntityRedstoneInterface.interfaces) {
        for (TileEntityRedstoneInterface redstoneInterface :
            TileEntityRedstoneInterface.interfaces) {
          if (!redstoneInterface.isInvalid()) {
            BlockPos position = redstoneInterface.getPos();
            BlockPos target = redstoneInterface.getTarget();

            if (position.distanceSq(player.getPosition()) < 225) {
              if (target != null) {
                if (redstoneInterface.getWorld().isRemote) {
                  worldRenderer.addVertex(
                      target.getX() + 0.5 - playerX,
                      target.getY() + 0.5 - playerY,
                      target.getZ() + 0.5 - playerZ);
                  worldRenderer.addVertex(
                      position.getX() + 0.5 - playerX,
                      position.getY() + 0.5 - playerY,
                      position.getZ() + 0.5 - playerZ);
                }
              }
            }
          }
        }
      }
      tessellator.draw();
    }
    GlStateManager.popMatrix();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GlStateManager.enableTexture2D();
    GlStateManager.popAttrib();
    Minecraft.getMinecraft().entityRenderer.enableLightmap();
  }
Beispiel #11
0
  public void renderLocally(float lineThickness) {
    CoreRegistry.get(ShaderManager.class).enableDefault();

    if (displayListWire == -1) {
      generateDisplayListWire();
    }

    glPushMatrix();
    glTranslated(0f, aabb.getCenter().y, 0f);

    glLineWidth(lineThickness);
    glCallList(displayListWire);

    glPopMatrix();
  }
 private void drawScanLine(double angle) {
   float xtarg = random.nextFloat();
   float ytarg = random.nextFloat();
   GL11.glLineWidth(2);
   GL11.glBegin(GL11.GL_LINES);
   GL11.glColor4d(0.0, 1.0, 0.2, 1.0);
   GL11.glVertex3d(0.5, 1.05 + 0.02f * Math.sin(angle * 3), 0.5);
   GL11.glVertex3d(xtarg, 1.2f, ytarg);
   GL11.glEnd();
   // MuseRenderer.drawGradientRect3D(
   // Vec3.createVectorHelper(Math.floor(xtarg * 16.0) / 16.0, 1.201,
   // Math.floor(ytarg * 16.0) / 16.0),
   // Vec3.createVectorHelper(1.0 / 16.0, 0, 1.0 / 16.0),
   // new Colour(0.0f, 1.0f, 0.0f, 0.4f),
   // new Colour(0.0f, 1.0f, 0.0f, 0.4f));
 }
  @SubscribeEvent
  @SideOnly(Side.CLIENT)
  public void renderCeramicsSelection(DrawBlockHighlightEvent event) {
    if (event.target.subHit == -1) {
      return;
    }
    Coord c = Coord.fromMop(event.player.worldObj, event.target);
    TileEntityGreenware clay = c.getTE(TileEntityGreenware.class);
    if (clay == null) {
      return;
    }
    if (event.target.subHit < 0 || event.target.subHit >= clay.parts.size()) {
      return;
    }
    event.setCanceled(true);
    EntityPlayer player = event.player;
    double partial = event.partialTicks;
    ClayLump lump = clay.parts.get(event.target.subHit);
    Block block = new Block(Material.rock);
    lump.toRotatedBlockBounds(clay, block);
    double widen = 0.002;
    double oX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partial;
    double oY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partial;
    double oZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partial;
    AxisAlignedBB bb =
        block
            .getSelectedBoundingBox(c.w, c.toBlockPos())
            .expand(widen, widen, widen)
            .offset(-oX, -oY, -oZ);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    float r = 0xFF;
    GL11.glLineWidth(2.0F);
    GL11.glColor4f(0, 0, 0, 0.4F);
    // GL11.glColor4f(0x4D/r, 0x34/r, 0x7C/r, 0.8F); //#4D347C
    RenderGlobal.drawSelectionBoundingBox(bb);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);

    // TODO: If the rotation tool is selected, may draw the axis?
    // Oooooh, we could also draw the offset position for *EVERY* tool...
  }
  /** 画出视点跟视角 */
  public void drawFrustum() {

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glBegin(GL11.GL_LINES);

    // Draw the View Vector starting at the eye (red)
    GL11.glColor3f(1, 0, 0);
    GL11.glVertex3f(viewPosition[0], viewPosition[1], viewPosition[2]);
    GL11.glVertex3f(
        (float) (viewPosition[0] + 50.0f * Math.sin(gClipAngle * Math.PI / 180.0f)),
        viewPosition[1],
        (float) (viewPosition[2] - 50.0f * Math.cos(gClipAngle * Math.PI / 180.0f)));
    // Draw the view frustum (blue)
    GL11.glColor3f(0, 0, 1);
    GL11.glVertex3f(viewPosition[0], viewPosition[1], viewPosition[2]);
    GL11.glVertex3f(
        (float) (viewPosition[0] + 1000.0f * Math.sin((gClipAngle - 45.0f) * Math.PI / 180.0f)),
        viewPosition[1],
        (float) (viewPosition[2] - 1000.0f * Math.cos((gClipAngle - 45.0f) * Math.PI / 180.0f)));
    GL11.glVertex3f(viewPosition[0], viewPosition[1], viewPosition[2]);
    GL11.glVertex3f(
        (float) (viewPosition[0] + 1000.0f * Math.sin((gClipAngle + 45.0f) * Math.PI / 180.0f)),
        viewPosition[1],
        (float) (viewPosition[2] - 1000.0f * Math.cos((gClipAngle + 45.0f) * Math.PI / 180.0f)));
    // Draw the clipping planes behind the eye (yellow)
    int ptEyeX = (int) (viewPosition[0] - patchSize * Math.sin(gClipAngle * PI_DIV_180));
    int ptEyeY = (int) (viewPosition[2] + patchSize * Math.cos(gClipAngle * PI_DIV_180));

    int ptLeftX = (int) (ptEyeX + 100.0f * Math.sin((gClipAngle - FOV_DIV_2) * PI_DIV_180));
    int ptLeftY = (int) (ptEyeY - 100.0f * Math.cos((gClipAngle - FOV_DIV_2) * PI_DIV_180));

    int ptRightX = (int) (ptEyeX + 100.0f * Math.sin((gClipAngle + FOV_DIV_2) * PI_DIV_180));
    int ptRightY = (int) (ptEyeY - 100.0f * Math.cos((gClipAngle + FOV_DIV_2) * PI_DIV_180));

    GL11.glColor3f(1, 1, 0);
    GL11.glVertex3f((float) ptEyeX, viewPosition[1], (float) ptEyeY);
    GL11.glVertex3f((float) ptLeftX, viewPosition[1], (float) ptLeftY);
    GL11.glVertex3f((float) ptEyeX, viewPosition[1], (float) ptEyeY);
    GL11.glVertex3f((float) ptRightX, viewPosition[1], (float) ptRightY);
    GL11.glEnd();
    GL11.glLineWidth(1.f);
    GL11.glColor3f(1, 1, 1);
  }
Beispiel #15
0
  public void drawLine(int x, int y, int x2, int y2, int width, float... rgba) {

    Tessellator tess = Tessellator.instance;
    GL11.glPushMatrix();
    // GL11.glLineWidth(3);
    GL11.glLineWidth(width);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tess.startDrawing(3);

    if (rgba.length == 4) tess.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]);
    // tess.setColorRGBA_F(1,1,1,1);

    tess.addVertex(x, y, 0);
    tess.addVertex(x2, y2, 0);

    tess.draw();
    GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopMatrix();
  }
  public void renderMesh(Mesh mesh, int lod, int count) {
    if (mesh.getVertexCount() == 0) {
      return;
    }

    if (context.pointSize != mesh.getPointSize()) {
      glPointSize(mesh.getPointSize());
      context.pointSize = mesh.getPointSize();
    }
    if (context.lineWidth != mesh.getLineWidth()) {
      glLineWidth(mesh.getLineWidth());
      context.lineWidth = mesh.getLineWidth();
    }

    boolean dynamic = false;
    if (mesh.getBuffer(Type.InterleavedData) != null) {
      throw new UnsupportedOperationException("Interleaved meshes are not supported");
    }

    if (mesh.getNumLodLevels() == 0) {
      for (VertexBuffer vb : mesh.getBufferList().getArray()) {
        if (vb.getUsage() != VertexBuffer.Usage.Static) {
          dynamic = true;
          break;
        }
      }
    } else {
      dynamic = true;
    }

    statistics.onMeshDrawn(mesh, lod);

    //        if (!dynamic) {
    // dealing with a static object, generate display list
    //            renderMeshDisplayList(mesh);
    //        } else {
    renderMeshDefault(mesh, lod, count);
    //        }

  }
Beispiel #17
0
  public static void renderEntityBounds(Entity entity, float partialTick) {
    Minecraft mc = Minecraft.getMinecraft();

    if (!mc.gameSettings.hideGUI) {
      // Render bounding box around entity if it is being looked at.
      MovingObjectPosition lookingAt = mc.objectMouseOver;

      if (lookingAt != null
          && lookingAt.typeOfHit == MovingObjectType.ENTITY
          && lookingAt.entityHit == entity) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.color(0, 0, 0, 0.4F);
        GL11.glLineWidth(2);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);
        float expand = entity.getCollisionBorderSize() + 0.002F;

        double offX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTick;
        double offY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTick;
        double offZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTick;
        RenderGlobal.drawOutlinedBoundingBox(
            entity
                .getEntityBoundingBox()
                .expand(expand, expand, expand)
                .offset(-offX, -offY, -offZ),
            -1);

        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();

        GL11.glPopAttrib();
      }
    }
  }
 @Override
 public void renderTileEntityAt(
     TileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
   EntityPlayer player = Minecraft.getMinecraft().thePlayer;
   if (player.getHeldItem(EnumHand.MAIN_HAND) == null
       || !(player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemLightDebugTool)
       || te instanceof TileEntityUVLightBlock) {
     return;
   }
   try {
     GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
     GL11.glPushMatrix();
     GL11.glColor3f(1F, 1F, 0.0F);
     GL11.glLineWidth(2.0F);
     GL11.glDisable(GL11.GL_TEXTURE_2D);
     GL11.glTranslatef((float) x, (float) y, (float) z);
     AxisAlignedBB boundingBox = new AxisAlignedBB(0.002D, 0.002D, 0.002D, 0.998D, 0.998D, 0.998D);
     drawCube(boundingBox);
   } finally {
     GL11.glPopMatrix();
     GL11.glPopAttrib();
   }
 }
Beispiel #19
0
  private void displayDebugInfo(long l) {
    long l1 = 0xfe502aL;
    if (prevFrameTime == -1L) {
      prevFrameTime = System.nanoTime();
    }
    long l2 = System.nanoTime();
    tickTimes[numRecordedFrameTimes & frameTimes.length - 1] = l;
    frameTimes[numRecordedFrameTimes++ & frameTimes.length - 1] = l2 - prevFrameTime;
    prevFrameTime = l2;
    GL11.glClear(256);
    GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, displayWidth, displayHeight, 0.0D, 1000D, 3000D);
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000F);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawing(7);
    int i = (int) (l1 / 0x30d40L);
    tessellator.setColorOpaque_I(0x20000000);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.setColorOpaque_I(0x20200000);
    tessellator.addVertex(0.0D, displayHeight - i * 2, 0.0D);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i * 2, 0.0D);
    tessellator.draw();
    long l3 = 0L;
    for (int j = 0; j < frameTimes.length; j++) {
      l3 += frameTimes[j];
    }

    int k = (int) (l3 / 0x30d40L / (long) frameTimes.length);
    tessellator.startDrawing(7);
    tessellator.setColorOpaque_I(0x20400000);
    tessellator.addVertex(0.0D, displayHeight - k, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - k, 0.0D);
    tessellator.draw();
    tessellator.startDrawing(1);
    for (int i1 = 0; i1 < frameTimes.length; i1++) {
      int j1 = ((i1 - numRecordedFrameTimes & frameTimes.length - 1) * 255) / frameTimes.length;
      int k1 = (j1 * j1) / 255;
      k1 = (k1 * k1) / 255;
      int i2 = (k1 * k1) / 255;
      i2 = (i2 * i2) / 255;
      if (frameTimes[i1] > l1) {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000);
      } else {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 256);
      }
      long l4 = frameTimes[i1] / 0x30d40L;
      long l5 = tickTimes[i1] / 0x30d40L;
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex((float) i1 + 0.5F, (float) displayHeight + 0.5F, 0.0D);
      tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000 + k1 * 256 + k1 * 1);
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex(
          (float) i1 + 0.5F, (float) ((long) displayHeight - (l4 - l5)) + 0.5F, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  }
Beispiel #20
0
  public static void drawLine(
      double x,
      double y,
      double x2,
      double y2,
      float r,
      float g,
      float b,
      float te,
      boolean wiggle) {
    float count =
        FMLClientHandler.instance().getClient().thePlayer.ticksExisted
            + new Random().nextFloat()
            + te;

    Tessellator var12 = Tessellator.instance;

    GL11.glPushMatrix();
    GL11.glAlphaFunc(516, 0.003921569F);
    GL11.glDisable(3553);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);

    double d3 = x - x2;
    double d4 = y - y2;
    float dist = MathHelper.sqrt_double(d3 * d3 + d4 * d4);
    int inc = (int) (dist / 2.0F);
    float dx = (float) (d3 / inc);
    float dy = (float) (d4 / inc);
    if (Math.abs(d3) > Math.abs(d4)) {
      dx *= 2.0F;
    } else {
      dy *= 2.0F;
    }
    GL11.glLineWidth(3.0F);
    GL11.glEnable(2848);
    GL11.glHint(3154, 4354);

    var12.startDrawing(3);
    for (int a = 0; a <= inc; a++) {
      float r2 = r;
      float g2 = g;
      float b2 = b;
      float mx = 0.0F;
      float my = 0.0F;
      float op = 0.6F;
      if (wiggle) {
        float phase = a / inc;
        mx = MathHelper.sin((count + a) / 7.0F) * 5.0F * (1.0F - phase);
        my = MathHelper.sin((count + a) / 5.0F) * 5.0F * (1.0F - phase);
        r2 *= (1.0F - phase);
        g2 *= (1.0F - phase);
        b2 *= (1.0F - phase);
        op *= phase;
      }
      var12.setColorRGBA_F(r2, g2, b2, op);

      var12.addVertex(x - dx * a + mx, y - dy * a + my, 0.0D);
      if (Math.abs(d3) > Math.abs(d4)) {
        dx *= (1.0F - 1.0F / (inc * 3.0F / 2.0F));
      } else {
        dy *= (1.0F - 1.0F / (inc * 3.0F / 2.0F));
      }
    }
    var12.draw();

    GL11.glBlendFunc(770, 771);
    GL11.glDisable(2848);
    GL11.glDisable(3042);
    GL11.glDisable(32826);
    GL11.glEnable(3553);
    GL11.glAlphaFunc(516, 0.1F);
    GL11.glPopMatrix();
  }
Beispiel #21
0
 public void glLineWidth(float width) {
   GL11.glLineWidth(width);
 }
Beispiel #22
0
  @Override
  protected void renderComponent(Slider component) {
    translateComponent(component, false);

    // GL settings
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);

    // area & font
    Rectangle area = component.getArea();
    int fontSize = theme.getFontRenderer().FONT_HEIGHT;
    FontRenderer fontRenderer = theme.getFontRenderer();

    // text
    fontRenderer.drawString(
        component.getText(), 0, 0, RenderUtil.toRGBA(component.getForegroundColor()));

    // value
    String content = null;
    switch (component.getValueDisplay()) {
      case DECIMAL:
        content =
            Double.toString(
                (double)
                        (Math.round(component.getValue() / component.getIncrement())
                            * 1000000
                            * (long) (component.getIncrement() * 1000000))
                    / 1000000
                    / 1000000);
        break;
      case INTEGER:
        content = String.format("%,d", Long.valueOf(Math.round(component.getValue())));
        break;
      case PERCENTAGE:
        int percent =
            (int)
                Math.round(
                    (component.getValue() - component.getMinimumValue())
                        / (component.getMaximumValue() - component.getMinimumValue())
                        * 100D);
        content = String.format("%d%%", percent);
      default:
    }
    if (content != null) {
      String suffix = component.getContentSuffix();
      if (suffix != null && !suffix.trim().isEmpty()) content = content.concat(" ").concat(suffix);
      fontRenderer.drawString(
          content,
          component.getWidth() - fontRenderer.getStringWidth(content),
          0,
          RenderUtil.toRGBA(component.getForegroundColor()));
    }
    glDisable(GL_TEXTURE_2D);

    // line
    glColor4f(0.03125f, 0.03125f, 0.03125f, 0.25f);
    glBegin(GL_QUADS);
    {
      glVertex2d(1, fontSize + 4);
      glVertex2d(area.width - 1, fontSize + 4);
      glVertex2d(area.width - 1, area.height - 2);
      glVertex2d(1, area.height - 2);
    }
    glEnd();

    // line shadow
    glLineWidth(1.0f);
    glColor4f(0.125f, 0.125f, 0.125f, 0.5f);
    glBegin(GL_LINE_LOOP);
    {
      glVertex2d(1, fontSize + 4);
      glVertex2d(area.width - 1, fontSize + 4);
      glVertex2d(area.width - 1, area.height - 2);
      glVertex2d(1, area.height - 2);
    }
    glEnd();

    double sliderPercentage =
        (component.getValue() - component.getMinimumValue())
            / (component.getMaximumValue() - component.getMinimumValue());

    // slider
    glColor4f(0.0f + (float) sliderPercentage, 1.0f - (float) sliderPercentage, 0.0f, 0.5f);
    glBegin(GL_QUADS);
    {
      glVertex2d((area.width - 6) * sliderPercentage - 1, fontSize + 1);
      glVertex2d((area.width - 6) * sliderPercentage + 7, fontSize + 1);
      glVertex2d((area.width - 6) * sliderPercentage + 7, area.height + 1);
      glVertex2d((area.width - 6) * sliderPercentage - 1, area.height + 1);
    }
    glEnd();

    // slider shadow
    RenderUtil.boxShadow(
        (area.width - 6) * sliderPercentage - 1,
        fontSize + 1,
        (area.width - 6) * sliderPercentage + 7,
        area.height + 1);

    // GL resets
    glEnable(GL_CULL_FACE);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_BLEND);

    translateComponent(component, true);
  }
  public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    Composite comp = new Composite(shell, SWT.NONE);
    comp.setLayout(new FillLayout());
    GLData data = new GLData();
    data.doubleBuffer = true;
    final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data);

    canvas.setCurrent();
    try {
      GLContext.useContext(canvas);
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    canvas.addListener(
        SWT.Resize,
        new Listener() {
          public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            float fAspect = (float) bounds.width / (float) bounds.height;
            canvas.setCurrent();
            try {
              GLContext.useContext(canvas);
            } catch (LWJGLException e) {
              e.printStackTrace();
            }
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
          }
        });

    GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClearDepth(1.0);
    GL11.glLineWidth(2);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

    shell.setText("SWT/LWJGL Example");
    shell.setSize(640, 480);
    shell.open();

    display.asyncExec(
        new Runnable() {
          int rot = 0;

          public void run() {
            if (!canvas.isDisposed()) {
              canvas.setCurrent();
              try {
                GLContext.useContext(canvas);
              } catch (LWJGLException e) {
                e.printStackTrace();
              }
              GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
              GL11.glClearColor(.3f, .5f, .8f, 1.0f);
              GL11.glLoadIdentity();
              GL11.glTranslatef(0.0f, 0.0f, -10.0f);
              float frot = rot;
              GL11.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f);
              GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f);
              rot++;
              GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
              GL11.glColor3f(0.9f, 0.9f, 0.9f);
              drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15);
              canvas.swapBuffers();
              display.asyncExec(this);
            }
          }
        });

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
 @SubscribeEvent
 public void onDrawBlockHighlight(DrawBlockHighlightEvent event) {
   if (!event.getTarget().typeOfHit.equals(RayTraceResult.Type.BLOCK)) return;
   Minecraft mc = Minecraft.getMinecraft();
   if (ItemRecordWire.connection != null) {
     float dx =
         (float)
             (mc.thePlayer.prevPosX
                 + (mc.thePlayer.posX - mc.thePlayer.prevPosX) * event.getPartialTicks());
     float dy =
         (float)
             (mc.thePlayer.prevPosY
                 + (mc.thePlayer.posY - mc.thePlayer.prevPosY) * event.getPartialTicks());
     float dz =
         (float)
             (mc.thePlayer.prevPosZ
                 + (mc.thePlayer.posZ - mc.thePlayer.prevPosZ) * event.getPartialTicks());
     float x1 =
         -(float)
             (event.getTarget().getBlockPos().getX()
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.x1
                     : ItemRecordWire.connection.x2));
     float y1 =
         -(float)
             (event.getTarget().getBlockPos().getY()
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.y1
                     : ItemRecordWire.connection.y2));
     float z1 =
         -(float)
             (event.getTarget().getBlockPos().getZ()
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.z1
                     : ItemRecordWire.connection.z2));
     GL11.glEnable(GL11.GL_BLEND);
     GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
     GL11.glLineWidth(2F);
     GL11.glDisable(GL11.GL_TEXTURE_2D);
     GL11.glDepthMask(false);
     Block j =
         mc.theWorld
             .getBlockState(
                 new BlockPos(
                     event.getTarget().getBlockPos().getX(),
                     event.getTarget().getBlockPos().getY(),
                     event.getTarget().getBlockPos().getZ()))
             .getBlock();
     // TODO
     // j.setBlockBoundsBasedOnState(mc.theWorld, new
     // BlockPos(event.getTarget().getBlockPos().getX(), event.getTarget().getBlockPos().getY(),
     // event.getTarget().getBlockPos().getZ()));
     TileEntity t =
         mc.theWorld.getTileEntity(
             new BlockPos(
                 event.getTarget().getBlockPos().getX(),
                 event.getTarget().getBlockPos().getY(),
                 event.getTarget().getBlockPos().getZ()));
     // RenderGlobal.drawOutlinedBoundingBox(j.getSelectedBoundingBoxFromPool(mc.theWorld,
     // event.getTarget().blockX, event.getTarget().blockY,
     // event.getTarget().blockZ).expand(0.002D, 0.002D, 0.002D).getOffsetBoundingBox(-dx, -dy,
     // -dz), ((t instanceof IRecordWire ? (ItemRecordWire.connection.fromHome ? t instanceof
     // IRecordWireHome : !(t instanceof IRecordWireHome)) : false) || Math.sqrt(Math.pow(x1, 2) +
     // Math.pow(y1, 2) + Math.pow(z1, 2)) > 7) ? 0xFF0000 : (t instanceof IRecordWire ? 0x00FF00 :
     // 0xFFFF00));
     GL11.glDepthMask(true);
     GL11.glEnable(GL11.GL_TEXTURE_2D);
     GL11.glDisable(GL11.GL_BLEND);
     event.setCanceled(true);
   }
 }
 @SubscribeEvent
 public void onRenderEvent(RenderWorldLastEvent event) {
   Minecraft mc = Minecraft.getMinecraft();
   if (ItemRecordWire.connection != null) {
     if (mc.thePlayer.getHeldItemMainhand() == null
         || !(mc.thePlayer.getHeldItemMainhand().getItem() instanceof ItemRecordWire)) {
       ItemRecordWire.connection = null;
     } else {
       GL11.glPushMatrix();
       {
         GL11.glDisable(GL11.GL_TEXTURE_2D);
         float dx =
             (float)
                 (mc.thePlayer.prevPosX
                     + (mc.thePlayer.posX - mc.thePlayer.prevPosX) * event.getPartialTicks());
         float dy =
             (float)
                 (mc.thePlayer.prevPosY
                     + (mc.thePlayer.posY - mc.thePlayer.prevPosY) * event.getPartialTicks());
         float dz =
             (float)
                 (mc.thePlayer.prevPosZ
                     + (mc.thePlayer.posZ - mc.thePlayer.prevPosZ) * event.getPartialTicks());
         float x1 =
             -(dx
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.x1
                     : ItemRecordWire.connection.x2));
         float y1 =
             -(dy
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.y1
                     : ItemRecordWire.connection.y2));
         float z1 =
             -(dz
                 - (ItemRecordWire.connection.fromHome
                     ? ItemRecordWire.connection.z1
                     : ItemRecordWire.connection.z2));
         GL11.glTranslatef(x1 + .5F, y1 + .5F, z1 + .5F);
         GL11.glLineWidth(2F);
         GL11.glColor3f(0F, 0F, 0F);
         GL11.glBegin(GL11.GL_LINE_STRIP);
         {
           GL11.glVertex3f(0F, 0F, 0F);
           GL11.glVertex3f(0F, 3F, 0F);
         }
         GL11.glEnd();
         if (ConfigHandler.devMode && ItemRecordWire.connection.fromHome) {
           if (SoundHandler.soundPlaying.containsKey(
               ItemRecordWire.connection.x1
                   + ","
                   + ItemRecordWire.connection.y1
                   + ","
                   + ItemRecordWire.connection.z1
                   + ","
                   + mc.theWorld.provider.getDimension())) {
             float radius =
                 SoundHandler.soundPlaying
                     .get(
                         ItemRecordWire.connection.x1
                             + ","
                             + ItemRecordWire.connection.y1
                             + ","
                             + ItemRecordWire.connection.z1
                             + ","
                             + mc.theWorld.provider.getDimension())
                     .getCurrentSong()
                     .playRadius;
             GL11.glDisable(GL11.GL_CULL_FACE);
             GL11.glEnable(GL11.GL_BLEND);
             GL11.glColor4f(.1F, .1F, 1F, .2F);
             GL11.glBegin(GL11.GL_LINE_STRIP);
             {
               GL11.glVertex2f(0F, 0F);
               GL11.glVertex2f(0F, radius + 10F);
             }
             GL11.glEnd();
             double factor = Math.PI * 2 / 45;
             for (double phi = 0; phi <= Math.PI / 1.05; phi += factor) {
               GL11.glBegin(GL11.GL_QUAD_STRIP);
               {
                 for (double theta = 0; theta <= Math.PI * 2 + factor; theta += factor) {
                   double x = radius * Math.sin(phi) * Math.cos(theta);
                   double y = -radius * Math.cos(phi);
                   double z = radius * Math.sin(phi) * Math.sin(theta);
                   GL11.glVertex3d(x, y, z);
                   x = radius * Math.sin(phi + factor) * Math.cos(theta);
                   y = -radius * Math.cos(phi + factor);
                   z = radius * Math.sin(phi + factor) * Math.sin(theta);
                   GL11.glVertex3d(x, y, z);
                 }
               }
               GL11.glEnd();
             }
             float volumeRadius =
                 radius
                     * (Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.MASTER)
                         * Minecraft.getMinecraft()
                             .gameSettings
                             .getSoundLevel(SoundCategory.RECORDS));
             GL11.glColor4f(1F, .1F, .1F, .2F);
             for (double phi = 0; phi <= Math.PI / 1.05; phi += factor) {
               GL11.glBegin(GL11.GL_QUAD_STRIP);
               {
                 for (double theta = 0; theta <= Math.PI * 2 + factor; theta += factor) {
                   double x = volumeRadius * Math.sin(phi) * Math.cos(theta);
                   double y = -volumeRadius * Math.cos(phi);
                   double z = volumeRadius * Math.sin(phi) * Math.sin(theta);
                   GL11.glVertex3d(x, y, z);
                   x = volumeRadius * Math.sin(phi + factor) * Math.cos(theta);
                   y = -volumeRadius * Math.cos(phi + factor);
                   z = volumeRadius * Math.sin(phi + factor) * Math.sin(theta);
                   GL11.glVertex3d(x, y, z);
                 }
               }
               GL11.glEnd();
             }
             GL11.glDisable(GL11.GL_BLEND);
             GL11.glEnable(GL11.GL_CULL_FACE);
           }
         }
         GL11.glColor3f(1F, 1F, 1F);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
       }
       GL11.glPopMatrix();
     }
   }
 }
Beispiel #26
0
  public void renderHud() {
    glClear(GL_DEPTH_BUFFER_BIT);
    glTranslatef(-controller.getX(), -controller.getY(), -controller.getZ());
    glRotatef((float) (-controller.getRotX() * controller.mouseSpeed), 0.0f, 1.0f, 0.0f);
    glRotatef((float) (-controller.getRotY() * -controller.mouseSpeed), 1.0f, 0.0f, 0.0f);

    glColor3f(0f, 1.0f, 0f);
    glLineWidth(2f);

    glBegin(GL_LINES);
    glVertex3f(-1.5f, 0f, -50f);
    glVertex3f(-0.5f, 0f, -50f);

    glVertex3f(0.5f, 0f, -50f);
    glVertex3f(1.5f, 0f, -50f);

    glVertex3f(0f, -1.5f, -50f);
    glVertex3f(0f, -0.5f, -50f);

    glVertex3f(0f, 0.5f, -50f);
    glVertex3f(0f, 1.5f, -50f);
    glEnd();

    glColor3f(1f, 1f, 1f);

    Model currentWeapon = null;
    Texture weaponTexture = null;

    switch (controller.getSelectedWeapon()) {
      case 1:
        currentWeapon = knife;
        weaponTexture = knifeT;
        break;
      case 2:
        currentWeapon = gun;
        weaponTexture = gunT;
        break;
      case 3:
        currentWeapon = m4;
        weaponTexture = m4T;
        break;
    }

    weaponTexture.bind();

    for (Face face : currentWeapon.faces) {
      Vector3f v1 = currentWeapon.verticies.get((int) face.vertex.x - 1);
      Vector3f v2 = currentWeapon.verticies.get((int) face.vertex.y - 1);
      Vector3f v3 = currentWeapon.verticies.get((int) face.vertex.z - 1);

      Vector2f t1 = currentWeapon.textures.get((int) face.texture.x - 1);
      Vector2f t2 = currentWeapon.textures.get((int) face.texture.y - 1);
      Vector2f t3 = currentWeapon.textures.get((int) face.texture.z - 1);

      glBegin(GL_TRIANGLES);
      glTexCoord2f(t1.x, t1.y);
      glVertex3f(
          v1.x + controller.gunXOffset, v1.y + controller.gunYOffset, v1.z + controller.gunZOffset);
      glTexCoord2f(t2.x, t2.y);
      glVertex3f(
          v2.x + controller.gunXOffset, v2.y + controller.gunYOffset, v2.z + controller.gunZOffset);
      glTexCoord2f(t3.x, t3.y);
      glVertex3f(
          v3.x + controller.gunXOffset, v3.y + controller.gunYOffset, v3.z + controller.gunZOffset);
      glEnd();
    }

    text.drawString("health:123   armor:123", -300, -200);
  }
Beispiel #27
0
  /** Render the current frame */
  private static void render() {
    glMatrixMode(GL_PROJECTION);

    glLoadIdentity();

    gluPerspective(30f, aspect, 1f, 10000000f);

    float look = anchorL.z * 5;

    gluLookAt(look, look, anchorL.z, 0, 0, 0, 0, 0, 1);

    glClearColor(.5f, 0.5f, 0.5f, .5f);

    // clear the screen
    glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();
    {
      // int systemDimLength = cube.sideLength / 2;
      // rotate square according to angle
      glRotatef(angle, 0, 0, 1.0f);

      // glColor3f(1f, 1f, 1f);
      // cube.glSurfaceDraw();

      /*
       * Draw the particle in the system
       */
      glColor3f(0.0f, 1.0f, 0.0f);
      glPointSize(3.0f);
      /*
       * glBegin(GL_POINTS); { for (Particle p : system) {
       * glVertex3f(p.x.x, p.x.y, p.x.z); } } glEnd();
       */

      /*
       * Draw the lines
       */
      glLineWidth(2.0f);
      for (Constraint p : constraints) {
        glBegin(GL_LINES);
        {
          glVertex3f(p.getA().x.x, p.getA().x.y, p.getA().x.z);
          glVertex3f(p.getB().x.x, p.getB().x.y, p.getB().x.z);
        }
        glEnd();
      }

      /*
       * Shadows, just for effect!
       */
      glColor4f(0, 0, 0, .5f);
      /*
       * glBegin(GL_POINTS); { for (Particle p : system) {
       * glVertex3f(p.x.x, p.x.y, -systemDimLength); } } glEnd();
       */

      /*
       * Draw the line shadows
       */
      for (Constraint p : constraints) {
        glBegin(GL_LINES);
        {
          glVertex3f(p.getA().x.x, p.getA().x.y, -0);
          glVertex3f(p.getB().x.x, p.getB().x.y, -0);
        }
        glEnd();
      }

      glBegin(GL_LINES);
      {
        glVertex3f(anchorL.x, anchorL.y, -0);
        glVertex3f(anchorR.x, anchorR.y, -0);
      }
      glEnd();

      glColor3f(1, 0, 0);

      /*
       * Draw the tension line
       */
      glBegin(GL_LINES);
      {
        glVertex3f(anchorL.x, anchorL.y, -0);
        glVertex3f(anchorL.x, anchorL.y, anchorL.z);
        glVertex3f(anchorL.x, anchorL.y, anchorL.z);
        glVertex3f(anchorR.x, anchorR.y, anchorR.z);
        glVertex3f(anchorR.x, anchorR.y, anchorR.z);
        glVertex3f(anchorR.x, anchorR.y, -0);
      }
      glEnd();
    }
    glPopMatrix();
  }
Beispiel #28
0
  @SubscribeEvent
  public void eventRenderWorld(RenderWorldLastEvent e) {

    if (delay < 0 && Keyboard.isKeyDown(56) && Keyboard.isKeyDown(57) && Keyboard.isKeyDown(29)) {
      delay = 15;
      this.enabled = !this.enabled;
    }
    delay--;
    if (!this.enabled) return;
    i++;
    if (i > 1000) {
      i = 0;
      System.out.println("Saving Snitch List");
      Config.saveConfig();
    }
    PlayerInteractHandler.timer++;
    try { // Should put this is method yolo
      for (Coordinate c : SnitchField.instance.coordinateList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 10.55d, py - 10.55d, pz - 10.55d, px + 10.55d, py + 10.55d, pz + 10.55d);
        // odd choice because I just ripped this off squeenhowies esp
        int color = getColor(c.hoursToDate());
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F); // Blue
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F); // Purple
          }
        }

        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        px = -(RenderManager.renderPosX - c.x);
        py = -(RenderManager.renderPosY - c.y);
        pz = -(RenderManager.renderPosZ - c.z);
        bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F);
          }
        }
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

      for (Coordinate c : SnitchField.instance.tempList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        GL11.glColor4f(1F, 1F, 1F, 0.25F);
        drawCrossedOutlinedBoundingBox(bb);
        GL11.glColor4f(1F, 1F, 1F, 0.1F);
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

    } catch (ConcurrentModificationException f) {

    }
  }
Beispiel #29
0
 public void drawRadar() {
   tick++;
   if (tick >= 50) {
     tick = 0;
   }
   GL11.glLineWidth(2.0F);
   InstanceMain.getInstance()
       .getRender()
       .drawFilledCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 50, 0x55008881);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 50, 0x8800999C);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 38, 0x8800999C);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 25, 0x8800999C);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 13, 0x8800999C);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, tick, 0x33000000);
   InstanceMain.getInstance()
       .getRender()
       .dr(
           Minecraft.getMinecraft().displayWidth / 2 - 110,
           59.5,
           Minecraft.getMinecraft().displayWidth / 2 - 10,
           60.5,
           0x99000000);
   InstanceMain.getInstance()
       .getRender()
       .dr(
           Minecraft.getMinecraft().displayWidth / 2 - 59.5,
           10,
           Minecraft.getMinecraft().displayWidth / 2 - 60.5,
           110,
           0x99000000);
   InstanceMain.getInstance()
       .getRender()
       .drawCircle(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 1, 0xffffffff); // Player
   List<Entity> list1 = this.mc.theWorld.loadedEntityList;
   GL11.glLineWidth(1.0F);
   for (int i = 0; i < list1.size(); i++) {
     Entity entity = list1.get(i);
     double xdis = this.mc.thePlayer.posX - entity.posX;
     double zdis = this.mc.thePlayer.posZ - entity.posZ;
     double tdis = Math.sqrt((xdis * xdis) + (zdis * zdis));
     double difInAng =
         MathHelper.wrapAngleTo180_double(
             this.mc.thePlayer.rotationYaw - ((Math.atan2(zdis, xdis) * 180.0D) / Math.PI));
     double finalX = Math.cos(Math.toRadians(difInAng)) * tdis;
     double finalY = -Math.sin(Math.toRadians(difInAng)) * tdis;
     GL11.glPushMatrix();
     GL11.glTranslatef(Minecraft.getMinecraft().displayWidth / 2 - 60, 60, 0);
     if (tdis <= 100) {
       if (!(entity instanceof EntityPlayerSP)) {
         if (entity instanceof EntityPlayer) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xff0000ff);
           GL11.glScalef(0.5F, 0.5F, 0.5F);
           EntityPlayer p = (EntityPlayer) entity;
           String u = p.getName();
           this.mc.fontRendererObj.drawString(
               u,
               (int) (finalX) - (this.mc.fontRendererObj.getStringWidth(u) / 2),
               (int) finalY - 10,
               0xffffff);
           GL11.glScalef(1F, 0.5F, 1F);
         }
         if (entity instanceof EntityAnimal) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xff00ff00);
         }
         if (entity instanceof EntityMob) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xffff0000);
         }
         if (entity instanceof EntitySlime) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xffff88cc);
         }
         if (entity instanceof EntityVillager) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xff8b4513);
         }
         if (entity instanceof EntityBat) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xfff4a460);
         }
         if (entity instanceof EntitySquid) {
           InstanceMain.getInstance()
               .getRender()
               .drawCircle((int) finalX / 2, (int) finalY / 2, 1, 0xff003399);
         }
       }
     }
     GL11.glPopMatrix();
   }
 }
  @ForgeSubscribe
  public void DrawBlockHighlightEvent(DrawBlockHighlightEvent evt) {
    World world = evt.player.worldObj;
    double var8 =
        evt.player.lastTickPosX
            + (evt.player.posX - evt.player.lastTickPosX) * (double) evt.partialTicks;
    double var10 =
        evt.player.lastTickPosY
            + (evt.player.posY - evt.player.lastTickPosY) * (double) evt.partialTicks;
    double var12 =
        evt.player.lastTickPosZ
            + (evt.player.posZ - evt.player.lastTickPosZ) * (double) evt.partialTicks;

    boolean isMetalHoe = false;

    if (evt.currentItem != null
        && evt.currentItem.getItem().shiftedIndex != TFCItems.IgInHoe.shiftedIndex
        && evt.currentItem.getItem().shiftedIndex != TFCItems.IgExHoe.shiftedIndex
        && evt.currentItem.getItem().shiftedIndex != TFCItems.SedHoe.shiftedIndex
        && evt.currentItem.getItem().shiftedIndex != TFCItems.MMHoe.shiftedIndex) {
      isMetalHoe = true;
    }

    if (evt.currentItem != null
        && evt.currentItem.getItem() instanceof ItemCustomHoe
        && isMetalHoe
        && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 1) {
      int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
      int crop = 0;
      if (id == Block.crops.blockID
          && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil.blockID
              || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil2.blockID)) {
        id = TFCBlocks.tilledSoil.blockID;
        crop = 1;
      }

      if (id == TFCBlocks.tilledSoil.blockID || id == TFCBlocks.tilledSoil2.blockID) {
        TileEntityFarmland te =
            (TileEntityFarmland)
                world.getBlockTileEntity(
                    evt.target.blockX, evt.target.blockY - crop, evt.target.blockZ);
        te.requestNutrientData();

        float timeMultiplier = (float) TFC_Time.daysInYear / 360f;
        int soilMax = (int) (25000 * timeMultiplier);

        // Setup GL for the depthbox
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4ub(
            TFC_Settings.cropNutrientAColor[0],
            TFC_Settings.cropNutrientAColor[1],
            TFC_Settings.cropNutrientAColor[2],
            TFC_Settings.cropNutrientAColor[3]);
        GL11.glDisable(GL11.GL_CULL_FACE);
        // GL11.glLineWidth(6.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);

        double offset = 0;
        double nutrient = 1.02 + ((double) te.nutrients[0] / (double) soilMax) * 0.5;

        drawBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        offset = 0.3333;
        nutrient = 1.02 + ((double) te.nutrients[1] / (double) soilMax) * 0.5;
        GL11.glColor4ub(
            TFC_Settings.cropNutrientBColor[0],
            TFC_Settings.cropNutrientBColor[1],
            TFC_Settings.cropNutrientBColor[2],
            TFC_Settings.cropNutrientBColor[3]);
        drawBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        offset = 0.6666;
        nutrient = 1.02 + ((double) te.nutrients[2] / (double) soilMax) * 0.5;
        GL11.glColor4ub(
            TFC_Settings.cropNutrientCColor[0],
            TFC_Settings.cropNutrientCColor[1],
            TFC_Settings.cropNutrientCColor[2],
            TFC_Settings.cropNutrientCColor[3]);
        drawBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        GL11.glEnable(GL11.GL_CULL_FACE);

        /** Draw the outliens around the boxes */
        GL11.glColor4f(0.1F, 0.1F, 0.1F, 1.0F);
        GL11.glLineWidth(3.0F);
        GL11.glDepthMask(false);

        offset = 0;
        nutrient = 1.02 + ((double) te.nutrients[0] / (double) soilMax) * 0.5;
        drawOutlinedBoundingBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        offset = 0.3333;
        nutrient = 1.02 + ((double) te.nutrients[1] / (double) soilMax) * 0.5;
        drawOutlinedBoundingBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        offset = 0.6666;
        nutrient = 1.02 + ((double) te.nutrients[2] / (double) soilMax) * 0.5;
        drawOutlinedBoundingBox(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX + offset,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + offset + 0.3333,
                    evt.target.blockY + nutrient - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));
      }
    } else if (evt.currentItem != null
        && evt.currentItem.getItem() instanceof ItemCustomHoe
        && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 2) {
      int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
      int crop = 0;
      if (id == Block.crops.blockID
          && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil.blockID
              || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil2.blockID)) {
        id = TFCBlocks.tilledSoil.blockID;
        crop = 1;
      }

      if (id == TFCBlocks.tilledSoil.blockID || id == TFCBlocks.tilledSoil2.blockID) {
        boolean water =
            TFC.Blocks.BlockFarmland.isWaterNearby(
                world, evt.target.blockX, evt.target.blockY - crop, evt.target.blockZ);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if (water) GL11.glColor4ub((byte) 14, (byte) 23, (byte) 212, (byte) 200);
        else GL11.glColor4ub((byte) 0, (byte) 0, (byte) 0, (byte) 200);
        GL11.glDisable(GL11.GL_CULL_FACE);
        // GL11.glLineWidth(6.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);

        drawFace(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX,
                    evt.target.blockY + 1.01 - crop,
                    evt.target.blockZ,
                    evt.target.blockX + 1,
                    evt.target.blockY + 1.02 - crop,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        GL11.glEnable(GL11.GL_CULL_FACE);
      }
    } else if (evt.currentItem != null
        && evt.currentItem.getItem() instanceof ItemCustomHoe
        && PlayerManagerTFC.getInstance().getClientPlayer().hoeMode == 3) {
      int id = world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
      if (id == Block.crops.blockID
          && (world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil.blockID
              || world.getBlockId(evt.target.blockX, evt.target.blockY - 1, evt.target.blockZ)
                  == TFCBlocks.tilledSoil2.blockID)) {
        TileEntityCrop te =
            (TileEntityCrop)
                world.getBlockTileEntity(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
        CropIndex index = CropManager.getInstance().getCropFromId(te.cropId);
        boolean fullyGrown = te.growth >= index.numGrowthStages;

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if (fullyGrown) GL11.glColor4ub((byte) 64, (byte) 200, (byte) 37, (byte) 200);
        else GL11.glColor4ub((byte) 200, (byte) 37, (byte) 37, (byte) 200);
        GL11.glDisable(GL11.GL_CULL_FACE);
        // GL11.glLineWidth(6.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);

        drawFace(
            AxisAlignedBB.getAABBPool()
                .addOrModifyAABBInPool(
                    evt.target.blockX,
                    evt.target.blockY + 0.01,
                    evt.target.blockZ,
                    evt.target.blockX + 1,
                    evt.target.blockY + 0.02,
                    evt.target.blockZ + 1)
                .expand(0.002F, 0.002F, 0.002F)
                .getOffsetBoundingBox(-var8, -var10, -var12));

        GL11.glEnable(GL11.GL_CULL_FACE);
      }
    }
  }