Skip to content

Test Item Stack Operation

Converts minecraft:item_stack prototype into puffish_skills:boolean prototype whether the condition matches given item stack.

Examples

The operation is used to test item stack kind, such that the experience source gives the player exactly 5 experience every time the player mines a block using golden pickaxe.

Click to view
json
{
	"type": "puffish_skills:mine_block",
	"data": {
		"variables": {
			"exp_value": {
				"operations": [
					{
						"type": "get_tool_item_stack"
					},
					{ 
						"type": "puffish_skills:test",
						"data": {
							"item": "golden_pickaxe"
						}
					},
					{
						"type": "switch",
						"data": {
							"true": 5,
							"false": 0
						}
					}
				]
			}
		},
		"experience": "exp_value"
	}
}

The operation is used to test if item stack is enchanted with silk touch. This information is then used such that the experience source gives the player exactly 5 experience every time the player mines a block unless the tool is enchanted with silk touch.

Click to view
json
{
	"type": "puffish_skills:mine_block",
	"data": {
		"variables": {
			"is_silk_touch": {
				"operations": [
					{
						"type": "get_tool_item_stack"
					},
					{ 
						"type": "puffish_skills:test",
						"data": {
							"components": {
								"minecraft:enchantments": {
									"minecraft:silk_touch": 1
								}
							}
						}
					}
				]
			}
		},
		"experience": [
			{
				"condition": "!is_silk_touch",
				"expression": "5"
			}
		]
	}
}

JSON structure

PropertyTypeRequired
itemitem identifier or item tagno
nbtitem nbtno
componentsdata component predicateno