Tinkers Construct

Tinkers Construct

170M Downloads

More precise control for `leftover` for recipes in Part Builder

Closed this issue ยท 3 comments

commented

Minecraft Version

1.20.1

Forge Version

neoforge-1.20.1-47.1.106

Mantle Version

1.11.61

Tinkers' Construct Version

3.10.1.76

Problem description

This issue might be also a low-priority issue.So if you don't have time you can just skip this.

I don't know whether this is intentional to avoid some strange cases or not considered when developing.
Anyways I can set to no leftover for these recipes.

For recipes below:

{
    "type": "tconstruct:material",
    "ingredient": {
        "item": "minecraft:lapis_block"
    },
    "leftover": "minecraft:lapis_lazuli",
    "material": "tconstruct:slimesteel",
    "needed": 2,
    "value": 9
}
{
    "type": "tconstruct:material",
    "ingredient": {
        "item": "minecraft:lapis_lazuli"
    },
    "material": "tconstruct:slimesteel",
    "needed": 2,
    "value": 1
}

According to the recipe, Lapis Block now is of 4.5 Material Value.
When we use 1 Lapis Block to craft 1 Slimesteel Pick Head, there should be 2.5 Mat Val remained, that is 5 Lapis Lazuli (As I described in Suggested Solution below).
However, the Part Builder returned 7 Lapis Lazuli.
I think this is probably because that, when calculating returning amount, only simple subtraction 9 - 2 is made.

Suggested solution

Allow leftover to link another recipe. For example:

{
    "type": "tconstruct:material",
    "ingredient": {
        "item": "minecraft:lapis_block"
    },
    "leftover": {
        "recipe": "test:gem"
    },
    "material": "tconstruct:slimesteel",
    "needed": 2,
    "value": 9
}

Then in data/test/recipes/gem.json we write

{
    "type": "tconstruct:material",
    "ingredient": {
        "item": "minecraft:lapis_lazuli"
    },
    "material": "tconstruct:slimesteel",
    "needed": 2,
    "value": 1
}

And when calculating returning amount, it can follow the linked recipe to get the expected result 5.

Alternatives considered

Add a needed for leftover

For example:

{
    "type": "tconstruct:material",
    "ingredient": {
        "item": "minecraft:lapis_block"
    },
    "leftover": "minecraft:lapis_lazuli",
    "leftover_needed": 2
    "material": "tconstruct:slimesteel",
    "needed": 2,
    "value": 9
}

Add shard in TiC2 back

But I think this suggestion is almost impossible to be taken.

Additional context

No response

Searched for existing enhancement?

Used the search bar

commented

I have no plans to make leftover pull from another recipe. I'll verify the math on leftovers to ensure its correct, but honestly, setting both value and needed is just unsupported behavior not expected to work correctly.

For your usecase, this is solved trivially by just making 3 lapis needed per unit, so a block is worth 3.

commented

I fixed this issue in a new commit, though I will note you set the leftovers incorrectly for your goal. Leftover is meant to be the equivalent of 1 unit of material; you will note in our wood fallback recipe we set leftover to 2 sticks as a stick is half a unit. For your example recipe you should set it to 2 lapis lazuli.

With the fixed code, if the material is worth 4.5 and the leftover is stack size 2, you will actually get a leftover of 1 lapis when crafting a 4 cost recipe.

commented

Fixed the leftover bug v3.10.2.92 for 1.20.1. See above comment about how to fix your recipe.