Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.");
	}
}
}

By "start the map new," do you mean when you make a new map, or when you quit then come back?

width=300 height=100http://i.imgur.com/ivK3J.png[/img]

I'm a little surprised that I am still ranked as a "Forge Modder," having not posted a single mod since my animals mod... I have to complete Digging Deeper!, fast!

  • Author
By "start the map new," do you mean when you make a new map, or when you quit then come back?

I mean when I quit and come back, all my discovered informations are away. If you create a new map, it's ok, that you will loose your informations...

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!)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.