Tick

Nearly all video games (including Minecraft) are driven by one big program loop. Just as every gear in a clock is synchronized with the pendulum, every task involved in advancing a game simulation is synchronized with the game loop. Appropriately, one cycle of the game loop is called a tick.

Game tick
A gametick is where Minecraft's game loop runs once. The game normally runs at a fixed rate of 20 ticks per second, so one tick happens every 0.05 seconds, making an in-game day lasts exactly 24000 ticks, or 20 minutes. However, if the computer is unable to keep up with this speed, there are fewer game ticks per second (TPS). As the vast majority of actions are timed based on tick count rather than on wall clock time, this means that many things take longer on a slower computer.

A statistic related to ticks per second (TPS) is milliseconds per tick (MSPT), the time a server actually uses to compute a tick. The TPS can be maintained at 20 only if the MSPT is no higher than 50. The following often contribute to server-side lag:
 * Hoppers constantly try to search for items above them. Cover with any item with an inventory slot, composter, as this stops the checks for items. Alternatively, use water flow-based transport which is faster in bulk.
 * Redstone machinery. Redstone components, especially redstone dust cause excessive amounts of block updates and lag. Disabling redstone contraptions and clocks when not in use can help mitigate this.
 * Mob AI. Use torches to guide hostile mob spawning. Use more efficient farms for animals.

The MSPT value is displayed in the F3 debug screen as "ms ticks" $$. The frame time graph shows the TPS value. Both displays are available only as a multiplayer host or singleplayer since the stats come from the integrated server of your minecraft game.

Game process
$$, in each game loop the following actions are processed in order:
 * Functions with  or   tag are executed
 * Each dimension is ticked in order of overworld, the nether, and the end. For each dimension:
 * The time is sent to the client
 * The world border is updated
 * Weather logic
 * Player sleeping logic
 * If this dimension is overworld:
 * The game-time and day-time increase
 * Scheduled functions are executed
 * For each loaded chunk:
 * Chunk info is sent to the client
 * Chunk tick logic
 * Phantoms, pillagers, cats, and zombie sieges will try to spawn
 * Entity changes are sent to the client
 * Chunks try to unload
 * Scheduled ticks are processed
 * Scheduled block ticks
 * Scheduled fluid ticks
 * Raid logic
 * Wandering traders try to spawn
 * Block events are processed
 * Entities are processed
 * Block entities are processed
 * Player entities are processed
 * The game will try to autosave if it has been 6000 ticks
 * Packets from client are processed

Chunk tick


As a part of a game tick, specific chunks are ticked on every game tick.

$$, chunks with loading type of entity ticking (see Chunk) and with horizontal distance between its center and a player (not in spectator mode) less than 128 blocks are ticked on every game tick. A few things should be noted here: first, the chunk should be loaded as an entity-ticking chunk. Second, if the chunk receives chunk tick, even if some blocks in the chunk are out of the 128-block radius, they can receive random tick as normal. Third, because 128 blocks is the horizontal distance, the player's position along the y-axis does not matter.

$$, all loading chunks are ticked on every game tick.

The following things will happen when a chunk gets ticked:
 * Mobs naturally spawn.
 * During a thunderstorm, lightning may strike somewhere in the chunk ($1/100000$ chance).
 * $1/16$ chance that one column is chosen for weather checks on the topmost block:
 * If in a cold biome, water freezes into ice if possible.
 * If snowing, a snow layer is placed if possible.
 * Additionally, cauldrons can be filled with powder snow.
 * If raining, a cauldron is filled.
 * A certain number of blocks within the chunk receive random block ticks, as described below.

Random tick
Chunks consist of one subchunk per 16 blocks of height, each one being a 16×16×16=4096 block cube. Sections are distributed vertically starting at at the lowest y level. Every chunk tick, some blocks are chosen at random from each section in the chunk. The blocks at those positions are given a "random tick".

$$, the number of blocks chosen from each section is specified by (defaults to 3), and one block can be chosen multiple times in one chunk tick. $$, it also depends on (defaults to 1), but it specifies only relative speed instead of the exact number.

Most blocks ignore this tick, but some use it to do something:
 * Crops may grow or uproot.
 * Mushrooms may spread or uproot.
 * Vines may spread.
 * Fire may burn out or spread.
 * Ice and snow layers may melt.
 * Leaves may decay.
 * Farmland hydration is updated.
 * Cacti, sugar cane, kelp, bamboo, chorus flowers and sweet berry bush may grow.
 * Grass blocks and mycelium may spread.
 * Grass blocks, mycelium, and nylium may decay (if and only if the condition is met).
 * Saplings may grow into a tree.
 * Lava may set fires nearby.
 * Lit redstone ore turns off.
 * Nether portal blocks may spawn a zombified piglin.
 * Turtle eggs crack or hatch.
 * Campfire smoke appears.
 * Budding amethyst may grow an amethyst bud on one of its sides.
 * A block of copper (or any of its non-oxidized variants) may advance one stage in oxidation.

$$, because random block ticks are granted randomly, there is no way to predict when a block can receive its next tick. The median time between ticks is 47.30 seconds (946.03 game ticks). That is, there is a 50% chance for the interval to be equal or shorter than 47.30 seconds and a 50% chance for it to be equal or longer than 47.30. However, sometimes it is much longer or shorter: for example, there is a 1.5% chance for the interval to be less than one second and a 1% chance for the interval to be over five minutes. On average, blocks are updated every 68.27 seconds (1365.33 game ticks). For the math behind these numbers, see the Wikipedia entries for the geometric distribution.

Scheduled tick
Some blocks can request a tick sometime in the future. These "scheduled ticks" are used for things that have to happen in a predictable pattern—for instance, redstone repeaters schedule a tick to change state $$, water schedules a tick when it needs to move.

As a part of a game tick, each block position that has requested a scheduled block tick gets ticked on the specific game tick.

$$, there are two types of scheduled ticks: block ticks and fluid ticks. Block ticks are executed first based on priority, and then based on scheduling order. A lower value for priority results in earlier execution during the scheduled tick phase. If a redstone repeater is facing the back or side of another diode, its block tick will have a priority of -3. If a redstone repeater is depowering, it will have a priority of -2. Otherwise, the repeater will have a priority of -1. If a redstone comparator is facing the back or side of another diode, it will have a priority of -1. All other block ticks will have a priority of 0. Then, each block with a scheduled fluid tick will tick. Fluid ticks do not use priorities and are only ordered based on scheduling order.

$$, the maximum number of scheduled ticks per game tick is 65,536. $$, the maximum number of scheduled ticks in a chunk per game tick is 100.

Redstone tick
A redstone tick describes two game ticks. This creates a $1/10$ of a second delay in the signal of a redstone circuit; that is, the signal's time to travel from a location A to location B is increased by 0.1 seconds. A tick pertains only to the increase in signal time, thus, a signal's travel time can never be decreased in reference to ticks. A redstone repeater has a delay of 1-4 redstone ticks. The default delay is 1 redstone tick, and pressing on the repeater increases it, visually indicated by the slider moving down the block.

$$, redstone ticks are actually not a "real" thing, but a term created by the community to make redstone easier since most redstone components have delays of multiples of 2 game ticks.