Skip to content
Nicholas Kreimeyer edited this page Nov 4, 2026 · 2 revisions

This page explains which entities a turret is allowed to shoot and how it picks one of them.

1. Which entities are valid targets

A turret looks at all living entities around it (refreshed every 10 ticks, turrets.turretTargetSearchTicks) and drops every entity that

  • is dead, or on the config block list general.mobBlackList (armor stands by default),
  • is out of range: the range is checked per axis (a cube around the turret), up to the range set in the base GUI,
  • cannot be seen from the turret (line of sight to its eyes), or would need the turret to aim into its own base,
  • is the owner, a trusted player or a scoreboard team member of the owner (see Ownership and Trusted Players),
  • is a pet of the owner or a trusted player, or a tamed horse without owner,
  • already has slowness (Slowing Turret only).

Each remaining entity is classified:

  1. on general.neutralForceList → neutral (cows by default)
  2. on general.mobForceList → hostile (creepers by default)
  3. otherwise monsters are hostile, animals and bats are neutral, everything else (players, golems, villagers, water creatures…) is neither.

An entity on both force lists is ignored on both and an error is logged.

It is a valid target if

  • it is hostile and the base attacks mobs, or
  • it is neutral and the base attacks neutrals, or
  • it is a player and the base attacks players.

The server can switch each category off for all bases with turrets.globalCanTargetMobs, globalCanTargetNeutrals and globalCanTargetPlayers.

With multi targeting enabled on the base, entities that another turret of the same base is already shooting at are skipped.

2. Which target is preferred

Every turret type has five priority weights. For each valid target the turret computes a score, and the target with the highest score wins (on ties, the first one found):

score = MAX_HP       × current health
      + HP_REMAINING × missing health (max health − current health)
      + DISTANCE     × distance to the turret in blocks
      + ARMOR        × (armor points + 1)
      + PLAYER       × (100 if the target is a player, else 0)

A positive weight prefers targets with a high value of that factor, a negative weight prefers a low value, and 0 ignores it. The score only decides the order; a target with a negative score is still shot when it is the best one left.

The weights are fixed per turret type:

Turret MAX_HP HP_REMAINING DISTANCE ARMOR PLAYER
Disposable Item 5 5 −5 1 10
Potato Cannon −5 −5 −5 1 10
Crossbow −5 −5 −5 1 10
Melee 1 1 0 10 10
Gun 1 10 −5 −5 10
Incendiary 10 −5 −2 10 10
Grenade Launcher 10 10 20 1 10
Slowing 1 1 0 10 10
Rocket Launcher 10 10 20 1 10
Teleporter 1 −10 0 10 10
Arc 5 10 2 −10 10
Laser 5 10 2 −10 10
Rail Gun 10 10 20 40 10
Plasma Launcher 10 10 20 1 10

So, for example, the Rail Gun prefers far away, heavily armored targets, the Laser avoids armored targets, and the small projectile turrets go for close, weak targets. Every turret prefers players over mobs a bit, if it is allowed to target players at all.

Turrets added by other mods set their own weights (see Turret API).

Changed in 4.0: in 3.x (1.12.2) the factors were multiplied and non-players got −100 for PLAYER, which made a single zero factor zero the whole score and inverted the ranking of mobs. In 4.x the factors are added up, and distance is the real distance (3.x used a cube root by mistake).

Clone this wiki locally