Modding:Content Tutorial Further Recipes: Difference between revisions

From Vintage Story Wiki
m
no edit summary
mNo edit summary
mNo edit summary
Line 172: Line 172:
It's a rather bulky bit of code, but see if you can visualize how this will look in 3D. Each array (contained by '''[ ]''') is an individual height layer for the clayforming. Note that we use an underscore ( '''_''' ) for an empty space, and a hash sign ('''#''') for a filled voxel.
It's a rather bulky bit of code, but see if you can visualize how this will look in 3D. Each array (contained by '''[ ]''') is an individual height layer for the clayforming. Note that we use an underscore ( '''_''' ) for an empty space, and a hash sign ('''#''') for a filled voxel.


Clayforming recipes must be between 16x16, and have a maximum height of 16.
Clayforming recipes must be between 16x16, and have a maximum height of 16. If a recipe is less than these dimensions, it will be automatically centered during creation.


After adding the pattern, the clayforming recipe is complete!  
After adding the pattern, the clayforming recipe is complete!  
Line 223: Line 223:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
== Knapping Recipes ==
Knapping recipes are like clayforming recipes, but even simpler since there's only one level of height to worry about. In the ''knapping'' folder, open the ''stone-brick.json'' file and you'll see the following code:<syntaxhighlight lang="json">
{
  "ingredient": {
    "type": "item",
    "code": "game:stone-*",
    "name": "rock",
    "allowedVariants": [ "chert", "granite", "andesite", "basalt", "peridotite" ]
  },
 
  "output": {
    "type": "item",
    "code": "game:stonebrick-{rock}"
  }
}
</syntaxhighlight>It should be evident as to what this code is doing. The ingredient for knapping recipes is always a single rock, and we're only allowing a few variants for the harder types of stone. Our output is a single stone brick, made from that rock.
Similar to the clayforming recipe, you need to add a ''pattern'' property. Although knapping recipes are always one height, this is also stored as an array of arrays. Add the following property between the ingredient and output properties.<syntaxhighlight lang="json">
"pattern": [
    [
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_"
    ]
  ],
</syntaxhighlight>Similarly to the clayforming recipes, an underscore is a gap, and a hash sign is a filled voxel. In this example, the pattern is a simple 5x6 rectangle.
All knapping recipes are a maximum size of 10x10. If a recipe is less than these dimensions, it will be automatically centered. In the case of the example given above, the underscores surrounding each row are actually unnecessary, and can be removed, however is sometimes helps with visualization.
After adding the pattern property, the stone knapping recipe is complete!
{| class="wikitable mw-collapsible mw-collapsed"
!stone-brick.json
|-
|<syntaxhighlight lang="json">
{
  "ingredient": {
    "type": "item",
    "code": "game:stone-*",
    "name": "rock",
    "allowedVariants": [ "chert", "granite", "andesite", "basalt", "peridotite" ]
  },
  "pattern": [
    [
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_",
      "_#####_"
    ]
  ],
  "name": "Brick",
  "output": {
    "type": "item",
    "code": "game:stonebrick-{rock}"
  }
}
</syntaxhighlight>
|}
== Smithing Recipes ==


== Conclusion ==
== Conclusion ==
Confirmedusers
538

edits