Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void renderPath(EntityLiving entity) {
- PathEntity path = entity.getNavigator().getPath();
- if (path == null || path.getCurrentPathLength() == 0)
- return;
- double boxHalfSize = 0.2D;
- // int color = entity.name.hashCode() & 0xFFFFFF;
- int color = 0x0066FF;
- glPushMatrix();
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- double x1, y1, z1, x2, y2, z2;
- for (int i = 1; i < path.getCurrentPathLength(); i++) {
- PathPoint pp1 = path.getPathPointFromIndex(i);
- PathPoint pp2 = path.getPathPointFromIndex(i - 1);
- x1 = entity.posX - RenderManager.renderPosX + (pp1.xCoord - entity.posX + 0.5D);
- y1 = entity.posY - RenderManager.renderPosY + (pp1.yCoord - entity.posY + 0.02D);
- z1 = entity.posZ - RenderManager.renderPosZ + (pp1.zCoord - entity.posZ + 0.5D);
- x2 = entity.posX - RenderManager.renderPosX + (pp2.xCoord - entity.posX + 0.5D);
- y2 = entity.posY - RenderManager.renderPosY + (pp2.yCoord - entity.posY + 0.02D);
- z2 = entity.posZ - RenderManager.renderPosZ + (pp2.zCoord - entity.posZ + 0.5D);
- glColor4d(1D, 1D, 0D, 1D);
- glLineWidth(0.1F);
- glBegin(GL_LINES);
- glVertex3d(z1 != z2 ? x1 : x1 - x2 > 0 ? x1 - boxHalfSize : x1 + boxHalfSize, y1, x1 != x2 ? z1 : z1 - z2 > 0 ? z1 - boxHalfSize : z1 + boxHalfSize);
- glVertex3d(z1 != z2 ? x2 : x1 - x2 > 0 ? x2 + boxHalfSize : x2 - boxHalfSize, y2, x1 != x2 ? z2 : z1 - z2 > 0 ? z2 + boxHalfSize : z2 - boxHalfSize);
- glEnd();
- glColor4d((color >> 16 & 0xFF) / (float) 255, (color >> 8 & 0xFF) / (float) 255, (color & 0xFF) / (float) 255, 1D);
- glBegin(GL_QUADS);
- glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
- glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
- glEnd();
- }
- PathPoint pp1 = path.getPathPointFromIndex(0);
- x1 = entity.posX - RenderManager.renderPosX + (pp1.xCoord - entity.posX + 0.5D);
- y1 = entity.posY - RenderManager.renderPosY + (pp1.yCoord - entity.posY + 0.02D);
- z1 = entity.posZ - RenderManager.renderPosZ + (pp1.zCoord - entity.posZ + 0.5D);
- glLineWidth(1.1F);
- glBegin(GL_LINES);
- glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
- glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
- glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
- glEnd();
- glColor4d(1D, 1D, 1D, 1D);
- // End Draw
- glDisable(GL_BLEND);
- glEnable(GL_LIGHTING);
- glEnable(GL_TEXTURE_2D);
- glPopMatrix();
- }
Advertisement