Skip to content

Custom Modes

Creray edited this page Nov 11, 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 animations that display sprites and tracks that control their progress over time.

Each animation is associated with a track. A track produces a normalized progress value ranging from 0 to 1, which determines which sprite the animation displays.

Rule

A Rule defines when a particular crosshair mode should be displayed. It consists of a trigger, a set of conditions, a priority, and a reference to the mode to activate.

When the player's targeting state matches a rule's trigger and all its conditions are satisfied, the rule becomes eligible for activation. If multiple rules match, their priorities determine which one takes precedence.

πŸ“ 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 sprites, that can be referenced in animations
β”‚       └── <...>                            # 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.

<The root tag>
β”œβ”€β”€ tracks          # Track[]: List of track definitions (JSON objects)
β”‚   β”œβ”€β”€ id          # String: Unique identifier of this track. Visible only within the current mode
β”‚   β”œβ”€β”€ duration    # Int: Track duration in ticks
β”‚   └── controller  # Controller: Defines how the track's progress is controlled
└── animations      # Animation[]: List of animation definitions (JSON objects)
    β”œβ”€β”€ track_id    # String: ID of on of the tracks defined above
    β”œβ”€β”€ limited_by? # String: ID of another track that limits this animation's progress
    └── sprites     # Identifier[]: List of sprites used by this animation, selected according to the controlling track's progress

πŸ“œ Rule

A rule defines the conditions under which a particular crosshair mode should be activated.

<The root tag>
β”œβ”€β”€ priority      # Int: Priority of this rule. Higher values take precedence over lower ones
β”œβ”€β”€ trigger       # Trigger: Defines when this rule is evaluated
β”œβ”€β”€ conditions    # Condition[]: List of conditions that must all be satisfied for the rule to match
└── mode          # Identifier: ID of the crosshair mode to activate when this rule matches

Note

This page is a work in progress.

Clone this wiki locally