Guardian

Guardians are pufferfish-like hostile mobs that spawn in and around ocean monuments. They attack with a slow-charging laser beam, and inflict retaliatory damage when damaged by a melee attack.

Spawning
Guardians spawn naturally in ocean monuments. They require water, flowing or stationary, to spawn.

$$ guardians spawn less often in ocean open to the sky than they do in covered areas (such as inside or underneath the monument). Specifically, spawning fails 95% of the time if the spawning water block is below sea level (Y=63 by default), all blocks between the spawning water block and sea level are liquid or fully transparent, and the block at sea level has a view of the sky. They can spawn only if the spawning block and the block below the spawning block are both water.

$$, guardians are structure spawns, spawning in water source blocks in 25 pre-determined spawning columns. Guardians usually do not (or possibly never) spawn near a player. Also, guardians seem not to spawn below solid blocks such as the prismarine blocks of the monument unless there are no water source blocks available above the solid blocks. This means that guardians don't spawn inside an ocean monument until most or all of the spawning column blocks above it are unavailable (i.e., no longer water source blocks). Guardians can spawn between Y=39–61 (inclusive, from the monument floor to one block above its highest point). To find the X and Z coordinates of the columns, start counting from the northwest corner of the monument. That is, standing on the furthest corner prismarine block with the smallest X and Z coordinates, let's say (X, 41, Z). The coordinates of each spawning spot are in a grid at X+2, X+13, X+29, X+45, and X+55, combined with Z+2, Z+13, Z+29, Z+45, and Z+55. For example, the bottom of the most northwest column is at (X+2, 39, Z+2) and the top block belonging to the southeast corner column is at (X+55, 61, Z+55). The guardians spawn at the northwest corner of a spawning column block, which can be helpful for some guardian farming mechanics such as causing them to spawn inside of a portal where they are immediately sent to the nether.

Guardians will spawn even if the monument has been destroyed by the player.

Drops
When killed, guardians always drop 0-2 s. Looting increases the maximum prismarine shard drop by one per level, for a maximum of 5.

They also drop one of the following:
 * 40% chance of dropping a ( if killed by fire). An additional 0-1 drops are added per level of Looting for a maximum of 4 cod with Looting III.
 * 40% chance of dropping . An additional 0-1 drops are added per level of Looting for a maximum of 4 prismarine crystals with Looting III.
 * 20% chance of dropping neither.

When killed by the player Guardians have a 2.5% chance of dropping a random fish as an extra drop in addition to the normal fish drop. This chance is increased by 1% per Looting level, for a maximum of 5.5% with Looting III. This drop uses the same chances that fishing uses, resulting in a 60% chance for raw cod, a 25% chance for raw salmon, a 13% chance for pufferfish, and a 2% chance for tropical fish. A guardian on fire drops cooked fish.

Guardians also drop when killed by a player or tamed wolf.

Behavior
Guardians swim around in water, attacking any players, squid, glow squid, or axolotl that come into range of its laser. They swim in abrupt charges, moving their tail rapidly when doing so. When swimming, their spikes retract. When not swimming, they sink slowly and their spikes extend and quiver.

The guardian's eye follows and stares at any nearby players, and always looks directly at its target. In Java Edition, the eye does not follow unarmored players under the effects of a potion of Invisibility and the guardians cannot attack them. A player can wear one piece of armor while under the effects of Invisibility and not be attacked.

Stationary guardians can be pushed by flowing water, but swimming guardians cannot. When pushed horizontally, they move significantly faster than other mobs pushed by water.

When out of water, guardians squeak while flopping about. They do not suffocate in air and can live indefinitely out of water. Their spikes always extend when out of water.

Guardians, as aquatic mobs, are affected by the Impaling enchantment.

Combat
Guardians have two methods of attack: a laser and a defensive attack analogous to the Thorns enchantment. Unlike most other hostile mobs, a guardian does not follow a player who moves out of sight. Instead, it simply continues swimming until the player becomes visible again to start charging its laser.

Guardians attack players, axolotls, and squid. Otherwise, a guardian does not retaliate against mobs (such as iron golems) that attack it, other than damaging the attacking mob with its natural thorns defense.


 * Laser

The laser takes 2 seconds to charge, doing no damage in the meantime. It starts out purple and fades to yellow. Once charged, the laser flashes green and deals regular damage and additional  magical damage on normal difficulty. The latter bypasses armor. Guardians swim around for 3 seconds before firing again. If the target approaches while the guardian is loading its laser, it stops firing and swims away until it is at a comfortable range, at which point it continues attacking. The laser cannot be dodged or blocked by a shield and has a maximum range of 15 blocks.

Once the target is out of range, or if the laser is obstructed by solid blocks (including transparent blocks like glass), the guardian's laser disengages.


 * Spikes defense

Guardians deal damage each time it is hit with a melee attack while its spikes are extended, similar to the Thorns armor enchantment. If cornered, the guardian usually extends its spikes and fires at the player, even at point-blank range.

Sounds
Guardians use the Hostile Creatures sound category for entity-dependent sound events.



ID




Entity data
Guardians have entity data associated with them that contains various properties.




 * See Bedrock Edition level format/Entity format.
 * See Bedrock Edition level format/Entity format.

Trivia

 * A guardian's eye is actually the "head" part of the mob's model. This gives the illusion of a dynamic eye.
 * Guardians' laser-beam attacks are affected by the potion of strength, which normally affects only melee attacks.
 * When placed or spawned on a slime block, guardians start bouncing and continue and each bounce higher than the last, until each bounce brings the guardian to 17 blocks height.
 * In the texture file for the guardian, "jeb" is written in the bottom right corner.
 * If summoned with, the guardian's eye still follows the player.
 * $$, guardians do not make the flopping sounds while on land.