Skip to content

fix: inline hitbox interact locals and always fire listener hooks#281

Merged
toxicity188 merged 1 commit intov2-devfrom
codex/add-interact-listeners-to-hitboxlistener
Feb 17, 2026
Merged

fix: inline hitbox interact locals and always fire listener hooks#281
toxicity188 merged 1 commit intov2-devfrom
codex/add-interact-listeners-to-hitboxlistener

Conversation

@toxicity188
Copy link
Owner

Motivation

  • Remove now-unnecessary local temporaries introduced during the event-object refactor to reduce noise and keep hitbox interaction code concise.
  • Ensure hitbox listeners are always invoked (regardless of the event's triggered() result) so hooks can observe all interaction attempts.
  • Apply minimal, focused changes localized to hitbox interaction paths across NMS implementations and Fabric, preserving module boundaries and behavior where intended.

Description

  • Inlined platformPlayer and jomlVector temporaries by constructing ModelInteractEvent / ModelInteractAtEvent with wrap() / toBukkit() / toVector3f() inline in all NMS HitBoxImpl files and the Fabric HitBoxEntityImpl.
  • Reordered flow in interact and interactAt so listener.interact(...) and listener.interactAt(...) are invoked before the if (!interact.call().triggered()) check, making listeners run regardless of trigger cancellation.
  • Small cleanup in Fabric HitBoxEntityImpl to reuse a serverPlayer local for clarity while still inlining the platform player and vector where used.
  • Added a listenHitBox hook on Tracker delegating to the pipeline event dispatcher to allow registering builder-based hitbox listener transformations (exposes BiFunction<RenderedBone, HitBoxListener.Builder, HitBoxListener.Builder> hook).

Testing

  • Verified text-level changes with repository searches; confirmed no remaining platformPlayer/jomlVector locals and confirmed listener invocation lines appear before interact.call().triggered() checks using rg (search checks succeeded).
  • Attempted to run ./gradlew :nms:v1_21_R7:compileKotlin to validate compilation, but the Gradle wrapper download failed due to a network/proxy restriction returning 403 Forbidden, preventing a full compile check.
  • Committed changes and ensured Git staging/commit succeeded; no automated unit tests were present/triggered for these API-adjacent edits during this run.

Codex Task

@toxicity188 toxicity188 merged commit e793871 into v2-dev Feb 17, 2026
1 check passed
@toxicity188 toxicity188 deleted the codex/add-interact-listeners-to-hitboxlistener branch February 17, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant