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:
other:
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 right-clicking a block;
- The coordinates are taken from the breaking block;
- place:
- When left-clicking a block;
- The coordinates are taken from the placement;
- other:
- When right- or left-clicking a block;
- The coordinates are taken from the player;
- useItem:
- When right-cliccking 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 next tabulation level (number of \t characters 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:
x>1240
block:stone,grass_block
item:iron_axe
place:
and:
% This will prevent placing inside the square [-100, *, -100]-[100, *,100] ([x, y, z])
x:-100~100
z:-100~100
% Except placing obsidian blocks
not:
block:block.minecraft.obsidian
useItem:
% Prevent actions of using bone meal on nylium
and:
item:bone_meal
lookingAt:crimson_nylium,warped_nylium
other:
% Prevents stripping any logs and wood
stripWood