Skip to content

Type Specific Predicates

DaFuqs edited this page May 17, 2024 · 3 revisions

What are Type Specific Predicates?

If you do know what that they already: props to you.

Type Specific Predicates are sub-predicates usable in entity predicates. Specifically, in the type_specific sub node. They allow you to check for specific properties, that only exist for certain entity types, for example a foxes variant or a players level.

New Type Specific Predicates

Shulker

  • color (string): The entities color. Omit the value to only match the base vanilla color

Egg Laying Wooly Pig

  • color (string): The entities color
  • sheared (bool): Whether the entity is currently sheared
  • hatless (bool): Whether the entity has wool on it's head when grown

Lurking Lizard

  • frill_variant (id): The entities frill variant, like spectrum:simple
  • horn_variant (id): The entities horn variant, like spectrum:horny
  • color (string): The entities color

Kindling

  • variant (id): The entities variant, like spectrum:default
  • clipped (bool): Whether the entity is clipped
  • angry (bool): Whether the entity is angry

Matching Type Specific Predicates

Type specific predicates can be matched in any entity predicate.

Vanilla example

Matching a type specific predicate, shown based on lightning_rod_with_villager_no_fire advancement.

{
  [...]
  "criteria": {
    "lightning_rod_with_villager_no_fire": {
      "trigger": "minecraft:lightning_strike",
      "conditions": {
        "lightning": [
          {
            "condition": "minecraft:entity_properties",
            "entity": "this",
            "predicate": {
              "type_specific": {
                "type": "lightning",
                "blocks_set_on_fire": 0
              },
              "distance": {
                "absolute": {
                  "max": 30
                }
        [...]
}
Clone this wiki locally