Skip to content

Switch operation

Converts puffish_skills:boolean prototype into different puffish_skills:number prototype whether the value is true or false.

Examples

The following example switch operation is used in the experience source to give the player exacly 5 experience every time the player mines stone block.

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

JSON structure

PropertyTypeRequired
truenumberyes
falsenumberyes