Skip to content

Matches Block Pattern

Checks if a pattern of blocks is matched.

Type ID: kaya:matches_block_pattern

Format

Field Type Default Description
pattern Nested Array of Strings Determines the pattern of blocks to match.
where Key-Condition Map The map definition for the pattern.
front_top_left Vec3 Provider The relative front top-left position to check the pattern.
forwards Direction Provider The forwards direction used for checking the pattern.
up Direction Provider The upwards direction used for checking the pattern.
partial Boolean Provider false Determines whether this type should return true if any of the blocks in the pattern matched.

Key-condition map

An object that defines the corresponding condition of a character in a pattern, similar to how the ingredients of a shaped recipe is defined.

Format

Field Type Default Description
<key> Condition Determines the corresponding condition for the character <key> for a pattern.

Example

{
    "type": "kaya:matches_block_pattern",
    "pattern": [
        [
            "###",
            "###",  // top
            "###"
        ],
        [
            "###",
            "#~#",
            "###"
        ],

        [
            "###",
            "#~#",
            "###"
        ],
        [
            "###",
            "###",  // bottom
            "###"
        ]
    ],
    "where": {
        "#": {
            "type": "kaya:check_block_type",
            "tag": "#minecraft:planks",
            "block": "matching_block"
        },
        "~": {
            "type": "kaya:check_block_type",
            "key": "minecraft:water",
            "block": "matching_block"
        }
    },
    "front_top_left": {
        "type": "kaya:offset",
        "vector": {
            "type": "kaya:entity/position",
            "entity": "this"
        },
        "offset": [
            1.0,
            0.0,
            1.0
        ]
    },
    "forwards": "down",
    "up": "south"
}

This example will check if the entity provided by the kaya:this_entity context parameter is standing on top center of a tank-like structure made up of any wood planks filled with water.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.