-
Notifications
You must be signed in to change notification settings - Fork 1
Expressions & Generation Logic
Expressions and logic control all the rule sets that determine whether a structure generates or not, and what happens when one does. The principal is running boolean evaluations, and when an expression's output is true, then the action is allowed ("booleans" are variables which store a "true" or "false" value). An expression will only be true if all variables inside it are also true.
Note: Algebraic variables (a, b, c, etc) will be used to represent values you would use with operators.
You can use the "pages" column to the right to jump to sections within this page as it's rather long, or use the repository search function.
- !a - NOT. Inverts the value. Returns true when the variable is false.
- a & b - AND. Returns true if both a and b are true.
- a | b - OR. Returns true if either a or b is true.
- a ?? b :: c - IF ELSE. If a is true, return b, else return c.
- (a) - Parentheses. Groups variables and validates it (like in normal algebra).
IF statement Examples.
These are constants, used in complex expressions, such as IF ELSE statements.
- true - Always returns true.
- false - Always returns false.
-
global:a - Evaluates the global toggle a. These can be set in the config file. For example, by default, the expression
global:decayTreeLeavesis used in the tree transformer to determine whether tree leaves should be decayable after spawn.
/ Special Character: Quotes ""
/
/ If you need any of these characters inside a variable, use quotes. Example: "VariableWithAn&" | "VariableWithQuotes()" or "Variable with spaces".
/
/ Special Character: Backslash \
/
/ You can also use a backslash \ to mark the next character to be used literally instead. Example: VariableWithAn& | VariableWithQuotes() | Variable\ with\ spaces becomes VariableWithAmpersand& | VariableWithQuotes() | Variable with spaces
/
/ To use backslashes or quotes inside variable names, you can of course escape them too, e.g. VariableWithQuotes" and VariableWithBackslash\.
/
/ Also, note that whitespace is optional and notes the beginning of the next token. Example: Some\ Variable & Some\ Other\ Variable becomes Some Variable & Some Other Variable.
Used to determine whether a structure or loot table will load, based on its dependencies.
- mod:a - Returns true if the mod with the Mod ID 'a' is currently installed.
- strc:a - Returns true if a structure with ID 'a' is currently loaded.
- reg:a.b - Finds the registry with ID 'a', and evaluates the variable 'b' in it.
Used to evaluate biome checks.
- id=a - Returns true if the ID matches 'a'. Takes an alphabetical ID for biomes and numerical for dimensions.
- type=a - Returns true if the biome matches the biome dictionary type 'a'. You can find out biome types with /#biome.
-
name=a - Returns true if the biome has the name 'a'.
Note: The "type" expression, when used for dimensions, is supposed to call on a library which assigns type tags to dimensions. Currently though, no mods utilize this system so it is effectively useless in the dimensions tab outside of vanilla ones.
Used to evaluate block checks.
- metadata=a-b - Returns true if the metadata is within the specified range (a to b).
- metadata=a - Returns true if the metadata is exactly the specified value.
- property[a]=b - Returns true if the block has the property with name a, and its value is b.
- id=a - Returns true if the block has the specified ID.
If the block is positioned, the following variables are also available:
- is:a - Returns true if the block matches the criteria. Valid values for 'a' are: leaves, air, foliage, replaceable, liquid, water, lava.
- sustains.a (Note the ".") - Returns true if the block sustains a given plant type. 'a' can be either of: trees, mushrooms, cacti.
- blocks:a - Returns true if 'a' blocks the designated thing. Valid values for 'a' are: movement, light.
A command expression defines if a command is matched (e.g. should be executed).
- name=a - Returns true if the executing player / block has the specified name.
- canUseLevel:a - Returns true if the executing player / block has the specified permission level.
An environment expression defines if a certain environment matches the given criteria (e.g. biome, village type etc.). These expressions are mostly used in Transformers.
- biome.a - Followed by a biome expression variable.
- dim.a - Followed by a dimension expression variable.
- dep.a - Followed by a dependency expression variable.
- vtype=a - Returns true if the environment is a village with the specified type. Enter "None" to match environments outside villages.
- gen.a - Followed by a structure generation info expression variable (of the generation info currently in use).
- variable.a - Returns the value of one of the local variables (WIP) declared for the structure.
Examples can be found in Transformers.
WIP
WIP
WIP
WIP
WIP
WIP
All pages in this wiki assume you understand all the things covered in the Getting Started section. Pages which rely on additional knowledge outside of this section will list it in the "prerequisites" of that page.
What is RC
Intro & Basics
Building A Structure
Structure GUI Basics
Using RC As A Utility
Config
Managing Structure Files
Chests & Loot Generation
Expressions & Generation Logic
Building A Structure In Depth
Structure Types
Commands
Structure Script Block
Making A Maze
Making A Town
Dynamic Structures
Advanced Maze Rules
Custom Frequency Categories
Terrain Blending
Spawn Structures
Transformers
World Scripts
Performance Through Dynamic Structures
Custom NPC Through RC
Avoiding Cascading Chunk Generation
End Dimension Compatibility
Basic Structure
Trees
Natural Terrain Features
Floating Structure
Underground Structure
Spawn Structure
Static Structure
Maze
Town
Dynamic structures: Castle, Space Station, Floating Islands
NPC In Structures