Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Dries007

      ATTENTION Forum Database Breach   03/04/2019

      There has been a breach of our database. Please make sure you change your password (use a password manager, like Lastpass).
      If you used this password anywhere else, change that too! The passwords themselves are stored hashed, but may old accounts still had old, insecure (by today's standards) hashes from back when they where created. This means they can be "cracked" more easily. Other leaked information includes: email, IP, account name.
      I'm trying my best to find out more and keep everyone up to date. Discord (http://invite.gg/TerraFirmaCraft) is the best option for up to date news and questions. I'm sorry for this, but the damage has been done. All I can do is try to make sure it doesn't happen again.
    • Claycorp

      This forum is now READ ONLY!   01/20/2020

      As of this post and forever into the future this forum has been put into READ ONLY MODE. There will be no new posts! A replacement is coming SoonTM . If you wish to stay up-to-date on whats going on or post your content. Please use the Discord or Sub-Reddit until the new forums are running.

      Any questions or comments can be directed to Claycorp on either platform.
TaeoG

Implementing ISize

7 posts in this topic

How does one go about properly implementing the size and weight mechanics on custom items? I've got it working fine on items that extend ItemTerra, but on other items simply implementing the interface and returning the proper Enums doesn't give any results.

 

Best I can tell the rendering of the information is called in the addInformation method in the ItemTerra class, but Eclipse refuses to tell me if that method is ever called by anything, so I'm super confused as to how this is implemented. I assume it's also important for determining if an item will fit in a chest, but I haven't gotten around to looking into that yet.

 

Any help would be appreciated, thanks in advance.

Edited by TaeoG
0

Share this post


Link to post
Share on other sites

addInformation is a vanilla method that renders the tooltip. That's what is going to display the size and weight information. If you dig through it, ItemTerra also should have a method in it that's using the size and weight to determine stacksize as well. As for fitting in chests or not, TFC containers already have specific size requirements and limitations. If your item implements ISize and you did the correct enum to set it to Huge for example, you won't be able to put it in a chest.

Edited by Kittychanley
0

Share this post


Link to post
Share on other sites

see, I thought for sure it was a vanilla method, yet Eclipse got mad at me when I used the @Override tag. I was able to cram a "Huge" item in a chest too, so maybe I've done something wrong. I'll take another stab.

Edited by TaeoG
0

Share this post


Link to post
Share on other sites

Is your item class extending the vanilla Item class?

0

Share this post


Link to post
Share on other sites

whelp, this is what happens when you code late at night. I was trying to implement it on a Block, not an Item. I've yet to figure out how to link an Item with its block representation when they're separate classes, but yes I was able to get an item to render properly and refuse to fit in a chest.

0

Share this post


Link to post
Share on other sites

ahhhh, I had forgotten that GameRegistry.registerBlock had an option to take an ItemBlock. Thanks a lot for your help, slowly but surely this is coming together

 

Posted Image

2

Share this post


Link to post
Share on other sites