Jump to content

Recommended Posts

Posted (edited)
On 8/25/2025 at 8:23 PM, Tyron said:

Feature: Grid Recipe crafting: Added mergeAttributes to grid recipes that specifies ingredients which attributes will be merged into output stack. Allowed use of regexes in ingredient code. Allowed use of '{variant}' construction in ingredient code wildcard, several variant groups can be used in one ingredient and across ingredients, allowedVariants and skipVariants for them are specified separetly in recipe.

Does any one know how to properly utilise this or may have come across a working implementation? I am particularly interested in the usage of multiple wildcards in one ingredient and the correct output format.

Unfortunately I cannot read code to the extend necessary to hunt down the answer myself.

Cheers!

This problem is half-solved. What I am currently looking for is the correct usage of regex inside ingredients and how to forward these values into the output. (Due to the wording I suppose the latter isn't possible.) Which is the more complicated part, because from my experiences with VS Regex it seems to make up some own rules, similar to the JSON parsing. https://github.com/anegostudios/vsapi/blob/f0d94e1bb3dacde5efb15fd1e91a9486c9e70f15/Util/WildcardUtil.cs or https://github.com/anegostudios/vsapi/blob/f0d94e1bb3dacde5efb15fd1e91a9486c9e70f15/Common/Crafting/GridRecipe.cs#L255?

This example is doing what I want it to do. At least partially. For some reason it's not resolving "up-north". I suspect it's the handling of the hyphen inside a recipe file (blocktypes use this format very regularly). Or, more likely, the "allowed-/skipVariants" contents only matter for filtering assets within the recipe, considering that "up" and "north" are both different variantGroups in the blocktypes, so any stair blocks are simply ignored, because the asset code use in ingredient B doesn't match the actual code of the asset.

{
	"name": "Multiple Wildcards",
	"ingredientPattern": "A,B",
	"ingredients": {
		"A": { "type": "block", "code": "game:clayshingle*", "quantity": 32 },
		"B": { "type": "block", "code": "game:clayshingle{wildcard1}-{wildcard2}-{wildcard3}-free" }
	},
	"allowedVariants": {
		"wildcard2": [ "black", "blue", "brown", "cream", "fire", "gray", "orange", "red", "tan" ],
		"wildcard3": [ "down", "up-north" ],
		"wildcard1": [ "labs", "stairs" ]
	},
	"skipVariants": {
		"wildcard2": [ "black", "blue", "brown", "cream", "fire", "gray", "orange", "red", "tan" ],
	},
	"width": 1,
	"height": 2,
	"shapeless": true,
	"output": { "type": "block", "code": "game:clayshingle{wildcard1}-{wildcard2}-{wildcard3}-free", "quantity": 32 }
}

Notes:
- The recipe above is just an example, demonstrating the usage of the new keys. If a variation doesn't appear in "allowedVariants" it won't be utilised, "skipVariants" is not needed in this case. Generally both should be considered an either/or.
- Wildcards used in the ingredients don't have to be used in the output. You can use that to filter recipe patterns even further.

Spoiler
{
	"ingredientPattern": "A,B",
	"ingredients": {
		"A": { "type": "block", "code": "game:slantedroofing-{colour2}clay-*", "quantity": 32 },
		"B": { "type": "block", "code": "game:slantedroofing-{colour}clay-east-free" }
	},
	"skipVariants": {
		"colour2": [ "black" ]
	},
	"width": 1,
	"height": 2,
	"shapeless": true,
	"output": { "type": "block", "code": "game:slantedroofing-{colour}clay-east-free", "quantity": 32 }
}

The recipe above will allow you to transform roofing pieces into black coloured ones, but won't allow you to use black roofing pieces to transform from.

Edited by Brady_The
Fixed non-generalised wildcard names in output
Posted (edited)
21 hours ago, Micah Holmes said:

Anytime i work with RegX I always reference this page: https://www.c-sharpcorner.com/article/c-sharp-regex-examples/ I know its basic but I try not to over complicate things wieh I use regX. I hope it helps. 

Unfortunately it didn't, but I appreciate the attempt.

I definitely need the help of a codist.

Going straight to the source I used regex written by the devs to eliminate any potential errors.
Expectation: It does work.
Result: It does not. (Even though the logs are squeaky clean.)

Which leaves me with two explanations. Regex usage in recipes is currently not working, or the game is applying yet another rule set in recipes.

[
	{
		"ingredientPattern": "A,B",
		"ingredients": {
			"A": { "type": "block", "code": "@.*-(woad|horsetail|cowparsley|goldenpoppy)-.*" },
			"B": { "type": "item", "code": "shears-*", "isTool": true }
		},
		"width": 1,
		"height": 2,
		"shapeless": true,
		"output": { "type": "item", "code": "blade-longsword-admin" }
	},
	{
		"ingredientPattern": "A,B",
		"ingredients": {
			"A": { "type": "block", "code": "@anvil-(iron|meteoriciron|steel)" },
			"B": { "type": "item", "code": "hammer-*", "isTool": true }
		},
		"width": 1,
		"height": 2,
		"shapeless": true,
		"output": { "type": "block", "code": "metal-scraps", "quantity": 5 }
	}
]
Edited by Brady_The
×
×
  • 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.