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

Code sample for referring to TFC Blocks/Items

4 posts in this topic

Hey folks.  I am playing with writing a tfc-centric mod for allowing the creation of road blocks.  I am not a java person -- though when they finally rewrite Minecraft in Perl, I'll be all over it.

Anyway, I am having an issue with creating crafting recipes that use the TFC dirt types.  I can create recipes using the standard blocks, but have not figured out how to refer to blocks that are from a different mod.

I cheat on my own server by creating the recipes in MineTweaker, but that's really not appropriate, if I want to share the mod here.

Does someone have a code-snippet that they would be willing to post, that shows the proper syntax to refer to the blocks/items that are loaded by TFC?

 

Thanks in advance.

Edited by eogen
0

Share this post


Link to post
Share on other sites

We've actually got our dirt blocks specifically registered in the ore dictionary. So you would just do it like any other ore dictionary crafting recipe with the string "blockDirt"

Here's the class that we register all of our recipes in:

https://github.com/Deadrik/TFCraft/blob/master/src/Common/com/bioxx/tfc/Core/Recipes.java

You'll want to either do addRecipe for normal, shaped recipes. addShapelessRecipe for normal shaped recipes, or for ore dictionary recipes you'll use addRecipe(new ShapedOreRecipe or addRecipe(new ShapelessOreRecipe

Edit: In order to refer to our blocks and items directly, you'll need to include our mod in your workspace and then import the TFCItems and TFCBlocks classes into the class you are referencing them in.

Edited by Kittychanley
1

Share this post


Link to post
Share on other sites

 

Thank you for the quick reply.  If I knew anything about java other than what I have learned poking at this mod, I am sure what you said would make perfect sense. 

3 minutes ago, Kittychanley said:

We've actually got our dirt blocks specifically registered in the ore dictionary. So you would just do it like any other ore dictionary crafting recipe with the string "blockDirt"

If I am understanding this properly, if I refer to 'dirtblock' in the dictionary -- that would allow me to treat each type of dirt as the same thing.  However, since TFC has a dozen different dirt textures, if I want to have a 'limestone dirt road' made from limestone dirt, and looking like limestone dirt, I cannot use the dictionary.  (Is this correct?)

 

I'm not looking for a Java tutorial, I don' t want to be that sort of burden, but when looking at your Recipe.java code, which I imported into Eclipse, I get compile time errors when trying to refer to things that will be created at run-time from it. (Sorry if I am using the wrong terminology.)  This is why I was hoping someone had a simple sample, so I could see the proper includes, and syntax.

Thanks again.

0

Share this post


Link to post
Share on other sites

That's correct. "dirtBlock" is if you want a recipe to be able to use any kind of dirt block and have the same end result. That way you don't have to make 21 different recipes that all output the same item. If you want to do "limestone dirt road" then you'll need to use TFCBlocks.dirt or TFCBlocks.dirt2 and the metadata/damage value that corresponds to limestone. You can use our global constants file to figure out which metadata goes to which stone type: https://github.com/Deadrik/TFCraft/blob/master/src/API/com/bioxx/tfc/api/Constant/Global.java#L46

Granite will be 0, Diorite will be 1, Shale will be 4, etc.

You are going to need to include all of the TFC source code in your workspace if you want to refer to our blocks directly. I gave you the link to the Recipe.java file so that you could read it and look at examples, not so you would copy it directly into your workspace. There's a bunch of different ways you can do crafting recipes, and that file has examples for pretty much all of them.

0

Share this post


Link to post
Share on other sites