Repository navigation
Rule
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 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. |
{
"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.
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.
| 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. |
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.
| Identifier | Description |
|---|---|
targeted:is_living_entity |
The targeted entity is a living entity. |
targeted:is_waxed_block |
The targeted block is waxed. |
{
"priority": 100,
"trigger": "targeted:target_entity",
"conditions": [
"targeted:is_living_entity"
],
"mode": "targeted:health_indicator"
}{
"priority": 100,
"trigger": "targeted:target_block",
"conditions": [
"targeted:is_waxed_block"
],
"mode": "targeted:expanded"
}{
"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.