diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch index 4899e75462..d2cc2fa1a9 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch @@ -115,13 +115,12 @@ this.hasImpulse = true; if (this.getPierceLevel() > 0 && projectiledeflection == ProjectileDeflection.NONE) { -@@ -317,8 +342,21 @@ - +@@ -318,7 +343,20 @@ this.level().addParticle(ParticleTypes.BUBBLE, pos.x - vec3d1.x * 0.25D, pos.y - vec3d1.y * 0.25D, pos.z - vec3d1.z * 0.25D, vec3d1.x, vec3d1.y, vec3d1.z); } -+ -+ } ++ } ++ + // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows + @Override + public ProjectileDeflection preHitTargetOrDeflectSelf(HitResult hitResult) { @@ -234,7 +233,18 @@ } else { this.firedFromWeapon = null; } -@@ -688,34 +733,31 @@ +@@ -684,38 +729,42 @@ + + @Override + public void setOwner(@Nullable Entity entity) { ++ // Paper start - Fix PickupStatus getting reset ++ this.setOwner(entity, true); ++ } ++ ++ public void setOwner(@Nullable Entity entity, boolean resetPickup) { ++ // Paper end - Fix PickupStatus getting reset + super.setOwner(entity); ++ if (!resetPickup) return; // Paper - Fix PickupStatus getting reset Entity entity1 = entity; byte b0 = 0; @@ -281,7 +291,7 @@ } this.pickup = entityarrow_pickupstatus; -@@ -724,9 +766,24 @@ +@@ -724,9 +773,24 @@ @Override public void playerTouch(Player player) { if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { 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 77e8d129e1..778f7aa5e1 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 @@ -164,7 +164,22 @@ protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) { if (hitResult.getType() == HitResult.Type.ENTITY) { EntityHitResult movingobjectpositionentity = (EntityHitResult) hitResult; -@@ -309,6 +393,11 @@ +@@ -269,7 +353,13 @@ + public boolean deflect(ProjectileDeflection deflection, @Nullable Entity deflector, @Nullable Entity owner, boolean fromAttack) { + deflection.deflect(this, deflector, this.random); + if (!this.level().isClientSide) { +- this.setOwner(owner); ++ // Paper start - Fix PickupStatus getting reset ++ if (this instanceof AbstractArrow arrow) { ++ arrow.setOwner(owner, false); ++ } else { ++ this.setOwner(owner); ++ } ++ // Paper end - Fix PickupStatus getting reset + this.onDeflection(deflector, fromAttack); + } + +@@ -309,6 +399,11 @@ protected void onHitEntity(EntityHitResult entityHitResult) {} protected void onHitBlock(BlockHitResult blockHitResult) { @@ -176,7 +191,7 @@ BlockState iblockdata = this.level().getBlockState(blockHitResult.getBlockPos()); iblockdata.onProjectileHit(this.level(), iblockdata, blockHitResult, this); -@@ -320,6 +409,15 @@ +@@ -320,6 +415,15 @@ } else { Entity entity1 = this.getOwner(); @@ -192,7 +207,7 @@ return entity1 == null || this.leftOwner || !entity1.isPassengerOfSameVehicle(entity); } } -@@ -333,14 +431,8 @@ +@@ -333,14 +437,8 @@ } protected static float lerpRotation(float prevRot, float newRot) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java index 1f30109abd..d0c30fd12a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java @@ -173,4 +173,16 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr this.getHandle().setSoundEvent(org.bukkit.craftbukkit.CraftSound.bukkitToMinecraft(sound)); } // Paper end + + // Paper start - Fix PickupStatus getting reset - Copy of CraftProjectile#setShooter, calling setOwner(Entity,boolean) + @Override + public void setShooter(org.bukkit.projectiles.ProjectileSource shooter, boolean resetPickupStatus) { + if (shooter instanceof CraftEntity craftEntity) { + this.getHandle().setOwner(craftEntity.getHandle(), resetPickupStatus); + } else { + this.getHandle().setOwner(null, resetPickupStatus); + } + this.getHandle().projectileSource = shooter; + } + // Paper end - Fix PickupStatus getting reset }