Step one: Imports.
First, we need to import the nessesary classes. This is only based on the assumption that you are using a seperate package for the class that I'm about to show you.
![[Image: b2YTBr.png]](http://screensnapr.com/e/b2YTBr.png)
**
Step one: Complete.
**
Step two: Class declaration & Variables.
Ok. So, again, assuming you are coding this in another package, create these variables:
![[Image: dsxajt.png]](http://screensnapr.com/e/dsxajt.png)
Forget the 'MediaClient.mc' etc. That's a base class I use. Find that one out yourself.
**
Step two: Complete.
**
Step three: The called method.
So now, we prepare the first method, and it's also the method we will be calling, from GuiIngame or your hooked class.
![[Image: YqCblo.png]](http://screensnapr.com/e/YqCblo.png)
**
Step three: Complete.
**
Step four: The actual GUI radar method.
Now, we'll make the actual method that creates the instance of the entites, and displays them; aswell as using basic math to find the appropriate co-ordinates.
![[Image: Ky1avZ.png]](http://screensnapr.com/e/Ky1avZ.png)
![[Image: wra2lV.png]](http://screensnapr.com/e/wra2lV.png)
![[Image: tEUbmN.png]](http://screensnapr.com/e/tEUbmN.png)
So now that's done, that's it. Feel free to customize the colours, or basically anything.
**
Step four: Complete.
**
Step five: Calling the GUI radar as a whole.
![[Image: rnM7c0.png]](http://screensnapr.com/e/rnM7c0.png)
That's it!
**
Step five: Complete.
**
Finale.
Thanks all.
Figure out yourself what it looks like....
If you want the complete code dump, here you are.
First, we need to import the nessesary classes. This is only based on the assumption that you are using a seperate package for the class that I'm about to show you.
![[Image: b2YTBr.png]](http://screensnapr.com/e/b2YTBr.png)
**
Step one: Complete.
**
Step two: Class declaration & Variables.
Ok. So, again, assuming you are coding this in another package, create these variables:
![[Image: dsxajt.png]](http://screensnapr.com/e/dsxajt.png)
Forget the 'MediaClient.mc' etc. That's a base class I use. Find that one out yourself.
**
Step two: Complete.
**
Step three: The called method.
So now, we prepare the first method, and it's also the method we will be calling, from GuiIngame or your hooked class.
![[Image: YqCblo.png]](http://screensnapr.com/e/YqCblo.png)
**
Step three: Complete.
**
Step four: The actual GUI radar method.
Now, we'll make the actual method that creates the instance of the entites, and displays them; aswell as using basic math to find the appropriate co-ordinates.
![[Image: Ky1avZ.png]](http://screensnapr.com/e/Ky1avZ.png)
![[Image: wra2lV.png]](http://screensnapr.com/e/wra2lV.png)
![[Image: tEUbmN.png]](http://screensnapr.com/e/tEUbmN.png)
So now that's done, that's it. Feel free to customize the colours, or basically anything.
**
Step four: Complete.
**
Step five: Calling the GUI radar as a whole.
![[Image: rnM7c0.png]](http://screensnapr.com/e/rnM7c0.png)
That's it!
**
Step five: Complete.
**
Finale.
Thanks all.
Figure out yourself what it looks like....

If you want the complete code dump, here you are.
Code:
package Java.Gui;
import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityChicken;
import net.minecraft.src.EntityClientPlayerMP;
import net.minecraft.src.EntityCow;
import net.minecraft.src.EntityCreeper;
import net.minecraft.src.EntityEnderman;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityOtherPlayerMP;
import net.minecraft.src.EntityPig;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntitySheep;
import net.minecraft.src.EntitySkeleton;
import net.minecraft.src.EntitySquid;
import net.minecraft.src.EntityZombie;
import net.minecraft.src.FontRenderer;
import Java.MediaClient;
import Java.Methods;
public class GuiRadar2 {
protected static MediaClient media = new MediaClient();
protected static Minecraft mc = MediaClient.mc;
static FontRenderer fontrenderer = MediaClient.mc.fontRenderer;
public static void radarOverlay(){
/** This is the main method we will be calling. */
GL11.glPushMatrix();
/** Push the matrix */
GL11.glTranslatef(50, 50, 0);
/** We are setting the point the entities rotate around. */
Methods.rounded(-48, -48, 50, 50, 0xff00, 0x800);
/** Draw the main rect, which is STATIC. This does NOT rotate. */
Methods.drawRect(-1, -1, 1, 1, 0xffff0000);
/** This is the center point which by default imitates your position. */
GL11.glRotatef(-mc.thePlayer.rotationYaw, 0, 0, 1);
/** Rotate whatever is called below, to your minus yaw movement. */
draw_radar_2();
/** Call the method we wrote earlier. */
GL11.glPopMatrix();
/** Pop the matrix, which means to reset all the GL11 commands. */
}
static void draw_radar_2(){
int posX, posZ;
/** New integer variables, called posX & posZ. */
List list = mc.theWorld.loadedEntityList;
/** New list, equal to the loaded entities in the current chunk. */
for(Object o : list){
/** The for loop iterates through the list, and each iteration, performs the execution code below */
int i = list.indexOf(o);
/** Get the value of the current iteration, and store it in a variable. */
Entity entity = (Entity)list.get(i);
/** Make a new instance of an Entity, and make it equal to
the entity in the current iteration. We make it compatible by casting
it. */
if(entity != mc.thePlayer && entity != null){
/** If the entity is not equal to you, and the entity doesn't null pointer.. */
int pdisx = (int) Math.round(mc.thePlayer.posX);
/** Get your current x position, (we cast it into a integer data type) */
int pdisz = (int) Math.round(mc.thePlayer.posZ);
/** Get your current z position, (we cast it into a integer data type) */
int disx = (int) Math.round(entity.posX);
/** Get the entities current x position, (we cast it into a integer data type) */
int disz = (int) Math.round(entity.posZ);
/** Get the entities current z position, (we cast it into a integer data type) */
posX = pdisx - disx;
/** Subtract the entities pos x from our pos x. */
posZ = pdisz - disz;
/** Subtract the entities pos z from our pos z. */
boolean flag = Math.hypot(posX, posZ)< 50;
/** A new boolean, called flag. It's value depends
whether the hypotenue of the posX & posZ values is smaller than 50.
*/
if(flag){
/** If the condition above is met, then this code is executed. */
if(entity instanceof EntityPlayer){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xffE4287C);
}else if(entity instanceof EntityPig){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xffF535AA);
}else if(entity instanceof EntityChicken){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff);
}else if(entity instanceof EntityCow){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xffF535AA);
}else if(entity instanceof EntitySheep){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff666362);
}else if(entity instanceof EntitySquid){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff00);
}else if(entity instanceof EntityZombie){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff347C2C);
}else if(entity instanceof EntitySkeleton){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff463E41);
}else if(entity instanceof EntityCreeper){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff00cc00);
}else if(entity instanceof EntityEnderman){
mc.ingameGUI.drawRect(posX - 1, posZ - 1, posX + 1, posZ + 1, 0xff302217);
}
/** Pretty self explanitory. */
}
}
}
}
}
OMG!! I'm getting do frustrated, I really can't get it to work. It just crashed when I call the method.It says there's no constructor and if you look closely there is none nor a "public static void main(String[] args)". help pls
ReplyDelete