Kzeroko KTM2

Tanning runtime

Persistent hide geometry, workstation ownership and server-authoritative contact.

Updated Nov 1, 2026 3 min read

Tanning is a persistent world workflow. HideWork is the pure material state machine, HideWorkpiece stores it on the portable item, and TanningStationOperations applies authoritative workstation interactions.

The shared vessel fill also reserves the paid, active quench use before checking how many whole buckets fit.

What it does

The vat commits water, agent and raw hides at insertion. Beam contact removes residue or actual hide cells. Rack tension and loaded-world drying determine damage before the final tool passes. Leather tanning describes the player sequence.

Runtime model

ise_hidework stores recipe ID, maker, tone, stage, intact/residue bitmasks, four ties, fault count, completed edge count (finished_sides), wax and drying progress. A 64-bit grid represents an 8×8 surface. SOAK, FLESH, STRETCH, FINISH, DONE and RUINED are explicit stages. Invalid stored geometry becomes ruined rather than restoring material.

Station state owns soak time and stroke timing. Portable state owns permanent damage and drying. Changing stations cannot duplicate material or erase faults. Soaking and drying advance only while loaded; no catch-up tick silently finishes or destroys an absent hide.

Contracts

Use is main-hand, non-spectator, server-authoritative and permission-checked. The server reconstructs a 5-block contact ray; client coordinates do not select the patch. Station use has a 4-tick guard. Empty-hand stirring has its own 20-tick cooldown, starting at the last accepted turn. The repeating 40-tick stroke window applies to scraping. TanningBath supplies both the stir cooldown and the lift predicate to the server and HUD.

BeamFinishing binds one vanilla active main hand to the mounted stack. Each server tick checks the tool, player, permission and contact with surviving leather. LeatherPattern defines the shared contour. After each of its 8 edges, the server saves progress to the hide. The client receives the current edge start time for tool motion. A saved station has no active grip. Durability is charged on the final edge of each pass.

Only the server starts the vanilla active hand. The observing client renders the synchronised edge and tool without claiming either. An early release travels through the vanilla use-release packet even when the server’s grip acknowledgement is still in flight.

Retrieval clears the station before exposing its stack. Finished collection invokes PlayerTanningEvents.ON_LEATHER_TANNED and the quest recipe trigger once, with the resulting grade capped by the current recipe. This event remains internal. Stations scatter stored work on replacement; no transient player session owns the hide.

ArtisanTanningOverlay captures immutable snapshots on the game thread and coalesces updates onto the ModernUI thread. Its non-focusable window retains the original painted rail and marker; hidden windows stop animation invalidation. It never intercepts attack/use input or submits minigame actions. WorkpieceMesh draws only intact cells on the animated workpiece bone; tie bones reflect saved tension. This is authored bone animation plus geometry changes, not cloth simulation.

ArtisanInteractions handles station use before vanilla’s held-item sneak bypass. ArtisanCoordinates.rackCorner is shared by the authoritative contact and the overlay. The rack’s thin outline reaches its hanging plane; authored tie indices account for GeckoLib’s mirrored X coordinates. Drying requires balanced tension, and loosening never adds new damage.

Extending it

Use tanning recipe data for accepted hides, material cost, grade limit, difficulty and tone. Add agents through the item tag. Keep irreversible material changes in HideWork, station policy in TanningStationOperations, and rendering free of gameplay mutations.

Verifying

Run gradlew.bat -I tools/artisan/gametest.gradle runArtisanTest for loaded-world material commits, block-entity/tongs persistence, single-drop conservation and the complete tanning station sequence. It also covers real use callbacks in four rack facings, exact vessel pours and one-source/one-bucket conservation. The sequence also checks immediate and delayed turns, interruption, exclusive tool contact, saved cuts and finishing wear.

Run gradlew.bat -I tools/forgery/verify.gradle checkArtisanLogic. Exercise clean completion, each damaged stage, all tie corners, paused timing, save/load, station replacement and transfer between players. Test world contact in all four facings and the reused overlay at different GUI scales. Inspect actual hanging hide holes and tool cues in game.

Forgery runtime shares stations and inspection; gem runtime consumes assembly quality downstream. Leather tanning owns the gameplay contract.