Fish (mob)

"You're not the only new explorer of the updated oceans, mind. We've filled the seas with new types of fish! Above is the delightful pufferfish, which filled me with delightful poison because I was too busy taking that screenshot to swim away in time :("

- Tom Stone

Fish are common passive mobs found in oceans and rivers. They come in 4 main variants: cod, salmon, pufferfish, and tropical fish. Tropical fish have 3584 variants, so the total amount of fish adds up to 3587 fish.

Spawning
Cod spawn in normal, cold, and lukewarm oceans, and their deep variants.

Puffer fish and tropical fish spawn in lukewarm, warm, and deep lukewarm oceans.

Salmon spawn in cold and frozen oceans, and their deep variants. Unlike the other types of fish, they also spawn in normal and frozen rivers. Salmon can spawn in 3 sizes which are small, normal and large.

Drops
Fish drop 1 of their item form when killed:


 * 1 (1  if killed while on fire),
 * 1 (1  if killed while on fire),
 * 1 or
 * 1.
 * A tropical fish will drop the clownfish-textured tropical fish item no matter what its type, pattern or colors are since the tropical fish item only has one texture.
 * 1 (25% chance).
 * Up to 3 bones if it is a salmon, depending on the sizes (25% chance).
 * 1 (5% chance).

Behavior
Cod, salmon and tropical fish tend to swim in schools of fish (a maximum of nine cod, six salmon, and nine of the same tropical per school). Salmon are able to swim up approximately 4-5 blocks in waterfalls. Pufferfish will try to hide in a coral or a coral fan and will spin until it leaves; they will also puff up when approached by dolphins and armor stands. They will also swim up waterfalls, like salmon. In Bedrock Edition, however, pufferfish will also puff up when near most hostile mobs.

The player may collect a fish by a water bucket on it, which gives the player a bucket of fish. Fish placed with buckets will not despawn naturally. When that fish bucket is against a block, it empties the bucket, placing water with that fish swimming in it. An empty bucket may be used as well.

Weaknesses
None of the fish are able to survive out of water. Outside of water, they flop around like guardians for a while until eventually they start to suffocate and die like squids. Cod, salmon and tropical fish will flip around on their sides. They will rotate when flipping. Fish cannot swim or breathe in cauldron water.

Fish have a weakness to weapons that have the Impaling enchantment, which also affects squid, turtles, guardians, elder guardians, and dolphins.

Guardians don't attack fish like they do with squid. This is intended.

Defenses
Pufferfish will puff up when approached by a player in Survival or Adventure mode, drowned, or any non-water mob in a 5x5x5 cube around the fish, going from unpuffed, then semi-puffed, to fully puffed, or instantly to the fully-puffed state. Pufferfish are technically passive mobs but going near one when fully puffed will inflict the player/mob with seven seconds of, and touching them in their puffed form will deal damage separate from the poison. Pufferfish also instantly puff up to their fullest form after taking any kind of damage.

Tropical fish varieties


When tropical fish spawn in the wild, 90% of the time they will come in one of the 22 varieties seen on the right, and the other 10% of the time their patterns, size and colors will be completely random, drawn from any of 2 shapes, 15 colors, 6 patterns, and 15 colors for the pattern. These result in 2,700 naturally-occurring combinations.

With commands, the player can summon tropical fish with black as one or both of their colors, and/or without any visible pattern, though even without the pattern they can still have a pattern color, causing a further 884 possible combinations, 480 of which look the same due to the missing pattern.

Names
Ttropical fish also have assigned names which can be seen after capture, so that the buckets are given names like "Bucket of Plum Blockfish", "Bucket of Sky-Orange Snooper" or "Bucket of Orange-Lime Dasher" In, while the types and colors are seen as tooltips in. Their colors are mostly named according to the colored block names, though with a few exceptions:



The base color will come first, and if the pattern color is different, it will come after that. Lastly, the fish bucket will be given a name according to the shape and pattern of the fish:

Some tropical fish don't follow the normal naming system, and instead reference real-life fish species. Apart from these names, these types of fish aren't different from regular tropical fish in terms of design or behavior.

These varieties are:

Entity data
Cod and salmon have entity data associated with them that contain various properties of the mob. Their entity IDs are  and.

Puffer fish and tropical fish have additional entity data, beyond what other fish have. Their entity IDs are  and   or.

The fish sizes and patterns are depicted in the following table, with white body color and dark gray pattern color.

The 22 varieties of tropical fish most commonly found throughout the world have  tag values from the following table, which also lists what color/shape/patterns come from that value.

The variant number is the sum of the most significant byte * 224 + second most significant byte * 216 + second least significant byte * 28 + least significant byte.