Predicate - Matches (Condition) — SkBriggy

Addon: SkBriggy · Category: Condition · Since: 1.3.0

Syntax

%itemstacks/blocks% match[es] (item|block) predicate %predicate%

Description

Check if a block/item matches a predicate.

Examples

# /remove @a #wool
# /remove @a #minecraft:swords{Damage:0}
brig command /remove <players> <i:itempredicate>:
	trigger:
		loop {_players::*}:
			loop items in inventory of loop-value:
				if loop-item matches item predicate {_i}:
					remove loop-item from inventory of loop-value-1

# /replace minecraft:short_grass minecraft:air 20
# /replace #minecraft:dirt minecraft:sand 30
# /replace #minecraft:logs minecraft:stone 50
brig command /replace <b:blockpredicate> <block> [<rad:int>]:
	trigger:
		if {_rad} is not set:
			set {_rad} to 5
		loop blocks in radius {_rad} around target block of player:
			if loop-block matches block predicate {_b}:
				set loop-block to {_block}

View source