Jump to content

Recommended Posts

Posted

I just wondered how I can store an integer and save it to the player using nbts I have done some searching, but couldn't find a way to do it. I am quite new to the the whole 1.7.2 thing and haven't modded minecraft for a bit. It will be used like a mana type system and I want it to work in multiplayer as well as singleplayer.

 

Thanks in advance.

Posted

Note:This Works in 1.6.4, I don't know about 1.7.2

If you want to store NBT Data then you can try this:

 

method(EntityPlayer player) {

 

player.getEntityData().setInteger("IntegerName", 1);

 

int i = player.getInteger("IntegerName");

 

if(player.getEntityData().hasKey("IntegerName")) {

    do stuff

}

 

You can then add anything you want after the getEntityData().

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

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.