Jump to content

[SOLVED] addInformation method on blocks?


bl4ckscor3

Recommended Posts

Hi guys! I want to add some tooltips to my new blocks. I already did this on the Items with this method:

 

 

        @Override
        public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
        {
                list.add("Some Information");
        }

 

 

 

The same method doesn't work for the blocks, of course. I searched the Block.java for similar methods, but I ended up with nothing. I know that adding tooltips to blocks IS possible, see Factorization. Now, how can I do this?

 

Thanks in advance

~bl4ckscor3

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

Link to comment
Share on other sites

Hey!

 

I had a similar issue a few weeks ago, but discovered that if you register your block as if it had metadata, then in your ItemBlock.java you can add the item lore.

 

To register your block:

GameRegistry.registerBlock(BlockCustom, ItemBlockCustom.class, "YourMod.BlockCustom";

 

In your ItemBlockCustom.java file:

@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
{
      list.add("Some Information");
}

 


 

I wrote this code from memory, so it may not be correct. It should point you on the right track though :P

 

Hope this helped!

Luis :D

Link to comment
Share on other sites

Hey!

 

I had a similar issue a few weeks ago, but discovered that if you register your block as if it had metadata, then in your ItemBlock.java you can add the item lore.

 

To register your block:

GameRegistry.registerBlock(BlockCustom, ItemBlockCustom.class, "YourMod.BlockCustom";

 

In your ItemBlockCustom.java file:

@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
{
      list.add("Some Information");
}

 


 

I wrote this code from memory, so it may not be correct. It should point you on the right track though :P

 

Hope this helped!

Luis :D

Thanks, that was exactly right! (I don't really feel like making new classes only for Information but oh, well....) :)

↑↑↑↑↑↑↑↑↑↑ Click it please? :3 ↑↑↑↑↑↑↑↑↑↑

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.



×
×
  • Create New...

Important Information

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