diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch index 1af8ae076..ce032eb23 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -29,7 +29,16 @@ } -@@ -189,7 +197,12 @@ +@@ -184,12 +192,20 @@ + + this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); + Vec3 vec3d = shooter.getKnownMovement(); +- ++ // Paper start - allow disabling relative velocity ++ 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 } public static T spawnProjectileFromRotation(Projectile.ProjectileFactory creator, ServerLevel world, ItemStack projectileStack, LivingEntity shooter, float roll, float power, float divergence) { @@ -43,7 +52,7 @@ iprojectile.shootFromRotation(shooter, shooter.getXRot(), shooter.getYRot(), roll, power, divergence); }); } -@@ -201,7 +214,12 @@ +@@ -201,7 +217,12 @@ } public static T spawnProjectileUsingShoot(T projectile, ServerLevel world, ItemStack projectileStack, double velocityX, double velocityY, double velocityZ, float power, float divergence) { @@ -57,10 +66,12 @@ projectile.shoot(velocityX, velocityY, velocityZ, power, divergence); }); } -@@ -211,11 +229,45 @@ +@@ -209,13 +230,47 @@ + public static T spawnProjectile(T projectile, ServerLevel world, ItemStack projectileStack) { + return Projectile.spawnProjectile(projectile, world, projectileStack, (iprojectile) -> { }); - } - ++ } ++ + // Paper start - delayed projectile spawning + public record Delayed( + T projectile, @@ -89,9 +100,9 @@ + this.attemptSpawn(reason); + return projectile(); + } -+ } + } + // Paper end - delayed projectile spawning -+ + public static T spawnProjectile(T projectile, ServerLevel world, ItemStack projectileStack, Consumer beforeSpawn) { + // Paper start - delayed projectile spawning + return spawnProjectileDelayed(projectile, world, projectileStack, beforeSpawn).spawn(); @@ -106,7 +117,7 @@ } public void applyOnProjectileSpawned(ServerLevel world, ItemStack projectileStack) { -@@ -232,6 +284,17 @@ +@@ -232,6 +287,17 @@ } @@ -124,7 +135,7 @@ protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) { if (hitResult.getType() == HitResult.Type.ENTITY) { EntityHitResult movingobjectpositionentity = (EntityHitResult) hitResult; -@@ -309,6 +372,11 @@ +@@ -309,6 +375,11 @@ protected void onHitEntity(EntityHitResult entityHitResult) {} protected void onHitBlock(BlockHitResult blockHitResult) { @@ -136,7 +147,7 @@ BlockState iblockdata = this.level().getBlockState(blockHitResult.getBlockPos()); iblockdata.onProjectileHit(this.level(), iblockdata, blockHitResult, this); -@@ -320,6 +388,15 @@ +@@ -320,6 +391,15 @@ } else { Entity entity1 = this.getOwner();