Repository navigation
Custom Modes
Targeted extends vanilla Resource Packs with support for custom animated crosshairs.
A Mode defines the appearance and animation behavior of a crosshair. It consists of tracks that control animation progress and animations that display sprites.
Each animation is associated with a track. The track's normalized progress,
ranging from 0 to 1, determines which sprite the animation displays.
A Rule determines when a particular crosshair mode should be displayed.
Rules use triggers, conditions, and priority to determine which mode should be activated.
See Rules, Triggers & Conditions for details.
A resource pack can define custom crosshair modes and rules using the following directory structure:
name/
βββ assets/
β βββ <namespace>
β βββ crosshair/
β β βββ mode/ # JSON files defining crosshair modes
β β βββ rule/ # JSON files defining rules
β βββ textures/gui/sprites/crosshair/ # Crosshair sprite textures
β βββ <...> # Other resource pack files
βββ <...> # Other Resource pack files Modes are defined as JSON files located in <pack_name>/assets/<namespace>/crosshair/mode/.
The filename (without the .json extension) serves as the mode identifier that can be used
in rules.
For example, my_cool_mode.json defines the mode namespace:my_cool_mode.
A mode consists of two arrays:
| Field | Type | Description |
|---|---|---|
tracks |
Track[] |
List of track definitions. |
animations |
Animation[] |
List of animations that display sprites according to track progress. |
{
"tracks": [
{
"id": "transition",
"duration": 3,
"controller": "targeted:transition_progress"
}
],
"animations": [
{
"track_id": "transition",
"sprites": [
"example:crosshair/frame_0",
"example:crosshair/frame_1"
]
}
]
}An Animation associates a list of sprites with a track. The track's progress determines which sprite is displayed.
Animations are defined in the animations array of a mode.
| Field | Type | Description |
|---|---|---|
track_id |
String |
ID of the track controlling this animation. |
limited_by |
String? |
Optional ID of another track that limits the animation's progress. |
sprites |
Identifier[] |
List of sprite identifiers displayed by the animation. |
Rules determine which mode is displayed for a particular targeting situation.
Rules are defined in
assets/<namespace>/crosshair/rule/.
See Rules, Triggers & Conditions for the rule format, built-in triggers, conditions, and examples.