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

ModTweaker 2 TFC module by 3TUSK merged

19 posts in this topic

3TUSK has done a PR for a TFC module in modtweaker 2 which has now been merged. It is part of the 2.0.8 release available Here. There isn't any documentation that I've found as yet, so I've gone through the code to sort out syntax as best I can. Below is what I got from the code and will update expand on the information as I figure it out. Please let me know anything you find/verify etc and I'll add it to this initial post.

The Anvil syntax is the one I'm the most unsure about.

Anvil

Crafting

Add

mods.tfcraft.Anvil.add(Input 1, Input 2, Plan, int value, Flux (true/false), int req, Output);

Ok so I've sorted out a bit of this. For the Input 2 you can put null if there is only 1 input material. The int value which you currently do have to input can be between 1-150, but be aware that you'll have to be sure it is in a spot that means that it will be possible. For plans you need to bracket it with " " so "axe".

Plans

"sheet", "ingot", "pickaxe", "shovel", “axe”, “hoe”, “hammer”, “chisel”, “propick”, “saw”, “sword”, “mace”, “scythe”, “knife”, “javelin”, “helmplate”, “chestplate”, “legsplate”, “bootsplate”, “bucket”, “refinebloom”, “splitbloom”, “tuyere”, “trapdoor”, “grill”, “shears”, “oillamp”, “hopper"

So input 1 is the main slot you use for crafting in the Anvil, e.g. ingot for axe. Input 2 is the secondary input, such that you would need for shears or trapdoor. I'm not sure what to use for the integer value, Kitty indicated that this is likely the red arrow, but how these work exactly is unclear. It may be that these must be hardcoded for the modtweaker 2 added recipe rather than depending on seed, generation time etc that has been introduced/fixed for build 18 (I think it isn't fixed in 17). It would be worthwhile testing if this could be left out and the script still function. The integer required is referring to the tier of anvil as there is the following comment

/** For parameter <code>req</code>:<p> 1==copper;<p> 2==bronze;<p> 3==Wrought Iron;<p>* 4==Steel;<p> 5==Black Steel;<p> 6==Red Steel;<p> 7==Blue Steel;<p> default is stone.
There is an error in this information, in that there is no value 7, 6 applies to both Red and Blue Steel.

Remove

mods.tfcraft.Anvil.remove(Output Item);

This did work as expected, although you do need to restart client to undo this change.

Weld

Add

mods.tfcraft.Anvil.addWeld(Input 1, Input 2, int req, Output Item);

As far as I can tell the inputs must get the Weld tag based on the temperature (which is NBT data). So I believe that it is necessary for the inputs to be either TFC items that can get weld in the tool tip

Remove

mods.tfcraft.Anvil.removeWeld(Output Item);

I don't believe this works. Can anyone confirm. Tested this script

mods.tfcraft.Anvil.removeWeld(<terrafirmacraft:item.Wrought Iron Double Ingot>);
Barrel

Add

Item Recipes

mods.tfcraft.Barrel.addSealed(Input Item, Input Fluid, Output Item, Output Fluid, Time, Tier, Remove Fluid true/false, allow any stack true/false);

mods.tfcraft.Barrel.addUnsealed(Input Item, Input Fluid, Output Item, Output Fluid, Time, techLv, Remove Fluid true/false, allow any stack true/false);

/*** @param outputFluid If you want this recipe consume fluid, <code>outputFluid=inputFluid</code>* @param time How long the recipe finished. Unit is TFC hour.* @param techLv Set to 0 if you want vessel to be able to use your new recipe, otherwise you will set to 1* @param removeFluid Set false if there is special need* @param allowAny By default it is <code>true</code>*/
Fluid Recipes

mods.tfcraft.Barrel.addFluidtoFluid(Fluid in Barrel, Input Fluid, Output Fluid);

Edit: I've sorted out how to properly script barrel recipes. The first tip is to use /mt liquids command to output the fluid registry items to the minetweaker.log. For example limewater is liquid:limewater. Now to delineate the amount of fluid for recipes you need to add a "* #". The units are mb. So <liquid:limewater> * 1000 is a bucket of limewater. Now here is the part that tripped me up. The input fluid is obviously input, but the volume you provide here is the minimum volume for the craft. The output fluid field depends on if you set the consume fluid to true or false. If true then the volume provided in output (use same liquid as input) is the amount consumed per craft. So you can have minimum volume be higher than the liquid consumed, like we see in pickling. If consume is false the volume provided in output is the amount of fluid produced in the craft.

I have not tried every iteration, but this should give you enough to sort most things out.

Remove

mods.tfcraft.Barrel.remove(Output Item);

mods.tfcraft.Barrel.remove(Output Fluid);

Quern

This syntax is correct and works for both adding and removing recipes. Removing recipe removes all recipes that produce that product. There is a bug where if you remove a recipe and then try and reverse that change it won't work and if you try and look at recipe with NEI you crash. You must first restart the client.

Add

mods.tfcraft.Quern.add(Input Item, Output Item);

