Combat and Targeting - clockworktownsmp/clockwork-bosses GitHub Wiki

Combat and targeting

Clockwork Bosses uses Minecraft's own health and Warden combat systems, then applies your settings to the bosses you create. Normal Wardens keep doing normal Warden things.

Health and scale

Boss maximum health supports 1–1,000,000 HP. Native modifiers, damage, healing, saving, and synchronization still apply; the final modified maximum is bounded to that range.

When you reload, the boss keeps the same percentage of its health. Loading a saved entity preserves its saved HP, rather than healing a boss that an older build had capped.

Scale accepts 0.25–4.0. 1.0 is normal Warden size. A phase can override scale or inherit it with null.

Attack timing

Base settings live under attacks.melee and attacks.sonic_boom. Phases and Attack children can override them. 20 game ticks = 1 second at normal server speed.

Setting Range Default Effect
Melee charge_time_ticks 0–12,000 0 Delays the native impact during the wind-up.
Melee recovery_time_ticks 0–12,000 4 Extends the remainder of the swing after impact.
Sonic Boom charge_time_ticks 0–1,000,000 40 Controls beam wind-up; 0 fires immediately.
Sonic Boom recovery_time_ticks 0–12,000 26 Controls post-shot recoil; extends cooldown when longer.

Before swinging again, the boss has to finish its recovery and the successful-hit cooldown recorded for that attack. Blocked swings still have recovery. Minecraft also schedules native melee at least 18 ticks apart, so lowering the cooldown below that won't necessarily make it swing faster.

Close range

When melee is enabled, close targets take priority for melee and cancel Sonic Boom charging. Disable phases.<phase>.melee.enabled in the desired phase to let an enabled Sonic Boom charge and fire at close range. Its cooldown, charge time, ranges, and line-of-sight rules still apply.

Pending attacks

In 0.2.0, a pending melee hit records its target and deadline. The Warden keeps navigating, and either actor can move without restarting the timer. Native reach and visibility are checked at impact; an escaped or hidden opponent receives no damage, and returning later cannot revive the missed hit. Target loss/replacement, death, unload, phase changes, reload and action interruption still cancel pending work. The mod does not load a chunk to resolve a hit. The last completed swing keeps its captured cooldown/recovery across transitions.

A Sonic Boom captures its complete definition when charging starts: timing, damage, cooldown, range, line of sight, knockback, and close-range melee rule. An uninterrupted charge uses that captured definition.

Stable 0.2.0 and beta.6: phase transitions, including healing into another phase, and reload interrupt the owning action and cancel its pending beam. A replacement charge gets its full wind-up. Completed attacks retain their cooldown. The earlier pre-API implementation could let a captured beam finish after reload; that is historical behavior, not the current contract. See recorded native evidence and the later beta.6 checkpoint.

Lost, switched, or invalid targets and the captured obstruction/range rules can cancel the beam. A roar or melee taking over also cancels it. An old beam's completion cannot advance a replacement subphase sequence. Unload/removal clears runtime attack state.

Follow range

follow_range: 0 means automatic arena sizing:

  • Radius arena: use its boss-centered radius.
  • Box arena: use its full 3D diagonal.
  • Cap the automatic result at 256 blocks.
  • Unset arena: fall back to 24 blocks.

Set a positive value to choose the follow range yourself. Existing templates may still have positive phase overrides; clear those to use the automatic base range. Follow range controls how far the boss detects and navigates toward targets. Sonic Boom has its own shot range.

Target rotation

These are the base defaults. Each field can be overridden by a phase; Attack children can override targeting too.

{
  "targeting": {
    "switch_chance": 0.5,
    "mode": "random",
    "min_target_ticks": 60,
    "min_attacks": 1,
    "max_attacks": 4,
    "announcement": {
      "enabled": true,
      "text": "RUN, <player>!",
      "cooldown_ticks": 60,
      "display_ticks": 20
    }
  }
}
  • switch_chance is 0–1 in JSON, or 0–100% in the GUI.
  • mode is nearest, random, or farthest.
  • min_target_ticks holds a valid target for at least 60 ticks by default. 0 disables this time gate.
  • min_attacks defaults to 1 completed attack before switch-chance rolls.
  • max_attacks defaults to 4, must be at least min_attacks, and forces a switch to another eligible player once the time gate allows it.

A switch chance of 0 does not guarantee permanent targeting. max_attacks can still force rotation. The time gate takes priority, so fast attacks may exceed the maximum until a later eligible completion.

Counts reset on actual target changes and carry across health-phase changes. Completed melee swings, including blocks, and fired beams count. Cancelled charges and disabled/cooldown-rejected attempts do not. Dead, disconnected, removed, or ineligible opponents bypass the hold.

The boss uses whichever targeting settings are active when the attack finishes. Minecraft still chooses the first target. If the switch roll fails, or there's nobody else eligible, the boss keeps chasing the same player.

Eligible targets

The previous/current opponent is excluded by UUID when choosing an alternative. Native eligibility excludes creative, spectator, dead, disconnected, allied, and invulnerable players.

The configured encounter region and native follow range bound the ordinary pool. An unset region falls back to follow range. An invalid or dimension-mismatched configured region does not expand the pool.

For ranged rotation, the completed beam's captured horizontal/vertical ranges and optional line-of-sight rule determine reach instead of follow range. Arena boundaries still apply.

Target warnings

Announcements name the actual new target, including first acquisition, and go to that player plus current boss-bar viewers. The boss doesn't announce the same target again when it reassigns them.

Defaults hold the title for 20 ticks, with 2/4-tick fades and at least 60 ticks between ordinary titles per recipient across bosses. Suppressed titles are not queued and do not delay attacks. A newly targeted player can receive a personal warning after a recent audience warning about somebody else; recent personal warnings remain throttled across bosses.

These titles share Minecraft's normal title HUD. Disable announcement.enabled if another feature needs to own it.

Animation and sound

The bundled base charge is 40 ticks. Captured Sonic Boom charge time scales its native wind-up animation: 68 ticks is half the speed of the native 34-tick charge, and 17 ticks is twice as fast. Its native charge sound keeps normal pitch and duration, so it may finish before a long charge or outlast a short one.

Clients that start tracking the boss late use its current synchronized progress. Network delays can still make feedback late or skip a short intermediate animation; damage remains server-authoritative.

⚠️ **GitHub.com Fallback** ⚠️