0
\$\begingroup\$

I want to have a new Recipe with crafttweaker, which using machines from the create mod, for Netherrack like this Compacting Netherrack Im playing Mc 1.16.5

At the moment I tryed this code in \scripts\MyRecipes.zs:

import crafttweaker.api.registries.IRecipeManager;

<recipetype:create:compacting>.addRecipe("compact_netherrack", "none", [<item:minecraft:netherrack> * 8], [<item:minecraft:cobblestone> * 8, <item:minecraft:nether_wart>], [<fluid:minecraft:lava> * 10], 100);

but when I go into the world I get this errors:

[Error] Parser Exception @ MyRecipes.zs:3:0 : No such member: addRecipe
[Error] Scripts are invalid!

can somebody help me?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The error text is telling you that it does not have the method addRecipe, or at least the system is unable to find it.

The Create Compacting article says:

The Compacting mechanic is a type of IRecipeManager and implements all the methods that are available to IRecipeManager's, such as removeRecipe() and removeAll().

We can confirm that IRecipeManager does not have an addRecipe method.

So we want some type that extends IRecipeManager, adding some things, presumably adding the missing addRecipe. Sadly the article quoted above does not say the name of the class we need. It only refers to it as "The Compacting mechanic".

Searching for <recipetype:create:compacting> I found CompactingManager, which lists among its methods addRecipe.

So, I believe you need to import CompactingManager:

import mods.create.CompactingManager;
\$\endgroup\$
3
  • \$\begingroup\$ the wiki say that add Recipe should work (docs.blamejared.com/1.16/en/mods/Create/Compacting) when i use the CompactingManager the same error and "could not find mods.create.CompactingManager" comes I have added that I'm playing minecraft 1.16.5 maybe there are diffrents \$\endgroup\$ Jun 10 at 13:42
  • \$\begingroup\$ @opensource25 I don't know if it is a version issue, but I doubt that is the case. How about the CreateTweaker the wiki mentions on the red box at the top, do you have that installed? \$\endgroup\$
    – Theraot
    Jun 10 at 14:04
  • \$\begingroup\$ @opensource25 It appears that it is possible to do the same thing with addJSONRecipe (except addRecipe seems to be meant to provide a friendlier API), but since addJSONRecipe is in IRecipeManager I'd expect it to be less problematic. Also I found a discord where I believe you could try asking: discord.blamejared.com - hopefully you find the solution, I would like to encourage posting it as it might help other people searching for it. \$\endgroup\$
    – Theraot
    Jun 10 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .