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

    • Crysyn

      Only help if you can be helpful

      Hey All, A topic has come up of late in the IRC channel in regards to the general feel of the forums and the community that supports them. Things have progressed further than I would have liked with out this being addressed more publicly because I would much rather have snubbed this out sooner rather than later.. but I have been busy. Here is the general rule I would like people to follow: Wheaton's Law "Don't be a dick." Those of you from the IRC channel know that this is the only rule I ask people in there to follow and we generally have a good and lively time chatting about all manner of things. This is basic rule that just about everyone understands and I am going to expand it to the forums from here moving forward. If you can not help people in a helpful and polite manner then I simply ask you to stop. Now I generally take a back seat to moderating the forums as I like to participate in the suggestions forum fairly heavily at times and would rather do so as a forums user than a moderator. But I am also fairly well known for being the person who constantly puts their foot down and so I am stepping up and doing so on here. If you find yourself unable to respond to a message politely then I ask that you do not respond. This mostly focuses on the increasing level of hostility found within the Suggestion forum as well as the Server forum. I do not care if this is the 30th some odd time you have seen someone make the same suggestion. Or even if the new post on an older topic is one entry above the old one. I expect the members of this forum to respond politely to the user, new or old, and point to the older topic if it applies and even go the extra step to suggest they either add in new information or to summarize the outcome of the previous discussion based upon the new post's entry into it. That is what we are here for, that is why I close most topics instead of deleting them, so that they can be found and referenced down the road. The next topic is the slew of derailment attempts I have seen as of late. If you want to have fun and joke around that is what the off topic forum is for and pretty much anything goes there. I do not expect to read a suggestion thread and have to go through 3 pages of image memes people have shot back and forth. Quite simply this is a waste of my time to read and then have to clean up. Now for the summary. I am going to start taking a more active role, especially in policing the suggestion forum, and handing out warn levels to people whom I see doing this. These will be indiscriminate and applied not to just the first person who derails or is impolite on a topic or response, but to everyone whom follows the lead of that person. As I do not like doing things with out giving you all warning this post shall serve as that warning. If you have a desire to bring this topic up with me then I invite you to do so on the IRC channel. Lets raise the level of quality and grow the community. Let us not descend into the quality often found on the minecraft or league of legend forums. There is simply no need for that here. Be passionate about things, just do not be abusive.
    • Kittychanley

      Offline Servers

      Recently I've seen a few server listings showing up on the first page of the Servers forum that have been closed for an extended period of time, but have recently gotten a reply from a new member who didn't realize the server is offline. To help prevent this from happening in the future, it would be greatly appreciated if you could use the report function on the original post of any servers that have been confirmed as offline, so that the topic may be locked. If you are the admin of a server and plan on taking the server offline, please use the report function on the original post of your topic to let the TFC Staff know that the topic should be locked. If you are the admin of a server that has a locked topic, and would wish to bring the server back online, please use the report function on the original post of the topic to let the TFC Staff know that the topic should be unlocked. As always, please remember to follow rule #3 of the servers forum and update your topic title to contain the version of TFC that the server is currently running. You can do so by editing the OP, and then clicking on "Use Full Editor."
Sign in to follow this  
Followers 0
Peffern

TFC Crop System Expansion

16 posts in this topic

So, as part of TerraFirmaPumpkins, I had to use ASM to alter some parts of the TFC crop code which were hardcoded to only work with the 18 built-in TFC crops. I realized the other day that an extensible system for adding crops might be a good thing to have so that a) multiple people can add crops without worrying about ASM conflicts, and b ) people don't have to worry about crop IDs.

I figure this will mostly be useful for other addon developers who want to add crops without worrying about compatibility – I'm adding another layer of abstraction over the TFC crop system so people can just call into the registry to add crops without bothering with ASM at all.

Does anybody have any other ideas I should include / criticism / questions?

I'm currently testing it and it will probably be available some time in the next week or so.

0

Share this post


Link to post
Share on other sites

Bless you.  I wish I had some grand suggestion but all I can do is thank you for making this possible.

0

Share this post


Link to post
Share on other sites

Okay I have a trial version available on GitHub: https://github.com/Peffern
It seems to work reasonably well, let me know if it does what you want.

0

Share this post


Link to post
Share on other sites

You are a wonder!

O.k. here come the noob questions....

 

1.after i run setup and point eclipse to the working folder:

 Do I add your packages to my mod project folder via copy and past,

