Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. code:
  2.  
  3.  
  4.  
  5. public void drawRadar()
  6. {
  7.  
  8. java.util.List<EntityLiving> entities = mc.theWorld.loadedEntityList;
  9. for (int y = 0; y < entities.size(); y++) {
  10. Entity entity = entities.get(y);
  11.  
  12. // Own coords
  13. int pdisx = (int) Math.round(mc.thePlayer.posX);
  14. int pdisz = (int) Math.round(mc.thePlayer.posZ);
  15.  
  16. // Entity coords
  17. int disx = (int) Math.round(entity.posX);
  18. int disz = (int) Math.round(entity.posZ);
  19.  
  20. // Differences
  21. int ddisx = pdisx - disx;
  22. int ddisz = pdisz - disz;
  23.  
  24. if(Math.hypot(ddisx, ddisz)<110 && entity != mc.thePlayer && entity instanceof EntityLiving)
  25. {
  26. // draw entity
  27. GL11.glScalef(0.5F, 0.5F, 0.5F);
  28. if(entity.getEntityString()=="Pig"||entity.getEntityString()=="Cow"||entity.getEntityString()=="Sheep"||entity.getEntityString()=="Wolf"||entity.getEntityString()=="Chicken"||entity.getEntityString()=="Squid")
  29. {
  30. // drawRect( - 1 + ddisx, - 1 + ddisz, 1 + ddisx, 1 + ddisz, 0xff00ffff);
  31. DrawFullCircle(ddisx,ddisz,1.5,0xff00ffff);
  32. }else
  33. if(entity instanceof EntityPlayer)
  34. {
  35. // drawRect( - 1 + ddisx / 2, - 1 + ddisz / 2, 1 + ddisx / 2, 1 + ddisz / 2, 0xfff0f0f0);
  36. DrawFullCircle(ddisx,ddisz,3.0,0xfff0f0f0);
  37. }else
  38. //drawRect( - 1 + ddisx, - 1 + ddisz, 1 + ddisx, 1 + ddisz, 0xfff000f0);
  39. DrawFullCircle(ddisx,ddisz,1.5,0xfff000f0);
  40. GL11.glScalef(2F, 2F, 2F);
  41. }
  42. }
  43. }
  44.  
  45. public void DrawCircle(float cx, float cy, float r, int num_segments, int c)
  46. {
  47. float f = (float) (c >> 24 & 0xff) / 255F;
  48. float f1 = (float) (c >> 16 & 0xff) / 255F;
  49. float f2 = (float) (c >> 8 & 0xff) / 255F;
  50. float f3 = (float) (c & 0xff) / 255F;
  51. float theta = (float) (2 * 3.1415926 / (num_segments));
  52. float p = (float) Math.cos(theta);//calculate the sine and cosine
  53. float s = (float) Math.sin(theta);
  54. float t;
  55. GL11.glColor4f(f1, f2, f3, f);
  56. float x = r;
  57. float y = 0;//start at angle = 0
  58. GL11.glEnable(3042 /*GL_BLEND*/);
  59. GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
  60. GL11.glEnable(GL11.GL_LINE_SMOOTH);
  61. GL11.glBlendFunc(770, 771);
  62. GL11.glBegin(GL11.GL_LINE_LOOP);
  63. for(int ii = 0; ii < num_segments; ii++)
  64. {
  65. GL11.glVertex2f(x + cx, y + cy);//final vertex vertex
  66.  
  67. //rotate the stuff
  68. t = x;
  69. x = p * x - s * y;
  70. y = s * t + p * y;
  71. }
  72. GL11.glEnd();
  73. GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  74. GL11.glDisable(3042 /*GL_BLEND*/);
  75. GL11.glDisable(GL11.GL_LINE_SMOOTH);
  76. }
  77.  
  78. public static void DrawFullCircle(int cx, int cy, double r, int c) {
  79. float f = (float) (c >> 24 & 0xff) / 255F;
  80. float f1 = (float) (c >> 16 & 0xff) / 255F;
  81. float f2 = (float) (c >> 8 & 0xff) / 255F;
  82. float f3 = (float) (c & 0xff) / 255F;
  83. GL11.glEnable(3042 /* GL_BLEND */);
  84. GL11.glDisable(3553 /* GL_TEXTURE_2D */);
  85. GL11.glEnable(GL11.GL_LINE_SMOOTH);
  86. GL11.glBlendFunc(770, 771);
  87. GL11.glColor4f(f1, f2, f3, f);
  88. GL11.glBegin(GL11.GL_TRIANGLE_FAN);
  89. for (int i = 0; i <= 360; i++) {
  90. double x = Math.sin((i * 3.141526D / 180)) * r;
  91. double y = Math.cos((i * 3.141526D / 180)) * r;
  92. GL11.glVertex2d(cx + x, cy + y);
  93. }
  94. GL11.glEnd();
  95. GL11.glDisable(GL11.GL_LINE_SMOOTH);
  96. GL11.glEnable(3553 /* GL_TEXTURE_2D */);
  97. GL11.glDisable(3042 /* GL_BLEND */);
  98. }
  99. public static void drawTri(int cx, int cy, int c)
  100. {
  101. GL11.glRotatef(180, 0F,0F,1.0F);
  102. float f = (float) (c >> 24 & 0xff) / 255F;
  103. float f1 = (float) (c >> 16 & 0xff) / 255F;
  104. float f2 = (float) (c >> 8 & 0xff) / 255F;
  105. float f3 = (float) (c & 0xff) / 255F;
  106. GL11.glColor4f(f1, f2, f3, f);
  107. GL11.glEnable(3042 /* GL_BLEND */);
  108. GL11.glDisable(3553 /* GL_TEXTURE_2D */);
  109. GL11.glEnable(GL11.GL_LINE_SMOOTH);
  110. GL11.glBlendFunc(770, 771);
  111. GL11.glBegin(GL11.GL_TRIANGLES);
  112.  
  113. GL11.glVertex2d(cx,cy+2);
  114. GL11.glVertex2d(cx+2,cy-2);
  115. GL11.glVertex2d(cx-2,cy-2);
  116.  
  117. GL11.glEnd();
  118. GL11.glDisable(GL11.GL_LINE_SMOOTH);
  119. GL11.glEnable(3553 /* GL_TEXTURE_2D */);
  120. GL11.glDisable(3042 /* GL_BLEND */);
  121. GL11.glRotatef(-180, 0F,0F,1.0F);
  122.  
  123.  
  124.  
  125.  
  126. activator:
  127.  
  128. if(Variables.radar)
  129. {
  130. GL11.glPushMatrix();
  131. GL11.glTranslatef(61, 181, 0);
  132. DrawFullCircle(0,0,55.9,0x50005000);
  133. DrawCircle(0F,0F,(float)55.9,360,0xa000f000);
  134. drawTri(0,0,0xff00);
  135. GL11.glRotatef(-mc.thePlayer.rotationYaw, 0, 0, 1);
  136. drawRadar();
  137. GL11.glPopMatrix();
Add Comment
Please, Sign In to add comment