Timer
Tick-loop clock: 20 ticks/sec, renderPartialTicks interpolation, timerSpeed for timer cheats to target.
Updated 2026-09-12
Packets Referenced (0)
Related Vanilla Internals
Deep Analysis
Client tick-rate driver in net.minecraft.util. Owned by Minecraft game loop, called each frame via updateTimer. Converts wall-clock delta into elapsedTicks and renderPartialTicks. Matters for movement because it bounds ticks to 10 and scales by timerSpeed.
Key Methods (6)
Constructs timer with target ticks-per-second, default 20.
Stores ticksPerSecond. Seeds lastSyncSysClock via Minecraft.getSystemTime and lastSyncHRClock via nanoTime ms. Initializes timeSyncAdjustment to 1.0.
Advances tick counters from wall-clock delta each frame.
Computes sysClock delta j and hrClock seconds d0. If j outside 0-1000ms resets lastHRTime. Otherwise accumulates counter for drift correction.
Calibrates hi-res clock against system clock once per second.
When counter exceeds 1000ms computes ratio counter/(k-lastSyncHRClock). Blends into timeSyncAdjustment with 0.2 factor. Resets counter and anchor.
Converts seconds delta into fractional tick progress.
Formula d2=(d0-lastHRTime)*timeSyncAdjustment. Clamps d2 to 0-1 via MathHelper. Adds d2*timerSpeed*ticksPerSecond to elapsedPartialTicks.
Extracts whole ticks and enforces spiral-of-death cap.
elapsedTicks=(int)elapsedPartialTicks then subtracts back fractional remainder. Caps elapsedTicks at 10. Prevents huge catch-up bursts after lag.
Exposes interpolation factor for render and movement smoothing.
Public float field set equal to elapsedPartialTicks each update. Frozen when paused to avoid jitter. Read by entity rendering and camera code.
Internal State
Related Vanilla Internals
Full Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
Deobfuscated MCP 1.8.9 source of Timer from Marcelektro/MavenMCP-1.8.9 (net/minecraft/util/Timer.java), stored verbatim.