Modding:Content Tutorial Complex Grid Recipes

From Vintage Story Wiki
Revision as of 14:23, 9 April 2024 by Nateonus (talk | contribs) (In progress...)

This page was last verified for Vintage Story version 1.19.7.


In progress.

Introduction

Objective

Recipes in Vintage Story are very versatile, and the grid recipe system has a number of features that have not yet been talked about. In this tutorial, you will find out how to create more complex recipes, including those with variants, different itemstack quantities, returned itemstacks, and some other smaller features.

Assets

Before starting, it is recommended you download the workspace and assets for this tutorial. The completed files can also be found here.

This tutorial starts with the following assets:

  • Mod Setup & Folder Structure
  • Simple 'Sleek Door' recipe

Prerequisites

This tutorial will assume you understand the following topics:

It is recommended to have completed the following tutorial:

It is recommended, but not necessary, to understand the following concept:

Navigating Assets

This tutorial is simply to create new recipes - The only file is recipes/grid/sleekdoor.json. This is a simple recipe, which inputs an oak solid door and outputs an oak sleek door.

{
	"ingredientPattern": "D",
	"width": 1,
	"height": 1,	
	"ingredients": {
		"D": {
			"type": "block",
			"code": "game:door-solid-oak"
		}
	},
	"output": {
		"type": "block",
		"code": "game:door-sleek-windowed-oak"
	}
}

Variant-Based Recipes

So, you know how to make recipes. However

Conclusion

Congratulations, you now have four variants of a single block, all within one file! After this tutorial, you should have more of an understanding of how variants can be grouped together, and how to get the most out of them.

Next Steps...

If you want to test your knowledge, consider doing the tasks under the Going Further section below.

Variants are pretty nifty, but they can get even better. Take a look at the next tutorial, Complex Grid Recipes for a demonstration on how to use variants inside recipes.

Going Further

Want to make some additional changes to this mod? Try and achieve the following things!

Make the 'used' blocks destroy faster than the 'good' blocks.

To achieve this...
Replace the resistance property with resistanceByType. Specify two wildcard keys, namely "*-good" and "*-used" to specify values of 3.5 and 2 respectively.
Example...
"resistanceByType": {
	"*-good": 3.5,
	"*-used": 2
},

Remove texturesByType, and achieve the same result using just variant substitution. (Hint: You will have to rename texture files)

To achieve this...
There are a number of similar methods to achieve this. Here is my method:

Firstly, revert the "texturesByType" to a "textures" property. Change the base property to be "block/shiny{type}texture-{condition}". This will result in the following ID to Texture table:

Block ID Resolved Texture Path
advancedshinyblock-gold-good block/shinygoldtexture-good
advancedshinyblock-gold-used block/shinygoldtexture-used
advancedshinyblock-iron-good block/shinyirontexture-good
advancedshinyblock-iron-used block/shinyirontexture-used

You will now have to rename the texture files to match those in the resolved texture path column.

Example...
"textures": {
	"all": { "base": "block/shiny{type}texture-{condition}" }
},


Content Modding
Basics Content Mods Developing a Content Mod Packaging & Release
Tutorials
Concepts Modding Concepts Modinfo Variants Domains Patching Remapping World Properties
Moddable Assets
Uncategorized
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository