Fluid

Fluids are blocks that can, as the name suggests, flow and spread. There are currently only two fluids in Minecraft: Lava and Water.

How fluids work


Fluids are cellular automata. The rules appear to be as follows:

Falling fluid
An air block below a fluid block is converted into a fluid block of that type. This happens faster for water than for lava.

Fluids that are suspended above an open area by one block thick of material will seep through the material and drip to the floor. Lava particles that are seeping do not cause damage or start fires. This makes digging upwards safer, since you can tell if you are near a pool of water/lava.

Fluid level
Each fluid block has a level value. Source blocks have a level of 0, and the maximum level depends on fluid type.


 * Water: 7
 * Lava: 3 (7 in The Nether.)

Note: The "level" value increases as the water is further from the source. A high level value means that the water is actually physically downhill.

Fluid pressure
There is also something called fluid pressure power. Fluid pressure (or FP for short) is a measure of how much force a fluid is pushing with in a particular fluid block.

It is measured by two fluid coordinates. Fluid coordinates are measured by observing the level of the fluid from the back of the block to the front of it.(The front is the side in which the fluid is pushing to).

The top of the block is number 100, and the bottom is 0. So, because still water in a lake takes up the entire block space, its fluid coordinates are 100 and 100, the fluid level reaches the top.

That is because the fluid level comes not at 0 (the bottom of the fluid block [OR NO FLUID AT ALL] ) but instead 100. But it is very important to know both coordinates. In still fluids, they are always both 100 and 100.

The numbers show no difference from back to front. but in a different fluid block, with coordinates of 76 and 45, there is lots of change and the level is dropping,so we know the force of the water. This can be useful when trying to find the force requided to drown a mob, or to transport block entities.

However, fluids should be thought of in continuality, instead of simply blocks.

Still fluids
To keep track of which blocks are actively flowing, Water and Lava each have a pair of block IDs. For water, there is Water (8) and Still Water (9). Still Water never updates. Water updates periodically and will change itself to Still Water when it cannot spread any further. When fluids have air to the left and right of it, it will appear to be still, since it can't flow in two directions.

Updating a block next to Still Water will turn it back to Water so it can spread some more.

If you edit either type of fluid block into your inventory, they will spread when placed, since placing a block causes updates.

Fluid block update cases
The state of a fluid block only updates in certain cases:


 * On creation
 * If one of the 6 neighbouring blocks' state changes.
 * If its own level changes

State changes that cause an update include:


 * Adding or removing a block
 * A neighbouring block's level changes
 * A redstone wire switches on or off

Fluid block update process
When a fluid block updates, it performs the following checks.


 * Check inward flow
 * If there is a fluid block of the same type above, set level to 1
 * Otherwise, reduce or increase level in steps of 1 so that it is 1 higher than the one of its 4 neighbouring block with the lowest level*
 * If level is increased past the max level, replace fluid block with air block.
 * Level cannot be decreased below 1

* This does not affect source blocks (level = 0)


 * Check outward flow
 * This only happens for fluid blocks of less than the max level value
 * Determine the shortest distance to a fall, but only scan 5 blocks distance*
 * If any of the directions tied for shortest have an air block, convert that air block to a fluid block with a level of 1 more than the current block)*

* This means that lava will flow towards a drop that it cannot reach.

Source creation
A water block is converted into a source block if all three of these conditions hold:
 * it is bordered by 2 water sources
 * the 2 sources are on the same horizontal level as it
 * there is a solid, opaque block underneath it

Lava source blocks cannot be created.

Mixing of fluids
If a fluid flows into a block occupied by another fluid, then the block turns into a solid block according to the following rules:
 * If Water flows into a Lava source block, then Obsidian is produced.
 * If Lava flows downward into Water, then Stone is produced.
 * if Water flows horizontally into downwards flowing Lava, nothing happens.
 * Otherwise, Cobblestone is produced.

When determining the shortest distance to a drop, other fluid blocks are assumed to be equal to air.

History
As of Beta 1.9 pre-release 1, fluid that is suspended above an open area by one block thick of material will seep through the material and drip to the floor. Lava that falls onto water will produce stone. Prior to 1.9 pre-release, the water would be replaced with falling lava.

In Beta 1.9 Pre-release 5, a lava block could be converted into a source block if the following conditions were met:
 * it is bordered by 4 lava sources in a cross-like arrangement
 * the 4 sources are on the same horizontal level as it
 * there is a solid, opaque block underneath it

As of Minecraft 1.0, lava source blocks cannot be created.

Trivia

 * Flowing lava will often stay where it is even if the source block is removed. This can make clearing lava quite difficult at times. Lava will, however, recede if there are no other lava blocks touching it. This means that it is possible to make, for example, 1 block wide lava doors with pistons, but no wider, unless the door is zig-zagged to only touch other lava blocks diagonally.

Flüssigkeit Fluides Vloeistoffen Ciecze Жидкости 液体