Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- code:
- public void drawRadar()
- {
- java.util.List<EntityLiving> entities = mc.theWorld.loadedEntityList;
- for (int y = 0; y < entities.size(); y++) {
- Entity entity = entities.get(y);
- // Own coords
- int pdisx = (int) Math.round(mc.thePlayer.posX);
- int pdisz = (int) Math.round(mc.thePlayer.posZ);
- // Entity coords
- int disx = (int) Math.round(entity.posX);
- int disz = (int) Math.round(entity.posZ);
- // Differences
- int ddisx = pdisx - disx;
- int ddisz = pdisz - disz;
- if(Math.hypot(ddisx, ddisz)<110 && entity != mc.thePlayer && entity instanceof EntityLiving)
- {
- // draw entity
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- if(entity.getEntityString()=="Pig"||entity.getEntityString()=="Cow"||entity.getEntityString()=="Sheep"||entity.getEntityString()=="Wolf"||entity.getEntityString()=="Chicken"||entity.getEntityString()=="Squid")
- {
- // drawRect( - 1 + ddisx, - 1 + ddisz, 1 + ddisx, 1 + ddisz, 0xff00ffff);
- DrawFullCircle(ddisx,ddisz,1.5,0xff00ffff);
- }else
- if(entity instanceof EntityPlayer)
- {
- // drawRect( - 1 + ddisx / 2, - 1 + ddisz / 2, 1 + ddisx / 2, 1 + ddisz / 2, 0xfff0f0f0);
- DrawFullCircle(ddisx,ddisz,3.0,0xfff0f0f0);
- }else
- //drawRect( - 1 + ddisx, - 1 + ddisz, 1 + ddisx, 1 + ddisz, 0xfff000f0);
- DrawFullCircle(ddisx,ddisz,1.5,0xfff000f0);
- GL11.glScalef(2F, 2F, 2F);
- }
- }
- }
- public void DrawCircle(float cx, float cy, float r, int num_segments, int c)
- {
- float f = (float) (c >> 24 & 0xff) / 255F;
- float f1 = (float) (c >> 16 & 0xff) / 255F;
- float f2 = (float) (c >> 8 & 0xff) / 255F;
- float f3 = (float) (c & 0xff) / 255F;
- float theta = (float) (2 * 3.1415926 / (num_segments));
- float p = (float) Math.cos(theta);//calculate the sine and cosine
- float s = (float) Math.sin(theta);
- float t;
- GL11.glColor4f(f1, f2, f3, f);
- float x = r;
- float y = 0;//start at angle = 0
- GL11.glEnable(3042 /*GL_BLEND*/);
- GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
- GL11.glEnable(GL11.GL_LINE_SMOOTH);
- GL11.glBlendFunc(770, 771);
- GL11.glBegin(GL11.GL_LINE_LOOP);
- for(int ii = 0; ii < num_segments; ii++)
- {
- GL11.glVertex2f(x + cx, y + cy);//final vertex vertex
- //rotate the stuff
- t = x;
- x = p * x - s * y;
- y = s * t + p * y;
- }
- GL11.glEnd();
- GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
- GL11.glDisable(3042 /*GL_BLEND*/);
- GL11.glDisable(GL11.GL_LINE_SMOOTH);
- }
- public static void DrawFullCircle(int cx, int cy, double r, int c) {
- float f = (float) (c >> 24 & 0xff) / 255F;
- float f1 = (float) (c >> 16 & 0xff) / 255F;
- float f2 = (float) (c >> 8 & 0xff) / 255F;
- float f3 = (float) (c & 0xff) / 255F;
- GL11.glEnable(3042 /* GL_BLEND */);
- GL11.glDisable(3553 /* GL_TEXTURE_2D */);
- GL11.glEnable(GL11.GL_LINE_SMOOTH);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(f1, f2, f3, f);
- GL11.glBegin(GL11.GL_TRIANGLE_FAN);
- for (int i = 0; i <= 360; i++) {
- double x = Math.sin((i * 3.141526D / 180)) * r;
- double y = Math.cos((i * 3.141526D / 180)) * r;
- GL11.glVertex2d(cx + x, cy + y);
- }
- GL11.glEnd();
- GL11.glDisable(GL11.GL_LINE_SMOOTH);
- GL11.glEnable(3553 /* GL_TEXTURE_2D */);
- GL11.glDisable(3042 /* GL_BLEND */);
- }
- public static void drawTri(int cx, int cy, int c)
- {
- GL11.glRotatef(180, 0F,0F,1.0F);
- float f = (float) (c >> 24 & 0xff) / 255F;
- float f1 = (float) (c >> 16 & 0xff) / 255F;
- float f2 = (float) (c >> 8 & 0xff) / 255F;
- float f3 = (float) (c & 0xff) / 255F;
- GL11.glColor4f(f1, f2, f3, f);
- GL11.glEnable(3042 /* GL_BLEND */);
- GL11.glDisable(3553 /* GL_TEXTURE_2D */);
- GL11.glEnable(GL11.GL_LINE_SMOOTH);
- GL11.glBlendFunc(770, 771);
- GL11.glBegin(GL11.GL_TRIANGLES);
- GL11.glVertex2d(cx,cy+2);
- GL11.glVertex2d(cx+2,cy-2);
- GL11.glVertex2d(cx-2,cy-2);
- GL11.glEnd();
- GL11.glDisable(GL11.GL_LINE_SMOOTH);
- GL11.glEnable(3553 /* GL_TEXTURE_2D */);
- GL11.glDisable(3042 /* GL_BLEND */);
- GL11.glRotatef(-180, 0F,0F,1.0F);
- activator:
- if(Variables.radar)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef(61, 181, 0);
- DrawFullCircle(0,0,55.9,0x50005000);
- DrawCircle(0F,0F,(float)55.9,360,0xa000f000);
- drawTri(0,0,0xff00);
- GL11.glRotatef(-mc.thePlayer.rotationYaw, 0, 0, 1);
- drawRadar();
- GL11.glPopMatrix();
Add Comment
Please, Sign In to add comment