Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to write informations in the player profile?


elterPro
 Share

Recommended Posts

Hey Guys,

I want, that you have to eat a plant to discover what it does. That works quite good, but everytime I start the map new, all discovered informations are resteted. Furthermore it would be nice, if it also works for every single player in multiplayer... So I think I've to save the vars to a file, but how can I do it?

So here are the relevant parts of the Code:

 

ItemFoodLantanaBerries.java :

 

public class ItemFoodLantanaBerries extends ItemFood {

public boolean discovered = false; // This var says if you know the plant or not. At start you don't know what this plant does.

/...

    public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
    	discovered = true; // <-- If you've eaten the plant, you know the properties of it. 
        /...
    }

@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
	if(discovered == false) // If you don't know the plant, you will have an other information.
	{
		par3List.add("Some blue berries.");
	} else {
		par3List.add("There is a medium posion inside.");
	}
}
}

Link to comment
Share on other sites

Add information to player.getEntityData(), hopefully it's pretty self-explanatory.

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.