Check shooter in configurable projectile relative velocity patch

This commit is contained in:
Nassim Jahnke 2024-08-10 11:55:08 +02:00
parent bc48955246
commit f117e53094

View file

@ -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