Remove

mods.tfcraft.Quern.remove(Input Item);

Loom

Add

This is the correct syntax for this.

mods.tfcraft.Loom.add(Input Item, Output Item, resource location);

Resource location is the location of the resource file it is using so "terrafirmacraft:textures/blocks/String.png" (quotes required) for the string texture. Item stack for input determine how many items need to be placed before you can complete the craft.

Kiln

Add

This will not work unless the item is an instance of ItemPotteryBase class, but the syntax is:

mods.tfcraft.Kiln.add(Input Item, lv, Output Item);

No idea what lv is but it is an integer value.

Remove

This should work...I think.

mods.tfcraft.Kiln.remove(Output Item);

Firepit, Forge, Grill and Blast Furnace

Kitty informed me that the Heat module should work for more than fire pit.

Add

mods.tfcraft.Heat.add(Input Item, Specific Heat, Melt Temperature, Output Item);

You'll want to set your specific heat to 1 which means your input will heat 1C/tick until it gets to the melt temperature.

The melting temperature is in degrees centigrade.

/**	 * To add custom recipe in firepit, use this.	 * @param input The input itemstack	 * @param sh "Specific Heat", which means the multiplier of increasing speed of temp (by default the speed is 1C/gametick)	 * @param mt "melt temperature"	 * @param output The output itemstack when the item reach the certain temperature	 * @see com.bioxx.tfc.Core.ItemHeat	 */
1

Share this post


Link to post
Share on other sites

The version conatining this has been realeased, modtweaker 0.8.0. There is a slight problem I've noticed with the heat module, and that is that it does not use metadata

0

Share this post


Link to post
Share on other sites

Form looking at the code and talking to Kitty the person is fairly new to TFC so some assumptions were made. Hopefully with help it can be polished up to work. He also believes that the TFC recipes can't handle ore dictionary values, don't know if this is true or not.

0

Share this post


Link to post
Share on other sites

It is correct that currently the kind of recipe that we offer ore dictionary support for is crafting recipes. It would take a lot of work in order to implement native ore dictionary support for anvil, quern, barrel, etc. recipes so don't expect it to be added until TFC2 or possibly not even at all.

 

However, I think it should be possible for modtweaker to add in the ore dictionary support themselves, and just use the ore dictionary to get the itemstack before passing it as a parameter to the recipe constructor. I may be wrong on this, but from what I see for the ore dictionary code it should be doable.

0

Share this post


Link to post
Share on other sites

The way the TFC recipes work there isn't a huge issue with ore dictionary support being lacking. It is only the anvil that has 2 input slots (if you wanted to be able to weld 2 different mods ingots). For other things you can just do a for loop to iterate an ore dictionary value. It makes NEI a bit messy, but it works without a lot of extra code.

0

Share this post


Link to post
Share on other sites

Anvil code is a little messy right now. "int value" does indicate the location of the red arrow, and it is not randomized. Also keep in mind that these recipes assume that the item will not inherit damage from the process and making them only increases general smithing ability. It also doesn't seem that one can actually create their own plans with this. I am curious if it has been tested if adding anvil recipes actually works due to this. You may be able to override another plan for your item, though.

 

Barrels are complicated, but it seems that specific fluid/item output amounts cannot be set, and are simply relative to the amount of output and weather or not remove fluid is true.

 

Quern code on the modtweaker2 side is a bit sloppy, and the error is probably due to concurrency handling. I will see if I can contact 3TUSK to figure it out.

 

For kilns, I see no dependency of the kiln recipe on inheriting ItemPotteryBase. Spindles aren't.

 

Finally, a TFC Deobf jar is included in the libs folder. Is this okay? I have been searching for a way to make everything work without it for my own addon, with no luck.

0

Share this post


Link to post
Share on other sites

Anvil code is a little messy right now. "int value" does indicate the location of the red arrow, and it is not randomized. Also keep in mind that these recipes assume that the item will not inherit damage from the process and making them only increases general smithing ability. It also doesn't seem that one can actually create their own plans with this. I am curious if it has been tested if adding anvil recipes actually works due to this. You may be able to override another plan for your item, though.

 

Barrels are complicated, but it seems that specific fluid/item output amounts cannot be set, and are simply relative to the amount of output and weather or not remove fluid is true.

 

Quern code on the modtweaker2 side is a bit sloppy, and the error is probably due to concurrency handling. I will see if I can contact 3TUSK to figure it out.

 

For kilns, I see no dependency of the kiln recipe on inheriting ItemPotteryBase. Spindles aren't.

 

Finally, a TFC Deobf jar is included in the libs folder. Is this okay? I have been searching for a way to make everything work without it for my own addon, with no luck.

 

I'm assuming you're not the person who made the PR? You should be telling them the changes if you aren't. All Bunsan is doing is saying somebody made a PR, and attempting to document off of it.

 

https://github.com/jaredlll08/ModTweaker2/commit/c757841e06359800b3354924febf84bf15fd2158

 

