DAI 4.1 · STEP-BY-STEP

Reactions & Event-Driven Gameplay

Turn real gameplay events into deterministic server/client responses without wasteful tick polling.

Build from scratchTest in MinecraftMultiplayer-safe by designDAI 4.1

What you are building

Primary path: data/<namespace>/reactions/
Turn real gameplay events into deterministic server/client responses without wasteful tick polling.

Step-by-step

  1. Choose a concrete eventDamage, use item, block interaction, first join, death, target acquired.
  2. Capture event contextIdentify actor/target/item/position before branching.
  3. Filter with conditionsDiscard irrelevant events early.
  4. Run server mutation firstDamage, score, inventory and world state belong to the server.
  5. Run client presentation secondOverlay/sound/animation can mirror the successful result.
  6. Test duplicate deliveryVerify the event cannot award or execute twice.

4.1 replaceable event hooks

reaction_events/*.json now binds logical event IDs to stable Java integration hooks. Built-in definitions are only fallbacks: datapacks can replace, disable, reprioritize or remap them.

{
  "id":"my_pack:primary_attack",
  "hook":"player_attack_input",
  "enabled":true,
  "priority":20,
  "phases":["pre","during","post"],
  "cancellable":true,
  "overrideable":true
}

Supported 4.1 hook fields are id, hook, enabled, priority, phases, cancellable, and overrideable.

Definition of done

  • The feature still works after save/reload.
  • Server state is authoritative; presentation mirrors it.
  • Invalid input cannot duplicate rewards or bypass costs.
  • Two players can use the system without sharing unintended temporary state.
  • Any optional resource pack can be disabled without breaking datapack logic.

Next integration

Once this feature works alone, connect it to a complete loop instead of adding more isolated content. Use the complete-game tracks to see where it belongs in ACMS, Space Between Blocks, MineTrigger or Hollow Spiral.