Jump to content

Recommended Posts

Posted

Could anyone help me with figuring out the item id system? I'm trying to create a small mod that makes the boulders you see on the ground craftable using stones of that type, but I'm not sure how to make the boulders actually craftable as most of the time I get crashes, or the recipe outright not working. I've added a few other small recipes in the past so I know I can do it, but I've checked the Lang file for the ID with no success using that ID so far. The recipe code I'm using is as follows:

 

{
        ingredientPattern: "SSS    ",
        ingredients: {
            "S": { type: "item", code: "game:stone-granite", quantity: 1 },

        },
        recipeGroup: 1,
        width: 3,
        height: 1,
        output: { type: "block", code: "game:looseboulders-granite", quantity: 1 }
    }

If anyone with more of an idea than I have could tell me what I'm doing wrong I would really appreciate it!

 

  • Like 1
Posted

You want to craft stones into boulders? That's interesting. Do you have an idea of what you want to do with them? Or is this just to teach yourself custom recipes?

I don't think boulders are intended to be held in inventory. That might matter.

I don't see anything immediately wrong with what you posted except maybe the spaces in "SSS   ".

  • Like 1
Posted

To be honest I quite liked the idea of using them as decoration blocks for a quarry or mine I'm in the early stages of creating, and wanted to create a recipe to obtain them. If they aren't obtainable at all then maybe I'll just have to leave it as it is or try to chisel something similar instead, which isn't a massive issue, I just was hoping to streamline the process.

  • Like 1
Posted (edited)
5 hours ago, trashsouls said:

Could anyone help me with figuring out the item id system?

There are two ways. The most simple way is to start up a world, go into creative mode, open up the creative inventory and look up the block or item you want to use. For that to work, you have to enable Extended Debug info in Settings ➡️ Dev.

If you do that with the boulders, you get 23 blocks, with the name looseboulders-{STONE TYPE}-free, where stone type is one of the stones currently in the game.

The next way (almost as equally as simple, but it helps to have an understanding of the block/item-config VS uses) is to lock up the actual config file, which you can find in this case under /assets/survival/blocktypes/stone/looseboulders.json.

Here you can see, why the game adds -free to the boulders. -free essentially means that the block is not covered by ice, snow, or water. Recommend reading: https://wiki.vintagestory.at/Modding:Content_Tutorial_Block_Variants - https://wiki.vintagestory.at/index.php/Modding:Variants

(Here you also see, why you only find looseboulders-{STONE TYPE}-free in the inventory. The rest is hidden ( creativeinventory: { "general": ["*-free"] } ).

Spoiler

Btw, the json files come with a lot of format errors. It's best practice to surround every property with quotation mark. creativeinventory becomes "creativeinventory", ingredientPattern becomes "ingredientPattern", ingredients becomes "ingredients" and so on.

That already explains the output problem. Currently you are trying to force the game to create a block that doesn't exist.

Another cool thing you can do is to use wildcards in recipes. If you look at your recipe you can only use granite stones. But what about the rest? You could create another 22 recipes. Or you could use a wildcard. Recommended reading: https://wiki.vintagestory.at/Modding:Content_Tutorial_Complex_Grid_Recipes

That almost solves the recipe problem. Almost, because @Echo Weaver is right, the ingredient length is wrong. If you look at your recipe, you see that you configured the height of the recipe to be 1, but the spaces in the recipe pattern imply a height of 2 (" " or "_" stand for empty grid cells). This doesn't crash your game, but your recipe will not be accepted by the game.

Have another go at your recipe and fix the problems you see. If you don't want to partake in this exercise, you'll get the recipe from me. I think that finding out yourself is more fun, though.

Edited by Brady_The
  • Like 1
Posted

So after a LOT of experimentation and getting it slightly wrong I have FINALLY gotten it to work as a wildcard recipe. Thank you so much for all of your help because I sure as hell wouldn't have been able to do it without your push in the right direction. My final result looks way better:

    {
        "ingredientPattern": "CCC",
        "ingredients": {
            "C": {"type": "item", code: "game:stone-*", "name": "rock"
       }
        },
        "width": 3,
        "height": 1,
        "output": { "type": "block", code: "game:looseboulders-{rock}-free",
        quantity: 1 }
    }
I seriously thank you for your help, I've learned so much even if it took me a while to get there in the end!

  • Like 2
Posted (edited)
4 hours ago, trashsouls said:

So after a LOT of experimentation and getting it slightly wrong I have FINALLY gotten it to work as a wildcard recipe. Thank you so much for all of your help because I sure as hell wouldn't have been able to do it without your push in the right direction. My final result looks way better:

    {
        "ingredientPattern": "CCC",
        "ingredients": {
            "C": {"type": "item", code: "game:stone-*", "name": "rock"
       }
        },
        "width": 3,
        "height": 1,
        "output": { "type": "block", code: "game:looseboulders-{rock}-free",
        quantity: 1 }
    }
I seriously thank you for your help, I've learned so much even if it took me a while to get there in the end!

You are welcome!

Very nice, your recipe is basically a one-to-one copy of mine. Well, almost. There is one more thing you can add. If you load into the world, depending on your settings, you'll see an error message pop up.

Output Block code game:looseboulders-meteorite-iron-free cannot be resolved

That's because, while stone-meteorite-iron does exist, which you tell the game to use in your C ingredient, looseboulders-meteorite-iron-free does not.

This isn't the biggest problem, it's not preventing the recipe or mod from working, but it's not necessary either. To prevent this, you can add  "skipVariants": [ "meteorite-iron" ] to your ingredient.

 "C": {"type": "item", code: "game:stone-*", "name": "rock", "skipVariants": [ "meteorite-iron" ]}

As the string suggests, this will tell the game to skip this particular stone variation. This also works in the reverse. With "allowedVariants" you can control which block variants can be used, if you, for example wanted the player only be able to craft "hard stone" boulders. These variant properties are essentially a list, if you wanted to add one or more entries, you'd simply do that.

 "skip-/allowedVariants": [ "variant1", "variant2", "variant3", ... ]

There's also the concern, that you can essentially generate infinite stones with the current recipe, because a stone boulder can drop more than 3 stones, which you could prevent for example by changing the output to a modded block, that uses the textures and shape of the Vanilla boulder, but drops itself on breaking instead of a somewhat random number of stones. In this particular case, however, I don't think, that it matters too much.

If you want more after this, I highly recommend you to go through the whole basic and intermediate tutorials on the wiki - there is so much more to discover.

Edited by Brady_The
  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.