Jump to content

Setting an x,y,z location with a tool in game


jrgcmm

Recommended Posts

I am making a mod to display the distance from the player to a specific location. Currently this specific location is set at (-724, 13, -1285).

I want to be able to set the location while playing.

Is it possible to get the coordinates of a block by hitting that block with a specific item?

I am open to suggestions about another way of setting the coordinates if the hitting the block idea is not possible.

 

Here is the part of my code that determines and renders the distance:

 

 

private final Minecraft mc;
EntityPlayer player = mc.thePlayer;
double xc = -724;
double yc = 13;
double zc = -1285;
double  = player.posX;
double yd = player.posY;
double zd = player.posZ;
double d = Math.pow(Math.pow(xc-,2)+Math.pow(yc-yd,2)+Math.pow(zc-zd,2),0.5);
int x = 100;
int y = 2;
int dColor = 0x00FF00;
fontRender.drawStringWithShadow(String.format("d: %.1f", d), x, y, dColor);

 

 

Thanks in advance for the help!

Link to comment
Share on other sites

Is it possible to get the coordinates of a block by hitting that block with a specific item?

 

Yes.

 

Look at world.rayTraceBlocks_do_do(...)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.