Skip to content
Creray edited this page Nov 15, 2026 · 3 revisions

Rules, Triggers & Conditions

Rules determine which crosshair mode should be displayed based on the current targeting situation.

A rule consists of a trigger, a list of conditions, a priority, and a reference to the mode to display.

πŸ“œ Rules

Rules are defined in JSON files inside the following resource pack directory:

assets/<namespace>/crosshair/rule/

Each rule has the following fields:

Field Type Description
priority Int Determines which rule takes precedence when multiple rules match.
trigger Trigger Specifies the targeting situation in which the rule is evaluated.
conditions Condition Additional requirements that must be satisfied for the rule to match.
mode Mode The crosshair mode to display when the rule matches.

Example

{
  "priority": 100,
  "trigger": "targeted:target_entity",
  "conditions": [
    "targeted:is_living_entity"
  ],
  "mode": "targeted:health_indicator"
}

In this example, the rule matches when targeting a living entity and selects the targeted:health_indicator mode.

⚑ Triggers

A Trigger specifies the targeting situation in which a rule is evaluated.

For example, a trigger can identify whether the player is targeting an entity, a block, or nothing.

Built-in triggers

Identifier Description
targeted:target_entity The player is targeting an entity.
targeted:target_block The player is targeting a block.
targeted:target_empty The player is not targeting an entity or block.

βœ… Conditions

A Condition specifies an additional requirement that must be satisfied for a rule to match.

A rule can contain multiple conditions. All conditions must be satisfied for the rule to match.

Built-in conditions

Identifier Description
targeted:is_living_entity The targeted entity is a living entity.
targeted:is_waxed_block The targeted block is waxed.

πŸ‘‰ Examples

Show a health indicator when targeting living entities

{
  "priority": 100,
  "trigger": "targeted:target_entity",
  "conditions": [
    "targeted:is_living_entity"
  ],
  "mode": "targeted:health_indicator"
}

Show an expanded crosshair when targeting waxed blocks

{
  "priority": 100,
  "trigger": "targeted:target_block",
  "conditions": [
    "targeted:is_waxed_block"
  ],
  "mode": "targeted:expanded"
}

Show a circle crosshair when targeting entities

{
  "priority": 0,
  "trigger": "targeted:target_entity",
  "conditions": [],
  "mode": "targeted:circle"
}

See Creating Custom Modes for the resource-pack structure and Tracks & Track Controllers for animation configuration.