Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Is it possible to add information or description to an item?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
ILuvYouCompanionCube

Is it possible to add information or description to an item?

By ILuvYouCompanionCube, August 26, 2013 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

ILuvYouCompanionCube    6

ILuvYouCompanionCube

ILuvYouCompanionCube    6

  • Creeper Killer
  • ILuvYouCompanionCube
  • Members
  • 6
  • 112 posts
Posted August 26, 2013

I have downloaded a mod and the items and blocks of the mod come with descriptions. Instead of just the name of the item, you can also read a short description about it in a darker shade of gray.

 

I think that's very useful. I was wondering if that's a feature of that mod in specific or if it's something we can do easily, like having our item/block implement an interface, or something related to the LanguageRegistry or maybe some other registry. Thanks.

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted August 26, 2013

Items have a method called addInformation which you can use.

  • Quote

Share this post


Link to post
Share on other sites

ILuvYouCompanionCube    6

ILuvYouCompanionCube

ILuvYouCompanionCube    6

  • Creeper Killer
  • ILuvYouCompanionCube
  • Members
  • 6
  • 112 posts
Posted August 26, 2013

That method has no implementation. Just a pair of curly braces. How should I override it, so it would show the information for the item?

 

edit1: I searched the forums for addIndormation. Apparently, it's just a matter of adding what you want to the List object. I'll try.

edit2: The only way to do the same for a block is to make a class that inherits from ItemBlock and then overriding addInformation? There must be a better way.

  • Quote

Share this post


Link to post
Share on other sites

GotoLink    381

GotoLink

GotoLink    381

  • World Shaper
  • GotoLink
  • Members
  • 381
  • 2012 posts
Posted August 26, 2013

It is called by getToolTip(EntityPlayer, boolean) in ItemStack.

You can simply add any info as String to the given List argument, and you can format the String to put colors and such.

  • Quote

Share this post


Link to post
Share on other sites

ILuvYouCompanionCube    6

ILuvYouCompanionCube

ILuvYouCompanionCube    6

  • Creeper Killer
  • ILuvYouCompanionCube
  • Members
  • 6
  • 112 posts
Posted August 26, 2013

Block should have one fake version of addInformation. And then Forge would find any overrides of it in our code, and create a class extending ItemBlock at runtime. Then it should "copy-paste" (or "cut-paste") our override of the fake method in Block to this automatically made ItemBlock subclass.

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted August 26, 2013

Block should have one fake version of addInformation. And then Forge would find any overrides of it in our code, and create a class extending ItemBlock at runtime. Then it should "copy-paste" (or "cut-paste") our override of the fake method in Block to this automatically made ItemBlock subclass.

 

Well if you believe that would be somehow easy to create and make it run efficient etc.

then by all means, create the system and do a pull request :P

 

  • Quote

Share this post


Link to post
Share on other sites

ILuvYouCompanionCube    6

ILuvYouCompanionCube

ILuvYouCompanionCube    6

  • Creeper Killer
  • ILuvYouCompanionCube
  • Members
  • 6
  • 112 posts
Posted August 26, 2013

Easy compared to the rest of the Forge framework, yes. So, by the standards of the autors of Forge this is probably quite easy. Easy for me? No way. By my standards making a minecart stop is a big challenge.  :-\

  • Quote

Share this post


Link to post
Share on other sites

Mazetar    271

Mazetar

Mazetar    271

  • World Shaper
  • Mazetar
  • Forge Modder
  • 271
  • 1343 posts
Posted August 26, 2013

Easy compared to the rest of the Forge framework, yes. So, by the standards of the autors of Forge this is probably quite easy. Easy for me? No way. By my standards making a minecart stop is a big challenge.  :-\

 

A such a simple thing as a BlockBreak event is among the most requested features!

Even so it's not yet been implemented, why? Because to the standards of the forge authors there hasn't been made any suggestions on how to do this which would be efficient and good.

 

Making such system is easy, but making it work as neatly as it needs to, may be harder ;)

 

 

  • Quote

Share this post


Link to post
Share on other sites

ILuvYouCompanionCube    6

ILuvYouCompanionCube

ILuvYouCompanionCube    6

  • Creeper Killer
  • ILuvYouCompanionCube
  • Members
  • 6
  • 112 posts
Posted August 26, 2013

But this is not an event. It would be done while loading. We can all afford a few extra miliseconds of loading time if it's not too efficient. Heck, I could even wait one whole second!

  • Quote

Share this post


Link to post
Share on other sites

GotoLink    381

GotoLink

GotoLink    381

  • World Shaper
  • GotoLink
  • Members
  • 381
  • 2012 posts
Posted August 26, 2013

Block should have one fake version of addInformation. And then Forge would find any overrides of it in our code, and create a class extending ItemBlock at runtime. Then it should "copy-paste" (or "cut-paste") our override of the fake method in Block to this automatically made ItemBlock subclass.

Why ?

You never see blocks in the inventory. They are all ItemBlock by default, which is already made automatically for all blocks that don't have a subclass of ItemBlock.

  • Quote

Share this post


Link to post
Share on other sites

hydroflame    208

hydroflame

hydroflame    208

  • World Shaper
  • hydroflame
  • Members
  • 208
  • 1511 posts
Posted August 26, 2013
A such a simple thing as a BlockBreak event is among the most requested features!

Even so it's not yet been implemented, why? Because to the standards of the forge authors there hasn't been made any suggestions on how to do this which would be efficient and good.

or because people who really needs it use forge essential core or mine, which both does that exact features, were probably both just too lazy to actually implements it in forge

  • Quote

Share this post


Link to post
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.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • saxon564
      [1.14.4] [UNSOLVED] Server Thread Freezes After Entity Explodes

      By saxon564 · Posted just now

      OK, I will add that to my list of things to address. For now though, can we focus on the issue I made the post for?
    • plugsmustard
      on/off button for custom furnace

      By plugsmustard · Posted 6 minutes ago

      these ones?     public static void encode(PacketButtonClicked msg, PacketBuffer buf) { buf.writeBlockPos(pos);  }
    • J0WAY
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY · Posted 8 minutes ago

      I'm still kinda new to coding mobs so if you could show me an example on how to do it that would be amazing!.
    • Draco18s
      on/off button for custom furnace

      By Draco18s · Posted 14 minutes ago

      Look at the parameters that are passed to you.
    • thedarkcolour
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour · Posted 33 minutes ago

      I got it to work by not calling getWorld() and using IWorldGenerationReader#setBlockState, thanks!
  • Topics

    • plugsmustard
      39
      on/off button for custom furnace

      By plugsmustard
      Started Wednesday at 03:11 PM

    • J0WAY
      6
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started 19 hours ago

    • thedarkcolour
      18
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour
      Started Yesterday at 06:04 AM

    • saxon564
      4
      [1.14.4] [UNSOLVED] Server Thread Freezes After Entity Explodes

      By saxon564
      Started 11 hours ago

    • JetCobblestone
      7
      [1.14] layout of a modpack

      By JetCobblestone
      Started 22 hours ago

  • Who's Online (See full list)

    • LorenzoPapi
    • Nuparu00
    • Yanny7
    • plugsmustard
    • Fifou_BE
    • saay aaa
    • tomatoBhutan
    • DragonITA
    • J0WAY
    • saxon564
    • EULTI
    • Draco18s
    • gokupro35442
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Is it possible to add information or description to an item?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community