Config Structure - Redheris/PreventBuild GitHub Wiki

First of all - configurations are distinguished by the "name" field, the file name doesn't matter.

Basic Structure

Every config file has a similar structure:

name:<Required unique name, may contain spaces but must not contain "_">
break:
place:
interactBlock:
useItem:
interactEntity:
attackEntity:

Any of the lines above except the "name" line can be ignored and skipped.

Categories

Different categories defines different types of preventing behavior:

  • break:
    • When left-clicking a block;
    • The coordinates are taken from the breaking block;
  • place:
    • When placing a block;
    • The coordinates are taken from the placement;
  • interactBlock:
    • When right-clicking a block;
    • The coordinates are taken from the block with which the player interacts;
  • useItem:
    • When right-clicking a block or using an item (doesn't matter if there is a block the player is looking at);
    • The coordinates are taken from the player;
  • interactEntity:
    • When right-clicking an entity;
    • The coordinates are taken from the entity;
  • attackEntity:
    • When left-clicking an entity;
    • The coordinates are taken from the entity.

Each of them represents an "or" operator, so it should contain conditions or logical operators.

You can see complete list of conditions with descriptions on this page.

Tabulation and commentaries

Conditions are being checked using logical operators: "and", "or" and "not". Right below lines such as "and:" and "or:" the mod reads lines with the greater tabulation level (number of white space characters (simple space " ", \t, etc.) at the beginning).

The config structure also supports comments - blank lines or lines starting with "%" or "#", excluding tab and space characters.

Example

name: Example config
break:
	% This will prevent several cases of breaking invidiually:
	% 1) any blocks having x coordinate is greater than 1240
	% 2) breaking block is "stone" or "grass_block"
	% 3) the player holds the item "iron_axe"
	x>1240
	block:stone,grass_block
	item:iron_axe
place:
	and:
	% This will prevent placing block inside the square [-100, *, -100]-[100, *,100] ([x, y, z]) inclusive
		x:-100~100
		z:-100~100
	% Except placing obsidian blocks
		not:
			block:block.minecraft.obsidian
useItem:
	% Prevents stripping any logs and wood
	stripWood
	% Prevent actions of using bone meal on nylium
	and:
		item:bone_meal
		lookingAt:crimson_nylium,warped_nylium
interactBlock:
	% Prevents you from interact with a red bed without sneaking
	and:
		isSneaking:false
		block:red_bed