Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match knockback mechanism to vanilla #1011

Closed
wants to merge 3 commits into from

Conversation

Blackjack200
Copy link
Contributor

@Blackjack200 Blackjack200 commented Feb 11, 2025

vanilla knock back function

vanilla force

 public void knockback(double d0, double d1, double d2) {
      d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
      if (!(d0 <= 0.0D)) {
         this.hasImpulse = true;
         Vec3 vec3 = this.getDeltaMovement();
         Vec3 vec31 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
         this.setDeltaMovement(vec3.x / 2.0D - vec31.x, this.onGround() ? Math.min(0.4D, vec3.y / 2.0D + d0) : vec3.y, vec3.z / 2.0D - vec31.z);
      }
   }

this.knockback((double)0.4F, d0, d1);

@Blackjack200 Blackjack200 marked this pull request as draft February 11, 2025 02:17
@Blackjack200 Blackjack200 marked this pull request as ready for review February 11, 2025 03:13
@Blackjack200 Blackjack200 deleted the kb-friction branch February 20, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant