Block predicates are used to test conditions about blocks at specific positions. They’re commonly used in ore generation, feature placement, and structure validation.
BlockStatePredicate
Tests block state properties at an offset position.
Configuration
{
"type": "lithostitched:block_state",
"offset": [0, -1, 0],
"properties": {
"snowy": "true"
}
}
Fields
Position offset from the test location (x, y, z)
properties
StatePropertiesPredicate
required
Block state properties to match
Example Use Cases
Check if block below is grass:
{
"type": "lithostitched:block_state",
"offset": [0, -1, 0],
"properties": {
"snowy": "false"
}
}
Check waterlogged state:
{
"type": "lithostitched:block_state",
"offset": [0, 0, 0],
"properties": {
"waterlogged": "true"
}
}
Check facing direction:
{
"type": "lithostitched:block_state",
"offset": [1, 0, 0],
"properties": {
"facing": "west"
}
}
Multiple properties:
{
"type": "lithostitched:block_state",
"offset": [0, 0, 0],
"properties": {
"half": "top",
"waterlogged": "false",
"facing": "north"
}
}
InStructurePredicate
Tests if a position is within a structure’s bounding box.
Configuration
Any structure:
{
"type": "lithostitched:in_structure",
"search_range": 16
}
Specific structure:
{
"type": "lithostitched:in_structure",
"structure": "minecraft:village_plains",
"search_range": {
"horizontal": 32,
"vertical": 128
}
}
Fields
Specific structure to check for. If omitted, checks for any structure.
How far to search for structures
Simple (same horizontal and vertical):
Separate horizontal and vertical:
"search_range": {
"horizontal": 32,
"vertical": 64
}
Fields
Horizontal search radius (0-32 blocks)
search_range.vertical
int
default:"dimension height"
Vertical search radius (0-dimension height)
Example Use Cases
Check if in any village:
{
"type": "lithostitched:in_structure",
"structure": "minecraft:village",
"search_range": 32
}
Check if in fortress (large vertical range):
{
"type": "lithostitched:in_structure",
"structure": "minecraft:fortress",
"search_range": {
"horizontal": 16,
"vertical": 256
}
}
Check if in any structure (small area):
{
"type": "lithostitched:in_structure",
"search_range": 8
}
This predicate checks chunk structure references and validates actual bounding box intersections. It’s relatively expensive, so use reasonable search ranges.
MultipleOfPredicate
Requires a specific count of sub-predicates to pass.
Configuration
{
"type": "lithostitched:multiple_of",
"predicates": [
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone",
"offset": [0, -1, 0]
},
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone",
"offset": [1, 0, 0]
},
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone",
"offset": [-1, 0, 0]
},
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone",
"offset": [0, 0, 1]
},
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone",
"offset": [0, 0, -1]
}
],
"allowed_count": {
"min_inclusive": 3,
"max_inclusive": 5
}
}
Fields
predicates
List<BlockPredicate>
required
List of predicates to evaluate
allowed_count
InclusiveRange<Integer>
required
Required number of passing predicates
Example Use Cases
Require at least 3 adjacent stone blocks:
{
"allowed_count": {
"min_inclusive": 3,
"max_inclusive": 6
}
}
Require exactly 2 conditions:
{
"allowed_count": {
"min_inclusive": 2,
"max_inclusive": 2
}
}
Partial surrounding check:
{
"type": "lithostitched:multiple_of",
"predicates": [
{
"type": "minecraft:matching_blocks",
"blocks": "#minecraft:base_stone_overworld",
"offset": [1, 0, 0]
},
{
"type": "minecraft:matching_blocks",
"blocks": "#minecraft:base_stone_overworld",
"offset": [-1, 0, 0]
},
{
"type": "minecraft:matching_blocks",
"blocks": "#minecraft:base_stone_overworld",
"offset": [0, 0, 1]
},
{
"type": "minecraft:matching_blocks",
"blocks": "#minecraft:base_stone_overworld",
"offset": [0, 0, -1]
}
],
"allowed_count": {
"min_inclusive": 2,
"max_inclusive": 4
}
}
Requires stone on at least 2 sides (prevents isolated placement).
RandomChancePredicate
Passes with a specified probability.
Configuration
{
"type": "lithostitched:random_chance",
"chance": 0.25
}
Fields
Probability of passing (0.0 to 1.0)
Example Use Cases
25% chance:
{
"type": "lithostitched:random_chance",
"chance": 0.25
}
1% chance (rare):
{
"type": "lithostitched:random_chance",
"chance": 0.01
}
75% chance (common):
{
"type": "lithostitched:random_chance",
"chance": 0.75
}
Guaranteed (always pass):
{
"type": "lithostitched:random_chance",
"chance": 1.0
}
The random source is seeded with the world seed and position, ensuring deterministic results for the same position in the same world.
Combining with Vanilla Predicates
Lithostitched predicates can be combined with vanilla predicates:
{
"type": "minecraft:all_of",
"predicates": [
{
"type": "minecraft:matching_blocks",
"blocks": "#minecraft:base_stone_overworld"
},
{
"type": "lithostitched:random_chance",
"chance": 0.5
},
{
"type": "lithostitched:in_structure",
"structure": "minecraft:mineshaft",
"search_range": 16
}
]
}
This predicate:
- Checks for stone-like blocks
- Passes 50% of the time
- Only within 16 blocks of a mineshaft
Usage in Ore Configuration
Block predicates are commonly used in OreFeature targets:
{
"type": "lithostitched:ore",
"config": {
"size": 9,
"targets": [
{
"predicate": {
"type": "minecraft:all_of",
"predicates": [
{
"type": "minecraft:matching_blocks",
"blocks": "minecraft:stone"
},
{
"type": "lithostitched:random_chance",
"chance": 0.8
}
]
},
"state_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:iron_ore"
}
}
}
]
}
}
Source References
- BlockStatePredicate:
BlockStatePredicate.java:11
- InStructurePredicate:
InStructurePredicate.java:30
- MultipleOfPredicate:
MultipleOfPredicate.java:14
- RandomChancePredicate:
RandomChancePredicate.java:11