GenuineSounds

Java - Client/GenuineNpc/net/minecraft/src/GenuineRenderEntityNpc.java - Eclipse

Jun 14th, 2012
214
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. private static void renderPath(EntityLiving entity) {
  2. PathEntity path = entity.getNavigator().getPath();
  3. if (path == null || path.getCurrentPathLength() == 0)
  4. return;
  5. double boxHalfSize = 0.2D;
  6. // int color = entity.name.hashCode() & 0xFFFFFF;
  7. int color = 0x0066FF;
  8. glPushMatrix();
  9. glDisable(GL_LIGHTING);
  10. glDisable(GL_TEXTURE_2D);
  11. glEnable(GL_BLEND);
  12. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  13. double x1, y1, z1, x2, y2, z2;
  14. for (int i = 1; i < path.getCurrentPathLength(); i++) {
  15. PathPoint pp1 = path.getPathPointFromIndex(i);
  16. PathPoint pp2 = path.getPathPointFromIndex(i - 1);
  17. x1 = entity.posX - RenderManager.renderPosX + (pp1.xCoord - entity.posX + 0.5D);
  18. y1 = entity.posY - RenderManager.renderPosY + (pp1.yCoord - entity.posY + 0.02D);
  19. z1 = entity.posZ - RenderManager.renderPosZ + (pp1.zCoord - entity.posZ + 0.5D);
  20. x2 = entity.posX - RenderManager.renderPosX + (pp2.xCoord - entity.posX + 0.5D);
  21. y2 = entity.posY - RenderManager.renderPosY + (pp2.yCoord - entity.posY + 0.02D);
  22. z2 = entity.posZ - RenderManager.renderPosZ + (pp2.zCoord - entity.posZ + 0.5D);
  23. glColor4d(1D, 1D, 0D, 1D);
  24. glLineWidth(0.1F);
  25. glBegin(GL_LINES);
  26. glVertex3d(z1 != z2 ? x1 : x1 - x2 > 0 ? x1 - boxHalfSize : x1 + boxHalfSize, y1, x1 != x2 ? z1 : z1 - z2 > 0 ? z1 - boxHalfSize : z1 + boxHalfSize);
  27. glVertex3d(z1 != z2 ? x2 : x1 - x2 > 0 ? x2 + boxHalfSize : x2 - boxHalfSize, y2, x1 != x2 ? z2 : z1 - z2 > 0 ? z2 + boxHalfSize : z2 - boxHalfSize);
  28. glEnd();
  29. glColor4d((color >> 16 & 0xFF) / (float) 255, (color >> 8 & 0xFF) / (float) 255, (color & 0xFF) / (float) 255, 1D);
  30. glBegin(GL_QUADS);
  31. glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
  32. glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
  33. glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
  34. glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
  35. glEnd();
  36. }
  37. PathPoint pp1 = path.getPathPointFromIndex(0);
  38. x1 = entity.posX - RenderManager.renderPosX + (pp1.xCoord - entity.posX + 0.5D);
  39. y1 = entity.posY - RenderManager.renderPosY + (pp1.yCoord - entity.posY + 0.02D);
  40. z1 = entity.posZ - RenderManager.renderPosZ + (pp1.zCoord - entity.posZ + 0.5D);
  41. glLineWidth(1.1F);
  42. glBegin(GL_LINES);
  43. glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
  44. glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
  45. glVertex3d(x1 + boxHalfSize, y1, z1 + boxHalfSize);
  46. glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
  47. glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
  48. glVertex3d(x1 + boxHalfSize, y1, z1 - boxHalfSize);
  49. glVertex3d(x1 - boxHalfSize, y1, z1 - boxHalfSize);
  50. glVertex3d(x1 - boxHalfSize, y1, z1 + boxHalfSize);
  51. glEnd();
  52. glColor4d(1D, 1D, 1D, 1D);
  53. // End Draw
  54. glDisable(GL_BLEND);
  55. glEnable(GL_LIGHTING);
  56. glEnable(GL_TEXTURE_2D);
  57. glPopMatrix();
  58. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment