Conditions List - Redheris/PreventBuild GitHub Wiki
Basic logical operators
Logical operators are the only ones that take values from the following lines.
And
Keyword: and:
Values:
- one or more other conditions or operators in the next lines.
Description: Confirms prevention if every of the specified conditions is met.
Or
Keyword: or:
Values:
- one or more other conditions or operators in the next lines.
Description: Confirms prevention if at least one of the specified conditions is met.
Not
Keyword: not:
Values:
- condition or operator in the next line.
Description: Confirms prevention if the specified condition wasn't met.
NullCondition
Keyword: -
Values:
- none
Description: Doing nothing, prevents nothing. And there is no way to use it in configs. Just letting you know that this technical thing exists.
Blocks
Block equals
Keyword: block:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents if the current block or held block is equal to one of the specified ones.
Block above
Keyword: blockAbove:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents if the block above the current one or placement position is equal to one of the specified ones.
Block below
Keyword: blockBelow:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents if the block below the current one or placement position is equal to one of the specified ones.
Block is adjacent to
Keyword: blockAdj:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents if the current block or placement position is adjacent to one of the specified ones.
Looking at
Keyword: lookingAt:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents if the block the player is looking at is equal to one of the specified ones.
Replace block
-
Keyword:
replaceBlock
Values: none
Description: Prevents the replacement of any blocks other than air.
-
Keyword:
replaceBlock:
Values:
- block's simple name (e.g.
stone
) - block's full translation key (e.g.
block.minecraft.stone
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
stone,block.minecraft.grass_block,#test
)
Description: Prevents the replacement of any specified blocks other than air.
Block state
Keyword: state:
Values:
- case insensitive string value of type
key=value
(e.g.waterlogged=true
)
Description: Prevents if the block has the specified state with the specified value.
Items
Held item
Keyword: item:
Values:
- item's simple name (e.g
diamond
) - item's full translation key (e.g.
item.minecraft.diamond
,block.minecraft.stone
) - mod's custom ore dictionary (e.g
#test
) - one or more of the above (e.g.
diamond,item.minecraft.diamond,#test
)
Description: Prevents if the held item is equal to one of the specified ones.
Item's enchantment
Keyword: enchant:
Values:
- enchantment's simple name (e.g.
efficiency
) - enchantment's name with its namespace (e.g.
minecraft:efficiency
) - enchantment (in both variant above) with a specified level (e.g.
minecraft:efficiency^5
)
Description: Prevents if the held item has the specified enchantment. If the enchantment's level isn't specified, then only the presence of the enchantment will be checked.
Item's custom name
Keyword: customName:
Values:
- String value of the item's custom name (e.g.
Excalibur
)
Description: Prevents if the held item has the specified custom name. Will be passed if the item has no custom name.
Item's remaining durability
-
Keyword:
durability:
Values:
- int value of the remaining durability (e.g.
0
,100
)
Description: Prevents if the held item has a remaining durability equal to the specified value.
- int value of the remaining durability (e.g.
-
Keyword:
durability<:
Values:
- int value of the remaining durability (e.g.
0
,100
)
Description: Prevents if the held item has a remaining durability less than the specified value.
- int value of the remaining durability (e.g.
-
Keyword:
durability>:
Values:
- int value of the remaining durability (e.g.
0
,100
)
Description: Prevents if the held item has a remaining durability greater than the specified value.
- int value of the remaining durability (e.g.
-
Keyword:
durability<=:
Values:
- int value of the remaining durability (e.g.
0
,100
)
Description: Prevents if the held item has a remaining durability less than or equal to the specified value.
- int value of the remaining durability (e.g.
-
Keyword:
durability>=:
Values:
- int value of the remaining durability (e.g.
0
,100
)
Description: Prevents if the held item has a remaining durability greater than or equal to the specified value.
- int value of the remaining durability (e.g.
Item's damage (lost durability)
-
Keyword:
damage:
Values:
- int value of the damage (e.g.
0
,100
)
Description: Prevents if the held item has a damage (lost durability) equal to the specified value.
- int value of the damage (e.g.
-
Keyword:
damage<:
Values:
- int value of the damage (e.g.
0
,100
)
Description: Prevents if the held item has a damage (lost durability) less than the specified value.
- int value of the damage (e.g.
-
Keyword:
damage>:
Values:
- int value of the damage (e.g.
0
,100
)
Description: Prevents if the held item has a damage (lost durability) greater than the specified value.
- int value of the damage (e.g.
-
Keyword:
damage<=:
Values:
- int value of the damage (e.g.
0
,100
)
Description: Prevents if the held item has a damage (lost durability) less than or equal to the specified value.
- int value of the damage (e.g.
-
Keyword:
damage>=:
Values:
- int value of the damage (e.g.
0
,100
)
Description: Prevents if the held item has a damage (lost durability) greater than or equal to the specified value.
- int value of the damage (e.g.
Coordinates
X coordinate
-
Keyword:
x:
Values:
- int (e.g.
13
,-1002
) - inclusive interval (e.g.
-20~50
) - one or more of the above (e.g.
14,-30~-5,72
)
Description: Prevents if the X coordinate of the action matches the specified values.
- int (e.g.
-
Keyword:
x>:
Values:
- int (e.g.
32
)
Description: Prevents if the X coordinate of the action is greater than the specified value.
- int (e.g.
-
Keyword:
x<:
Values:
- int (e.g.
32
)
Description: Prevents if the X coordinate of the action is less than the specified value.
- int (e.g.
-
Keyword:
x>=:
Values:
- int (e.g.
32
)
Description: Prevents if the X coordinate of the action is greater than or equal to the specified value.
- int (e.g.
-
Keyword:
x<=:
Values:
- int (e.g.
32
)
Description: Prevents if the X coordinate of the action is less than or equal to the specified value.
- int (e.g.
Y coordinate
-
Keyword:
y:
Values:
- int (e.g.
13
,-1002
) - inclusive interval (e.g.
-20~50
) - one or more of the above (e.g.
14,-30~-5,72
)
Description: Prevents if the Y coordinate of the action matches the specified values.
- int (e.g.
-
Keyword:
y>:
Values:
- int (e.g.
32
)
Description: Prevents if the Y coordinate of the action is greater than the specified value.
- int (e.g.
-
Keyword:
y<:
Values:
- int (e.g.
32
)
Description: Prevents if the Y coordinate of the action is less than the specified value.
- int (e.g.
-
Keyword:
y>=:
Values:
- int (e.g.
32
)
Description: Prevents if the Y coordinate of the action is greater than or equal to the specified value.
- int (e.g.
-
Keyword:
y<=:
Values:
- int (e.g.
32
)
Description: Prevents if the Y coordinate of the action is less than or equal to the specified value.
- int (e.g.
Z coordinate
-
Keyword:
z:
Values:
- int (e.g.
13
,-1002
) - inclusive interval (e.g.
-20~50
) - one or more of the above (e.g.
14,-30~-5,72
)
Description: Prevents if the Z coordinate of the action matches the specified values.
- int (e.g.
-
Keyword:
z>:
Values:
- int (e.g.
32
)
Description: Prevents if the Z coordinate of the action is greater than the specified value.
- int (e.g.
-
Keyword:
z<:
Values:
- int (e.g.
32
)
Description: Prevents if the Z coordinate of the action is less than the specified value.
- int (e.g.
-
Keyword:
z>=:
Values:
- int (e.g.
32
)
Description: Prevents if the Z coordinate of the action is greater than or equal to the specified value.
- int (e.g.
-
Keyword:
z<=:
Values:
- int (e.g.
32
)
Description: Prevents if the Z coordinate of the action is less than or equal to the specified value.
- int (e.g.
Entities
Entity equals
Keyword: entity:
Values:
- entities's simple name (e.g.
horse
) - entity's full translation key (e.g.
entity.minecraft.horse
) - mod's custom ore dictionary (e.g.
#test
) - one or more of the above (e.g.
horse,entity.minecraft.item_frame,#test
)
Description: Prevents if the entity is equal to one of the specified ones.
Advanced
Stripping logs and wood
Categories: "useItem:".
-
Keyword:
stripWood
Values:
- none
Description: Prevents stripping of any logs/wood/stems/hyphae.
-
Keyword:
stripWoodExcept:
Values:
- block's simple name (e.g.
oak_wood
) - block's full translation key (e.g.
block.minecraft.oak_wood
) - one or more of the above (e.g.
block.minecraft.oak_wood,crimson_stem
)
Description: Prevents stripping of logs/wood/stems/hyphae except those specified.
- block's simple name (e.g.
Carpet on carpet
Categories: "place:", "other:".
Keyword: carpetOnCarpet
Values:
- none
Description: Prevents placing carpet-type blocks (dyed and moss carpets) on top of another carpet-type block.
Dimension
Categories: any.
Keyword: dimension:
Values:
- dimension's simple name:
the_nether
the_end
overworld
- dimension entry's full string id (e.g.
minecraft:the_end
)
Description: Prevents if the player in the specified dimension.
Double slab
Categories: "place:", "break:", "other:".
Keyword: doubleSlab
Values:
- none
Description: Prevents building a double slab blocks. Also prevents breaking such blocks if placed in the "break" or "other" category.
Hand type
Categories: any.
Keyword: hand:
Values:
main_hand
off_hand
(or any another)
Description: Prevent if an action is performed with the specified hand.
Sneaking
Categories: any.
Keyword: isSneaking:
Values:
true
false
Description: Prevents depending on whether the player is sneaking or standing.