From f117e530947f96decefde3cdd1f94a9cfc2c6a99 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 10 Aug 2024 11:55:08 +0200 Subject: [PATCH] Check shooter in configurable projectile relative velocity patch --- .../Configurable-projectile-relative-velocity.patch | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/patches/server/Configurable-projectile-relative-velocity.patch b/patches/server/Configurable-projectile-relative-velocity.patch index a6e85dc382..63ce2091f6 100644 --- a/patches/server/Configurable-projectile-relative-velocity.patch +++ b/patches/server/Configurable-projectile-relative-velocity.patch @@ -29,11 +29,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity { + this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); Vec3 vec3d = shooter.getKnownMovement(); - -- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); -+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity +- ++ // Paper start - allow disabling relative velocity ++ if (vec3d.lengthSqr() > 4D * 4D) { ++ vec3d = vec3d.normalize().scale(2D); ++ } ++ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) { + this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); ++ } ++ // Paper end - allow disabling relative velocity } // CraftBukkit start - call projectile hit event