Dynamic player modules
Grant-driven player state, archery execution and shared presentation ownership.
DynamicPlayerComponent hosts optional internal modules under isekaiexpansion:dynamic_player. The host owns persistence and owner-only synchronisation; modules exist only while their live eligibility and source identity agree. These implementation types are internal, not public integration facades.
What it does
PlayerModules registers a typed factory, eligibility predicate and identity function. Demon circulation follows Ancient Blood; Elf resonance follows Elven Harmony. Archery follows active Origins grants or a held-item proxy. This derives ownership from current state, so commands, rerolls, selection items and learned-power changes reach the same reconciliation path.
Runtime model
Server reads and ticks reconcile modules. Disabled or changed identities detach the old instance before a replacement is created. Demon and Elf identities use the race layer; archery combines race, class and profession layers. Death is never copied into a replacement player. Client reads use the latest owner snapshot and never run gameplay reconciliation.
| Host field | Type | Missing behaviour | Meaning |
|---|---|---|---|
| Module identifier | compound | No saved module | Entry in the host NBT map. |
identity | string | Empty, cannot match an ordinary owned module | Source identity that must match before restoration. |
state | compound | Empty module payload | Module-specific serialisation. |
Pending NBT survives initial component load ordering until the first server tick. A saved entry is consumed at most once. Dirty snapshots are sent every 4 ticks (0.2 seconds), only to the owner. The previous Demon component key is not read.
ArcheryModule saves available technique IDs. Its readied technique is session state. The client sends the rail choice again after synchronising the held slot and before bow release or crossbow use. Bursts, captured weapon references and shot timers are transient. The bounded burst definition owns count, wind-up, interval, hand commitment, animation and per-cast sequence factory; counts are limited to 1–32 and the last release must fit within 200 ticks (10 seconds). The prepared sequence owns its optional presentation through start, tick, fire and close. Starfall Volley validates the launch disk before payment and owns a transient circle that closes on completion or interruption. Its vertical velocity and fixed aperture are independent of ProjectilePatternAPI.rain. Cancellation clears only the sequence’s action-lock source. Shared cooldowns remain outside the module.
CCA requires the host key in fabric.mod.json as well as in ComponentsInitializer. verifyComponentMetadata checks the central registry against that declaration and runs before processResources and during check; missing, stale or duplicate keys fail the build.
Contracts
ArcheryRuntime validates live grants, action restrictions, energy and cooldown before accepting a request. A mode’s additional arrows do not recursively run mode release. Native crossbow multishot claims one paid augmentation per player tick. Generated trigger/echo projectiles dispatch ranged scaling once, disable pickup and carry batch immunity-frame bypass. Protection is checked both during collision selection and immediately before arrow damage; extra magic is applied only after a successful base hit.
Successful common releases use cast.common_3; paid piercing and charged releases use cast.common_2. Archery release and elemental impact cues use EffectSoundAPI, sharing the spell sound limiter. For the same sound and category, only the first cue within 8 blocks plays in each world tick; later ticks and more distant sources remain audible. Successful sequence spawns play at the arrow origin, including the overhead rain aperture. Native crossbow releases and the vanilla contact sounds of batch arrows use the same gate. Ordinary bow releases already emit one cue per shot, and silent batch arrows keep their vanilla contact sounds muted.
ArcheryRuntime.energyCost is shared by payment and inspection. Only the temporary Elf Wind Guidance buff waives archery energy. Mote movement and Ability Haste use owned temporary attribute modifiers, removed while guided or detached.
The client prepends archery entries to the existing spell selection and rail snapshot. It does not own energy or grant decisions. The snapshot appends a diamond to the armed technique’s display name. AbilityInspection owns one keyed ClientCaptionAPI.inspect lease across both rails. It reads details only after the highlight settles. Triggerable skills use the owned power’s localized text, learned rank and synced phase; browsing sends no inspection request. The caption preserves text styles, pins title/cost/description below ordinary captions and bounds its measured height to the screen. Clearing it removes only that key. ModuleHudSnapshot projects Demon and Elf resources into the existing auxiliary gauge renderer.
EntityEffekAPI.registerConditional(type, predicate, profile) installs a client entity binding whose predicate decides whether its effect exists. A false predicate sends the configured release trigger and drains finite particles. Profile.withLocator(locator) changes only the visual origin. Archery’s locator samples the animated held item, ignores Iris shadow passes and blends into the actual arrow position during its first 2 client ticks (0.1 seconds). Rain and echo arrows bypass that blend and remain at their world emission point. Collision remains server-owned. Register presentation once at client initialisation; predicates and locators run on the client thread and must not mutate gameplay.
The public tracked aiming pose is separate from owner-only resource state, allowing observers to see bow/crossbow grips. Trigger clips own the arms and legs while leaving head rotation to gameplay. Public start-time and draw-cycle fields drive the bow/crossbow pull model on every observer; they do not fake item use. Rapid Fire releases on ticks 8, 14, 20 and 26, and follows view pitch. Arrow Rain releases its harmless 60° signal on tick 12. Left-handed characters mirror the clips. Enchanted arrows keep their projectile model and add a narrow material sheath with a short axial wake. The projectile saves its presentation in ise_arrow_art and its captured school in ise_archery_element. Physical techniques use a silver-white shaft glint and contact flash when the archer has no elemental resonance. The neutral flight reads only input 1 for model scale. Ordinary shots from those archers have no effect attached.
| Native input | Value | Meaning |
|---|---|---|
| 0 | RGB24 integer | Captured colour for the elemental flight effect. |
| 1 | Projectile width / entity-type width, clamped to 0.1–8 | Live model scale for the entire enchantment. |
| 2 | Speed / 3, clamped to 0.65–1.35 | Axial wake stretch; does not stretch the arrow model. |
Elemental flight release uses trigger 0 with a bounded 4-tick (0.2-second) client drain. The native effect drains within 9 frames (0.15 seconds). Its short wake is a closed taper attached to the arrow. Native material flow, counter-rotating wind surfaces and bounded breathing share a seamless 4-second cycle without respawning the emitter. The effect faces projectile velocity and follows the interpolated projectile position after the launch blend.
ArcheryFlight synchronises flight identity and persists it with the projectile. Piercing uses ×1.5 launch speed, 0.997 drag and 0.018 gravity; charged uses ×1.75, 0.995 and 0.03. Launch acceleration is capped at 6 blocks per tick without slowing faster arrows. Weapon damage compensates for the velocity change. Water keeps vanilla drag. ArrowTrajectory checks the arc to a visible point on the target, adding a short horizontal offset for steady ground movement. If it cannot find a clear arc to the offset point, it retries the visible point at its current position. If neither arc works, the arrow keeps its original launch velocity.
Veilpiercer and Daybreak also save the release rank in ise_archery_draw_rank on the server. A successful hit that gets through a ward resolves its effect from the saved rank, even after a refund or chunk reload. A projectile that only shares the trajectory has no draw effect. The hold card reads the same ArcheryDraw entry for its localized arguments.
CombatAimPacket carries an entity hint, refreshed every 5 client ticks. The server expires it after 12 ticks and rechecks protection, visibility, facing and a 48-block range. Shared targeting uses combat_targeting; there is no legacy component-key alias.
For elemental arrows, ArcheryPresentation selects one of six impact palettes for Wind, Fire, Frost, Lightning, Water and Earth. Particle colours, procedural surfaces and material edges agree within each palette. Impact scale is 1.25 normally, 1.55 for piercing and 1.85 for charged shots, against the authored 1.8-block span. These one-shot impacts do not use the flight effect’s RGB dynamic input.
For Sevenfold Starfall the tracked arrow art selects a separate cached profile after spawn. Its shaft uses the same model locator and live input 0. The closed mantle uses normal blending so its violet body survives bright skies. The native material shears the flame mask over time to pick out moving aquamarine crests, with three tapered vanes and a narrow bright point. The dedicated surface hit uses input 1 for size and the Shooting Star sound cue. Ranks I/II/III scale shaft and impact by ×1/1.27/1.55. Finishing hits apply another ×1.65.
Extending it
Register module types during common initialisation before players tick. Duplicate identifiers fail. A module must implement serialisation, tick and detach; detach removes only effects and locks it owns. Include every source layer whose change should discard state in its identity function. Add resource presentation to ModuleHudSnapshot, not to the renderer.
Register an immutable ArcheryTechnique before data loading, then grant its ID through archery data. A mode supplies a release callback; a trigger supplies a bounded burst. Duplicate IDs and invalid kind/callback combinations fail. Keep Player Animator identifiers in IsekaiPlayerAnimations; item proxies grant definitions rather than copying combat logic.
Verifying
Run ./gradlew.bat compileJava verifyComponentMetadata assembleLanguageFiles and the animation binding audit. In game, check direct race/class/profession commands, selection-item rerolls, power removal and regrant, death, reconnect, proxy reload and weapon swaps during a burst. Confirm cooldowns cannot be reset by equipment changes and no detached module leaves a status marker.
Check native and custom arrows, crossbow multishot, immunity frames, protected targets, roofs and blocked launch origins. Inspect both camera modes with Player Animator, Punchy and Iris, including release, early cancellation, late observers and effect draining. Compilation and native browser previews do not prove these game integrations.
Related
See Archery and the Elf, Demon circulation and Effekseer particles.