or

do I just add your project folder to my project eclipse workspace along with my own?

or

is it better to use it as an independent mod in its own eclipse work space?

next

in BaseCrops it says:

"If you just want to implement a crop so that it works with TFC, use this implementation."

in read me it says "

The entry point for TFC Crop Index is the static method CropsRegistry.addCrop(). This method accepts as an argument an ICrop instance, which is how you define the crop you want to add. The registry will use information from the ICrop to create a new TFC crop with the appropriate parameters, as well as creating a seed item with the appropriate crop ID

"All of the parameters are in the constructor, so you should be able to just pass in a load of values and then pass the BaseCrop to the CropsRegistry.

If you want to change the rendering behavior you can override the appropriate method.

Reflective pass-throughs to TFC's crop rendering utility methods are static on RenderCustomCrop, so you can use them.

In practice this means you pass a bunch of parameters to the BaseCrop constructor, pass the result to the CropsRegistry, and the mod handles it from there"

 

So to create a new crop I would edit  BaseCrop?

i so i decide to give my crop the number  3654  (so it is unlikely to conflict with other crop indexes from other people then in BaseCrop,java ....

Edited by Dulakaba
0

Share this post


Link to post
Share on other sites

First of all, you probably shouldn't post code in the forums. Use pastebin or something for the formatting.

Secondly, I apologize for being unclear. You don't need to download or edit my code (unless you want to) – instead you should just be able to use my .jar file (the mod itself).

Here's how I would do it:
 

1. Download the compiled jar (tfccrops.jar).
2. Import it into your mod project (into the libs folder). 
3. Make sure you configure gradle to know about the tfccrops.jar or your code won't compile when you go to export your mod.
4. Add the jar to your project as a dependency jar. 
5. In your item setup area, execute the following code:

 

String[] icons = new String[]{tfcs:plants/crops/Nrustica (1),//and all other growth};
ICrop crop = new BaseCrop("ItemNRusticaPlant",2,36,icons,8,0.9F,2,new ItemStack(ItemNRleaf,5),"NRseeds","tfcs:plants/seeds/NRSeeds","Mapacho");
Item seeds = CropsRegistry.add
Crop(crop);

Then make sure the seeds item gets saved to somewhere. If you look at my code in TerraFirmaPumpkins and TFC with IE Hemp, you can see how I did this.

The point of this system that I made is that you don't need to worry about the IDs or rendering at all – the subsystem handles it for you. You don't need to look at the internals of BaseCrop or CropsRegistry at all. If you *do* want to change how BaseCrop works, you should subclass it instead of editing the original.

Also, I forgot to provide the link to the compiled jar: here it is:http://www.mediafire.com/file/t4dcd1ltnk150ka/%5B1.7.10%5Dtfccrops-1.0.jar

EDIT: Im finding some bugs – remember this is still experimental.

Edited by Peffern
0

Share this post


Link to post
Share on other sites

Thanks,

I think I know how to do all you mentioned:

1. Download the compiled jar (tfccrops.jar).DONE
2. Import it into your mod project (into the libs folder). DONE
3. Make sure you configure gradle to know about the tfccrops.jar or your code won't compile when you go to export your mod. (Done in gradle.build? I think that's right but I figure i would ask to make sure.
4. Add the jar to your project as a dependency jar. Done via buildpath / configure buildpath/ libraries 'add external jar'
when you say item set up area you mean in a new item class for the plant file rather than where i register items? So not in the file where I use     public static Item itemZombieDust;: and itemZombieDust = new ItemZombieDust().setUnlocalizedName  and GameRegistry.registerItem(itemZombieDust,itemZombieDust.getUnlocalizedName(),etc... right?

 

looking at your files for  TerraFirmaPumpkins and TFC with IE Hemp to get some insight.

Sorry for all the question.

0

Share this post


Link to post
Share on other sites

You should do it in the same file where you set up your items

so you should have a bunch of calls to GameRegistry.registerItem()

IN the same general area, you should call the CropsRegistry.addCrop()

0

Share this post


Link to post
Share on other sites

Thanks,

I appreciate you taking the time to field my questions. If you like, when I get it all figured out i will do a video tutorial.

0

Share this post


Link to post
Share on other sites

No problem – if you're still confused, look at TFC with IE Hemp Plants, it's a simple one-class mod that demos how to use the Crops Registry.

0

Share this post


Link to post
Share on other sites

Hi again, 

So I thought I had everything ready to go. but I think i have somehow missed something.

I think I missed a point of setting up. 

I downloaded the jar, put it in my lib folder in my tfcshaman project, right clicked my project and selected buildpath - configure build path - chose the 'Libraries' tab,, chose add external jar and then navigated to the lib folder in the src folder of my project and selected your jar.

having done that Eclipse added the your mod's little jar icon to the bottom of the jar list in my project ( there are many jar icons and then your jar below  a folder icon with 3 zeros labeled 'start' (that has some gradle stuff in it and a cache)

if I click the jar icon named after your jar, it has all your packages in it (com.peffern.crops etc.). 

I have made no changes to build.gradle  since I must study how to configure gradle to know about the tfccrops.jar and I assumed that could wait until I was ready to do the jar build.

when I run the game in eclipse  it starts minecraft, begins the loading process and then crashes. here is the crash report

Minecraft Crash Report

any insight as to why?

after more investigation  I see this in the console after crash:

Caused by: java.lang.NoSuchMethodError: com.peffern.crops.BlockCustomCrop.func_149676_a(FFFFFF)V
                      at com.peffern.crops.BlockCustomCrop.<init>(BlockCustomCrop.java:26)

 

The line in BlocCustomCrop that it refers to is:

        this.setBlockBounds(0, 0, 0, 1, 0.2f, 1);

Edited by Dulakaba
0

Share this post


Link to post
Share on other sites

Oops - this one's on me. You should be using the deobf jar, not the regular jar, for development. I have added deobf jars to the Mod-Jars repository.

0

Share this post


Link to post
Share on other sites

o.k. I have got the deobf.jar, do I add that to the lib folder  the same way I added your jar?

That just tells me i have dupilicates

Edited by Dulakaba
0

Share this post


Link to post
Share on other sites

Actually it appears the issue is based in how I set up my mod in Bletch's template.  

Previously I had coded my mod in vanilla 1.7.10 and then  did a  lot of copy and paste of packages and classes from the vanilla forge eclipse work space into a new  TFC eclipse work space made with Bletch's tutorial.  I had basically just deleted all Bletch's mod template files under source/main/java ,  and source/main/resources and then put in my own packages, classes and resources in the appropriate locations to make a copy of my vanilla mod.  Everything worked fine for my vanilla coding. However clearly somewhere in this I deleted something in his template that hooks into  tfc in such a way as to make your api get recognized. I went back and redid the Bletch tutorial and set up in a fresh copy of eclipse, made all the name changes needed for a new  add on project  and then put in your plant add on jar in the lib folder. After pointing eclipse to your jar it all loads.

I either need to find out what I cut out from Bletch's Template or else start the tedious process of  moving everything over to his template. This is a big problem as I did my coding based on the tutorials by MrCrayfish and his overall structure / approach is to do things mostly in the main class file where as Bletch has so many packages that I can barely make heads or tails of it.

My assumption is that your IE hemp mod and Pumpkin mod MUST have the same code type that I cut from Bletch's template and I am hoping that a hard study of them will help me figure out what I am missing.

0

Share this post


Link to post
Share on other sites

Well, as long as its working then I guess you're good to go.

0

Share this post


Link to post
Share on other sites

So I still can't get it to go I thought it was working but then it did not... 

The weird thing is that  I downloaded your IE Hemp project,  unzipped it, ran setup.bat and then imported  it in Eclipse and when I run it , it gives me duplicate file warning for  tfccrops because of the tfccrops-dobf. If I remove tfccrops-dobf, it get the same error as on my project.  " cpw.mods.fml.common.LoaderException: java.lang.NoSuchMethodError: com.peffern.crops.BlockCustomCrop.func_149676_a(FFFFFF)V "

I am really at a loss because this is your Github project. What method do you use to run it without getting dup error  and what method do you use to set up the files in lib

Also what version of Eclipse are you using?

I tried it with just having the files in lib and also with  buildpath / configure buildpath/ libraries 'add external jar' and selecting the lib folder

Edited by Dulakaba
0

Share this post


Link to post
Share on other sites

Just wanted to take the time to thank Pefffern for all the help tracking down my issues and helping a new modder. We are lucky to have peffern and I want to make clear that all issues have been cleared up.

Thank you for all your work to help us modders make our TFC plant dreams come true!

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0