Guardian

The Guardian is a hostile mob that resembles an angered pufferfish which only spawns underwater, in Water Dungeons. Its eye will always look towards the viewpoint of a nearby player. It also has a larger, grey, mini-boss variant called the Elder Guardian.

The Guardian attacks by sending out a large laser beam which harms the player. In addition, Guardians can target and damage players who are riding in boats; however once the player is out of range, the Guardian's laser will disengage from the player, and deal no damage.

Behavior
Guardians will swim around in water, attacking any players or squids that come into sight. They swim in abrupt charges, moving their tail rapidly when doing so. Unlike squids, Guardians will not die outside of water, instead they will jump and flail around, making wet, squishy noises. They will quickly move towards the nearest water source, at which point they swim away. When swimming, their spikes retract and they don't deal damage when attacked. Guardians are also resistant to lava and fire. When not swimming they sink.

Guardians' eyes will follow and stare at any nearby players, and will always look directly at who they're attacking. This makes them the first mob with dynamic eyes.

Attacking
The Guardian has two methods of attack, engaging a laser-like beam and a thorn-like attack. The beam takes several seconds to charge, doing no damage while doing so, and changes from purple initially to bright yellow when fully charged. Once charged, the beam abruptly disappears and deals damage. The Guardian will swim around for a few seconds before firing again. If the target comes near the Guardian while it is firing its beam, it will stop firing and swim away until it is at a comfortable range, at which point it will continue attacking. The beam cannot be dodged, as it follows the player, but can be obstructed by solid blocks.

Guardians also have spikes on their bodies. Although these spikes don't do any direct damage upon contact or as a melee attack, they act similar to the Thorns enchantment. The Guardians can extend and retract their spikes. If a player attacks the Guardian when its spikes are extended, the player takes a small amount of damage.

Combat
Guardians are very resistant to melee attacks when under water, as the player will not be able to quickly approach the Guardian due to the water's slowing effect. Guardians will swim away when approached by a player it is targeting, and the Guardian will deal 1 heart of damage every time it is hit when its spikes are extended. If cornered, the Guardian will usually extend its spikes and fire at the player, even at point blank range.

The Guardians are resistant to fire damage, but if somehow brought on land, they sometimes take fall damage from their swift movement.

If the player(s) must fight a Guardian in melee, they should try to corner it and hope for the best; or else try to trick it into swimming within melee range repeatedly.

The Guardian cannot shoot as fast as a player with a bow can, so a skilled player will be able to shoot the Guardian, and then hide to break the beam's lock, repeating until the Guardian is dead. If the Guardian is in shallow water the player(s) can use a fishing rod to pull it out of the water where the player(s) can then kill it using melee attacks without being shot at or hurt by the spikes.

Fighting Guardians is incredibly dangerous without armor. Armor is essential to combating Guardians, especially within the Water Dungeons. Entering their territory without armor will almost always lead to a swift death, even if armed with a sword or bow and arrow.

Farming
Since these underwater dungeons usually spawn with a large space underneath them, the new sponges can remove the water in this area and walls can be built to keep it from re-flooding. Then the dungeon can be restructured to optimize spawn rates and the floor of the temple (or ceiling of the dry room underneath) can be replaced with signs. Iron golems can be placed in the dry room to kill the falling Guardians and hoppers to collect the loot.

This video shows an approach to this idea also, This video shows a much more advanced method of farming guardians. Although this farm is fully automatic, it has its disadvantages as well: It is extremely hard to build, as a wall has to be constructed underwater with the guardians constantly attacking and the Elder Guardians constantly causing Mining Fatigue; requires extreme amounts of iron for massive amounts of iron golems and hoppers; and the iron golems will eventually die of spike damage.

Trivia

 * Guardians' eyes will still follow a completely unarmored player under the effects of a Potion of Invisibility, but won't attack them. Guardians will still attack Squids under that same potion effect though.