Skip to content

Custom Modes

Creray edited this page Nov 15, 2026 · 9 revisions

Creating Custom Modes

Targeted extends vanilla Resource Packs with support for custom animated crosshairs.

πŸ“Š Core Concepts

Mode

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.

Rule

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.

πŸ“ Directory Structure

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   

🎯 Mode

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.

Mode structure

{
  "tracks": [
    {
      "id": "transition",
      "duration": 3,
      "controller": "targeted:transition_progress"
    }
  ],
  "animations": [
    {
      "track_id": "transition",
      "sprites": [
        "example:crosshair/frame_0",
        "example:crosshair/frame_1"
      ]
    }
  ]
}

Animations

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

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.

Clone this wiki locally