PlanRecipe is in the API, and you can use it to register your own plans. Don't know why the guy didn't include it in his modtweaker stuff.

 

Barrel input and output amounts are based off the stacksize of the fluidstack that you pass. Actually, pretty much everything that has ratios is based off of stack sizes.

BarrelManager.getInstance().addRecipe(new BarrelMultiItemRecipe(new ItemStack(TFCItems.Jute, 1, 0), new FluidStack(TFCFluids.FRESHWATER, 200), new ItemStack(TFCItems.JuteFibre, 1, 0), new FluidStack(TFCFluids.FRESHWATER, 200)).setMinTechLevel(0));

200 mB FRESHWATER input for 1 jute item input, gives 1 jute fiber output and uses 200mB FRESHWATER

If there's no pottery dependency, than let the guy know because he claimed that there is in his documentation in the commit.

 

Your final released addon should not include any TFC code in it. You should be able to edit your .jar file, and remove all of TFC's deobf code and API and the addon will still run alongside TFC.

Edited by Kittychanley
0

Share this post


Link to post
Share on other sites

I am not 3TUSK, but I have attempted to contact him and linked him to this post. If I get a response I will communicate all of this.

0

Share this post


Link to post
Share on other sites

I plan on testing anvil and barrel recipes tonight. Once I have that done I'll be submitting issues to explain the bugs/problems I've found.

0

Share this post


Link to post
Share on other sites

Well, here is 3TUSK.

I received the email from #6, and then I read the whole thread carefully.

 

First of all, appreciation to everyone who gave me comments!

 

I want to talk about what's going on currently.

Now I am working on adding anvil plan and knapping support, as well as fix things mentioned in feedback above.

 

Now there is a check in mods.tfcraft.Kiln.add

if (toStack(input).getItem() instanceof ItemPotteryBase)		MineTweakerAPI.apply(new AddRecipe(new KilnRecipe(toStack(input), lv, toStack(output))));		else			LogHelper.print("Fail to add new recipe, " + input.getDisplayName() + " is not a pottery stuff!"); 

also added more choices for anvil recipe adder.

 

Beside, I have some questions:

1.Can TFCraft API provide some methods to remove certain recipe (e.g. quern, barrel and anvil) in the future?

2.There are some constructor method in AnvilRecipe which has no output parameter. What are the purpose for them?

0

Share this post


Link to post
Share on other sites

1. You are welcome to submit a PR for them. They are not a priority for us right now.

2. The constructor without an output is used when we update the recipe in the anvil interface. It is an internal constructor and there's no reason for anyone to use it for registering a new recipe.

0

Share this post


Link to post
Share on other sites

Ah glad you found this thread. First thanks so much for doing this PR. I can only help so much with code, but will test things for you to the best of my ability. It may take a while to respond, but I do scan back in irc channel. There are a few of us making modpacks that I'm sure would be happy to help; so feel free to throw any builds at us there to test. I'll also see if I can come up with any other things that could be helpful to add. Thanks again.

0

Share this post


Link to post
Share on other sites

Actually I also want to talk about the origin why I made this PR, since the reason is related to modpack creating.

 

Last October, I started working on a modpack which aims to integrate TFCraft and GregTech together, as well as some other tech mods like AE2 and Railcraft.

OreDict has been supported, but due to TFCraft, GT's tech-tree broken, which cannot be fixed by simply add regular 3x3 crafting recipes.

After carefully considering about it, I believe that provide MineTweaker support for TFCraft will be the best solution to solve this problem. In another word, let GT tech-tree adjust TFCraft.

It took me a lot of time studying and working on that, but now we have somewhat progress.

Just share some story :)

(welcome to provide idea(s) about modpack)

0

Share this post


Link to post
Share on other sites

As Bunsan said, there are a few modpack compilers, and I am willing to help test to weed out bugs. Thank you for this PR

0

Share this post


Link to post
Share on other sites

Best of luck getting unification to behave. I tried and gave up and went with Mek. Well I'm glad you made it because I'll certainly put it to good use of it. Well once the Mek module gets fixed.

0

Share this post


Link to post
Share on other sites

Updated my OP with more info from testing.

@3TUSK would you prefer things be put through ModTweaker repo issues or report them here?

0

Share this post


Link to post
Share on other sites

@Bunsan 

I suggest put things here. This module is still new born.

 

Edit 1: Also, it should be better that I add more javadoc in my code, isn't it?

 

Edit 2: As for that removeWeld(IItemStack) doesn't work, I found the reason and fixed it. There are still lots of work to do, and I hope the next PR is coming soon...

Edited by 3TUSK
0

Share this post


Link to post
Share on other sites

I've added more info to barrel script info. Also be aware that there is a bug in the fire pit/forge code. I believe it is trying to register the input item in the heat index every time you /mt reload. So you'll get modifications stuck warning after you first load those scripts. I'm seeing if I can find a fix. Or find a person who can fix. The items being cooked also don't have a heat tooltip.

0

Share this post


Link to post
Share on other sites