Jump to content

Recommended Posts

Posted

I'm pretty new to modding, due to a need on the server i play on, i want to make a mod. So i am trying to learn. I have eclipse, and forge setup. I just can't seem to find the right dependency to get the information i want. I want to get the XYZ of the player, and display it in the bottom right of the screen. Later i will want to detect when the player makes a nether portal, and then display the coords of where the other portal should go, based on where they are when they make the first portal. code is helpful, but just pointing me to the right dependency will be good.

Posted

The code i'm looking at, from Zyin, shows this,

 public static int GetXCoordinate()
    {
    	return (int) Math.floor(mc.thePlayer.posX);
    }

But when i try to use that i get errors. With imports of

import net.minecraft.client.Minecraft;
import net.minecraft.util.BlockPos;

The error says "mc cannot be resolved to a variable".

Posted

You do know Java, right? From the code you got from somebody (bad person, don't give code without explanation), you clearly don't know Java. If you do know it, you can solve the error yourself.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Well i'm not as familur with Java as i am with vb, html, or javascript.

I think i've solved this part. Here's the code i have now, that has no errors.

import net.minecraft.client.Minecraft;
    protected static Minecraft mc = Minecraft.getMinecraft();
    public static int GetXCoordinate()
    {
    	return (int) Math.floor(mc.thePlayer.posX);
    }
    public static int GetYCoordinate()
    {
    	return (int) Math.floor(mc.thePlayer.posY);
    }
    public static int GetZCoordinate()
    {
    	return (int) Math.floor(mc.thePlayer.posZ);
    }

 

Now to figure out how to show that on the game screen.

Thank you for your replies.

 

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.