feat(knockback): expose native calculation parameters - #508
Open
coolestandie wants to merge 2 commits into
Open
Conversation
coolestandie
marked this pull request as ready for review
August 21, 2026 16:58
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #508 +/- ##
==============================
==============================
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a cancellable ActorKnockbackPrepareEvent before BDS calculates knockback, while keeping ActorKnockbackEvent as the final-vector event.
What this adds
Where it fires
The event fires directly in Mob::knockback before the original BDS implementation is called. The modified values are copied back into the native KnockbackParameters structure and then passed to BDS, so the engine still performs the actual knockback calculation.
BDS can invoke Mob::knockback again while applying extra knockback. The prepare event therefore fires for each native calculation, matching the engine path rather than hiding the second calculation.
Cancellation and final-vector event
Cancelling ActorKnockbackPrepareEvent returns before BDS calculates or applies knockback. ActorKnockbackEvent remains unchanged and still runs after the native calculation, allowing plugins to inspect, replace or cancel the resulting velocity delta.
Vanilla behavior
The hook checks whether either knockback event has listeners. With no listeners, it calls the original function immediately with the untouched native arguments. With listeners, every value starts from the parameters supplied by BDS; this change introduces no global configuration or hard-coded knockback defaults.
Testing