Roots

Roots

24M Downloads

Mortar recipes support "null" in CraftTweaker Zenscript

RisingInIris2017 opened this issue ยท 4 comments

commented

Describe your suggestion:

Now when we write a Roots Mortar recipe like this:

Mortar.addRecipe(*3,
[
       <mysticalworld:copper_ore>,<mysticalworld:copper_ore>,null,null,null
]
);

It is syntax correct, but will do nothing when you put 2 copper ore into Mortar and try to grind them.
My suggestion is to make Mortar recipe adding method support "null", so that we can put any number of materials into custom recipes as inputs.
Describe alternatives you've considered:
If this is difficult for devs to do so, maybe you can just disable "null" in Mortar recipe adding method.
For example,

Mortar.addRecipe(*3,
[
      <mysticalworld:copper_ore>,<mysticalworld:copper_ore>,null,null,null
]
);

will throw an CraftTweaker exception and write some information into crafttweaker.log.

commented

Okay, so the issue isn't so much to do with nulls, but to do with the fact that the mortar was originally only designed to support spell recipes, which are specifically recipes of 5 ingredients. It was additionally modified to support recipes with 5 ingredients that just do general crafting rather than generating a specific type of spell dust.

This system was then extended to allow for processing-style recipes: you create a recipe with 1 ingredient, and it automatically creates recipes for 1, 2, 3, 4 and 5 ingredients, modifying the output accordingly (so if the original output was an itemstack with a count of 2, you would get 2, 4, 6, 8, 10 respectively).

Thus, it's only really designed to cope with 5 ingredients. Obviously I'm failing to clear out nulls, as there's already code in place to specifically say "hey, it has to be 1 or 5 ingredients".

I think what you're trying to do is ore duplication: 1 ore = 1.5 dust.

I'm not sure how to best go implementing this code-side. It's possible that I could specify a fractional/decimal float value for the output where one ore has a 50% chance of an extra, and 2 ore has a guaranteed chance of 3, and 3 ore has a guaranteed 4 ore and a chance of 5, and so-on.

I'll need to consider it further, but I'll definitely strip out nulls when checking for valid quantities of ingredients. I forgot that this was standard practice for padding in CraftTWeaker.

commented

Oh, thanks for your reply!
I know it may be difficult to change the Mortar mechanic because doing so may leads to a re-construct of codes.
I just post this issue for a suggestion. You may choose the best way you think to deal with this issue.
Thanks again!

commented

I think I'll add an additional mortar recipe type that takes a percentage chance for additional output and quantity of potential additional output and make that available via CraftTweaker; it should resolve the majority of issues, and it can also be used to automatically create recipes with 1-2-3-4 and 5 inputs.

commented

Unfortunately, I'll most likely have to delay this until 3.2.