diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch b/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch deleted file mode 100644 index 383f0a901e..0000000000 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java -index ee366e5eab69fc816e124d2718897ee5872c8bd1..7911809e0b957fbb2258a10547e9c1ba79ab289c 100644 ---- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java -+++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java -@@ -37,10 +37,17 @@ public class ThrownExperienceBottle extends ThrowableItemProjectile { - protected void onHit(HitResult result) { - super.onHit(result); - if (this.level() instanceof ServerLevel) { -- this.level().levelEvent(2002, this.blockPosition(), -13083194); -+ // CraftBukkit - moved to after event - int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5); -- ExperienceOrb.award((ServerLevel)this.level(), result.getLocation(), i); -- this.discard(); -+ // CraftBukkit start -+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, result, i); -+ i = event.getExperience(); -+ if (event.getShowEffect()) { -+ this.level().levelEvent(net.minecraft.world.level.block.LevelEvent.PARTICLES_SPELL_POTION_SPLASH, this.blockPosition(), net.minecraft.world.item.alchemy.PotionContents.BASE_POTION_COLOR); -+ } -+ // CraftBukkit end -+ ExperienceOrb.award((ServerLevel)this.level(), result.getLocation(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, this.getOwner(), this); // Paper -+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } - } - } diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch similarity index 84% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch index 09bf5491e9..c060924241 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch @@ -1,14 +1,6 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java -index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d571ff5e2ce 100644 --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java +++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java -@@ -70,54 +70,95 @@ public abstract class AbstractThrownPotion extends ThrowableItemProjectile { +@@ -67,54 +_,95 @@ @Override protected void onHit(HitResult result) { super.onHit(result); @@ -16,7 +8,7 @@ index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d57 + this.splash(result); + } + -+ public void splash(@Nullable HitResult result) { ++ public void splash(HitResult result) { + // Paper end - More projectile API if (this.level() instanceof ServerLevel serverLevel) { ItemStack item = this.getItem(); @@ -25,10 +17,10 @@ index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d57 if (potionContents.is(Potions.WATER)) { - this.onHitAsWater(serverLevel); - } else if (potionContents.hasEffects()) { -- this.onHitAsPotion(serverLevel, item, result.getType() == HitResult.Type.ENTITY ? ((EntityHitResult)result).getEntity() : null); +- this.onHitAsPotion(serverLevel, item, result); + showParticles = this.onHitAsWater(serverLevel, result); // Paper - Fix potions splash events + } else if (true || potionContents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply -+ showParticles = this.onHitAsPotion(serverLevel, item, result != null && result.getType() == HitResult.Type.ENTITY ? ((EntityHitResult)result).getEntity() : null, result); // Paper - pass HitResult ++ showParticles = this.onHitAsPotion(serverLevel, item, result); // Paper - pass HitResult } + if (showParticles) { // Paper - Fix potions splash events @@ -43,7 +35,7 @@ index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d57 - private void onHitAsWater(ServerLevel level) { + private static final Predicate APPLY_WATER_GET_ENTITIES_PREDICATE = AbstractThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper - Fix potions splash events + -+ private boolean onHitAsWater(ServerLevel level, @Nullable HitResult result) { // Paper - Fix potions splash events ++ private boolean onHitAsWater(ServerLevel level, HitResult result) { // Paper - Fix potions splash events AABB aabb = this.getBoundingBox().inflate(4.0, 2.0, 4.0); - for (LivingEntity livingEntity : this.level().getEntitiesOfClass(LivingEntity.class, aabb, WATER_SENSITIVE_OR_ON_FIRE)) { @@ -93,8 +85,8 @@ index cd39446836b9706134e164c07db57e3632b41299..3a1d9d0022f64d522138439cd1d55d57 + return !event.isCancelled(); // Paper - Fix potions splash events } -- protected abstract void onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity); -+ protected abstract boolean onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity, @Nullable HitResult hitResult); // Paper - Pass HitResult // Paper - Fix potions splash events & More Projectile API +- protected abstract void onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult); ++ protected abstract boolean onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult); // Paper - Fix potions splash events & More Projectile API private void dowseFire(BlockPos pos) { BlockState blockState = this.level().getBlockState(pos); diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch similarity index 58% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch index e8f820b931..3659c39076 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch @@ -1,28 +1,20 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java -index 6c2eea22bc33abfe5c143abbca732310677073b0..59941c605085d93357211939114ecf1b88aef05d 100644 --- a/net/minecraft/world/entity/projectile/EyeOfEnder.java +++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java -@@ -73,6 +73,12 @@ public class EyeOfEnder extends Entity implements ItemSupplier { +@@ -72,6 +_,12 @@ } - public void signalTo(BlockPos pos) { + public void signalTo(Vec3 pos) { + // Paper start - Change EnderEye target without changing other things + this.signalTo(pos, true); + } + -+ public void signalTo(BlockPos pos, boolean update) { ++ public void signalTo(Vec3 pos, boolean update) { + // Paper end - Change EnderEye target without changing other things - double d = pos.getX(); - int y = pos.getY(); - double d1 = pos.getZ(); -@@ -89,8 +95,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier { - this.tz = d1; + Vec3 vec3 = pos.subtract(this.position()); + double d = vec3.horizontalDistance(); + if (d > 12.0) { +@@ -80,8 +_,10 @@ + this.target = pos; } + if (update) { // Paper - Change EnderEye target without changing other things @@ -32,7 +24,7 @@ index 6c2eea22bc33abfe5c143abbca732310677073b0..59941c605085d93357211939114ecf1b } @Override -@@ -164,7 +172,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier { +@@ -102,7 +_,7 @@ this.life++; if (this.life > 80 && !this.level().isClientSide) { this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F); diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch similarity index 57% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch index 7aeea455c7..73824263a6 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -1,14 +1,6 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04cead26bf 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -50,6 +50,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -48,6 +_,7 @@ public int lifetime = 0; @Nullable public LivingEntity attachedToEntity; @@ -16,7 +8,7 @@ index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04 public FireworkRocketEntity(EntityType entityType, Level level) { super(entityType, level); -@@ -165,7 +166,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -163,7 +_,7 @@ } if (!this.noPhysics && this.isAlive() && hitResultOnMoveVector.getType() != HitResult.Type.MISS) { @@ -25,7 +17,7 @@ index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04 this.hasImpulse = true; } -@@ -189,7 +190,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -187,7 +_,11 @@ } if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) { @@ -38,7 +30,7 @@ index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04 } } -@@ -197,14 +202,18 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -195,14 +_,18 @@ level.broadcastEntityEvent(this, (byte)17); this.gameEvent(GameEvent.EXPLODE, this.getOwner()); this.dealExplosionDamage(level); @@ -59,7 +51,7 @@ index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04 } } -@@ -213,7 +222,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -211,7 +_,11 @@ BlockPos blockPos = new BlockPos(result.getBlockPos()); this.level().getBlockState(blockPos).entityInside(this.level(), blockPos, this, InsideBlockEffectApplier.NOOP); if (this.level() instanceof ServerLevel serverLevel && this.hasExplosion()) { @@ -72,19 +64,19 @@ index 12bd5a49e2297f93c85a20d023fe4c95c3d29bd8..dcb7714b2edeab8cfb0358929d07bd04 } super.onHitBlock(result); -@@ -286,6 +299,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - RegistryOps registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); - compound.store("FireworksItem", ItemStack.CODEC, registryOps, this.getItem()); - compound.putBoolean("ShotAtAngle", this.entityData.get(DATA_SHOT_AT_ANGLE)); -+ compound.storeNullable("SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity); // Paper +@@ -283,6 +_,7 @@ + output.putInt("LifeTime", this.lifetime); + output.store("FireworksItem", ItemStack.CODEC, this.getItem()); + output.putBoolean("ShotAtAngle", this.entityData.get(DATA_SHOT_AT_ANGLE)); ++ output.storeNullable("SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity); // Paper } @Override -@@ -296,6 +310,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - RegistryOps registryOps = this.registryAccess().createSerializationContext(NbtOps.INSTANCE); - this.entityData.set(DATA_ID_FIREWORKS_ITEM, compound.read("FireworksItem", ItemStack.CODEC, registryOps).orElse(getDefaultItem())); - this.entityData.set(DATA_SHOT_AT_ANGLE, compound.getBooleanOr("ShotAtAngle", false)); -+ this.spawningEntity = compound.read("SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null); // Paper +@@ -292,6 +_,7 @@ + this.lifetime = input.getIntOr("LifeTime", 0); + this.entityData.set(DATA_ID_FIREWORKS_ITEM, input.read("FireworksItem", ItemStack.CODEC).orElse(getDefaultItem())); + this.entityData.set(DATA_SHOT_AT_ANGLE, input.getBooleanOr("ShotAtAngle", false)); ++ this.spawningEntity = input.read("SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null); // Paper } private List getExplosions() { diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/LargeFireball.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/LargeFireball.java.patch similarity index 65% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/LargeFireball.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/LargeFireball.java.patch index e1f149bdde..c59d7a4f15 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/LargeFireball.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/LargeFireball.java.patch @@ -1,14 +1,6 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/LargeFireball.java b/net/minecraft/world/entity/projectile/LargeFireball.java -index 048ba5e45d6e0ee2be135e3ab07766eae8445543..db1b5bce212a5147be82504469f1fa9660812ebc 100644 --- a/net/minecraft/world/entity/projectile/LargeFireball.java +++ b/net/minecraft/world/entity/projectile/LargeFireball.java -@@ -19,11 +19,13 @@ public class LargeFireball extends Fireball { +@@ -20,11 +_,13 @@ public LargeFireball(EntityType entityType, Level level) { super(entityType, level); @@ -22,7 +14,7 @@ index 048ba5e45d6e0ee2be135e3ab07766eae8445543..db1b5bce212a5147be82504469f1fa96 } @Override -@@ -31,8 +33,13 @@ public class LargeFireball extends Fireball { +@@ -32,8 +_,13 @@ super.onHit(result); if (this.level() instanceof ServerLevel serverLevel) { boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); @@ -38,11 +30,11 @@ index 048ba5e45d6e0ee2be135e3ab07766eae8445543..db1b5bce212a5147be82504469f1fa96 } } -@@ -57,6 +64,6 @@ public class LargeFireball extends Fireball { +@@ -58,6 +_,6 @@ @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); -- this.explosionPower = compound.getByteOr("ExplosionPower", (byte)1); -+ this.bukkitYield = this.explosionPower = compound.getByteOr("ExplosionPower", (byte)1); // CraftBukkit - set bukkitYield when setting explosionPower + protected void readAdditionalSaveData(ValueInput input) { + super.readAdditionalSaveData(input); +- this.explosionPower = input.getByteOr("ExplosionPower", (byte)1); ++ this.bukkitYield = this.explosionPower = input.getByteOr("ExplosionPower", (byte)1); // CraftBukkit - set bukkitYield when setting explosionPower } } diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/Projectile.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch similarity index 75% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/Projectile.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch index 43300d79b9..b16a8c78af 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,14 +1,6 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java -index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b926508b5b 100644 --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java -@@ -47,6 +47,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -44,6 +_,7 @@ public boolean hasBeenShot = false; @Nullable private Entity lastDeflectedBy; @@ -16,17 +8,11 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 Projectile(EntityType entityType, Level level) { super(entityType, level); -@@ -57,15 +58,36 @@ public abstract class Projectile extends Entity implements TraceableEntity { - this.ownerUUID = owner.getUUID(); - this.cachedOwner = owner; - } -+ // Paper start - Refresh ProjectileSource for projectiles -+ else { -+ this.ownerUUID = null; -+ this.cachedOwner = null; -+ this.projectileSource = null; -+ } -+ // Paper end - Refresh ProjectileSource for projectiles +@@ -55,7 +_,20 @@ + + public void setOwner(@Nullable Entity owner) { + this.setOwner(owner != null ? new EntityReference<>(owner) : null); +- } + this.refreshProjectileSource(false); // Paper + } + @@ -35,33 +21,24 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 + if (fillCache) { + this.getOwner(); + } -+ if (this.cachedOwner != null && !this.cachedOwner.isRemoved() && this.projectileSource == null && this.cachedOwner.getBukkitEntity() instanceof org.bukkit.projectiles.ProjectileSource projSource) { ++ Entity owner = this.getOwner(); ++ if (owner != null && this.projectileSource == null && owner.getBukkitEntity() instanceof org.bukkit.projectiles.ProjectileSource projSource) { + this.projectileSource = projSource; + } - } ++ } + // Paper end - Refresh ProjectileSource for projectiles @Nullable @Override - public Entity getOwner() { - if (this.cachedOwner != null && !this.cachedOwner.isRemoved()) { -+ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles - return this.cachedOwner; - } else if (this.ownerUUID != null) { - this.cachedOwner = this.findOwner(this.ownerUUID); -+ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles - return this.cachedOwner; - } else { - return null; -@@ -98,6 +120,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -84,6 +_,7 @@ @Override - protected void readAdditionalSaveData(CompoundTag compound) { - this.setOwnerThroughUUID(compound.read("Owner", UUIDUtil.CODEC).orElse(null)); -+ if (this instanceof ThrownEnderpearl && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && this.level().paperConfig().misc.legacyEnderPearlBehavior) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit - this.leftOwner = compound.getBooleanOr("LeftOwner", false); - this.hasBeenShot = compound.getBooleanOr("HasBeenShot", false); + protected void readAdditionalSaveData(ValueInput input) { + this.setOwner(EntityReference.read(input, "Owner")); ++ if (this instanceof ThrownEnderpearl && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && this.level().paperConfig().misc.legacyEnderPearlBehavior) { this.owner = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit + this.leftOwner = input.getBooleanOr("LeftOwner", false); + this.hasBeenShot = input.getBooleanOr("HasBeenShot", false); } -@@ -173,7 +196,14 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -151,7 +_,14 @@ float f2 = Mth.cos(y * (float) (Math.PI / 180.0)) * Mth.cos(x * (float) (Math.PI / 180.0)); this.shoot(f, f1, f2, velocity, inaccuracy); Vec3 knownMovement = shooter.getKnownMovement(); @@ -76,7 +53,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 } @Override -@@ -193,7 +223,12 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -171,7 +_,12 @@ public static T spawnProjectileFromRotation( Projectile.ProjectileFactory factory, ServerLevel level, ItemStack spawnedFrom, LivingEntity owner, float z, float velocity, float innaccuracy ) { @@ -90,7 +67,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 factory.create(level, owner, spawnedFrom), level, spawnedFrom, -@@ -218,7 +253,13 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -196,7 +_,13 @@ public static T spawnProjectileUsingShoot( T projectile, ServerLevel level, ItemStack spawnedFrom, double x, double y, double z, float velocity, float inaccuracy ) { @@ -105,7 +82,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 } public static T spawnProjectile(T projectile, ServerLevel level, ItemStack spawnedFrom) { -@@ -226,12 +267,47 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -204,11 +_,46 @@ } public static T spawnProjectile(T projectile, ServerLevel level, ItemStack stack, Consumer adapter) { @@ -119,9 +96,10 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 - level.addFreshEntity(projectile); - projectile.applyOnProjectileSpawned(level, stack); - return projectile; +- } + return new Delayed<>(projectile, level, stack); // Paper - delayed projectile spawning - } - ++ } ++ + // Paper start - delayed projectile spawning + public record Delayed( + T projectile, @@ -152,11 +130,10 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 + } + } + // Paper end - delayed projectile spawning -+ + public void applyOnProjectileSpawned(ServerLevel level, ItemStack spawnedFrom) { EnchantmentHelper.onProjectileSpawned(level, spawnedFrom, this, item -> {}); - if (this instanceof AbstractArrow abstractArrow) { -@@ -242,6 +318,17 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -220,6 +_,17 @@ } } @@ -174,7 +151,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 protected ProjectileDeflection hitTargetOrDeflectSelf(HitResult hitResult) { if (hitResult.getType() == HitResult.Type.ENTITY) { EntityHitResult entityHitResult = (EntityHitResult)hitResult; -@@ -273,7 +360,13 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -251,7 +_,13 @@ public boolean deflect(ProjectileDeflection deflection, @Nullable Entity entity, @Nullable Entity owner, boolean deflectedByPlayer) { deflection.deflect(this, entity, this.random); if (!this.level().isClientSide) { @@ -189,7 +166,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 this.onDeflection(entity, deflectedByPlayer); } -@@ -309,15 +402,35 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -287,15 +_,35 @@ } protected void onHitBlock(BlockHitResult result) { @@ -225,7 +202,7 @@ index 6c9a5aa2ca7d002c5b015b0e3adaa160748e36b8..4487c03183d20a187d391dd124abb7b9 return owner == null || this.leftOwner || !owner.isPassengerOfSameVehicle(target); } } -@@ -330,13 +443,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -308,13 +_,7 @@ } protected static float lerpRotation(float currentRotation, float targetRotation) { diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch similarity index 73% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index 45c58cfc11..fae0a7a1dd 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -1,37 +1,29 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/ShulkerBullet.java b/net/minecraft/world/entity/projectile/ShulkerBullet.java -index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3093cc3cc 100644 --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java -@@ -58,8 +58,22 @@ public class ShulkerBullet extends Projectile { - this.finalTarget = finalTarget; +@@ -57,7 +_,21 @@ + this.finalTarget = new EntityReference<>(finalTarget); this.currentMoveDirection = Direction.UP; - this.selectNextMoveDirection(axis); + this.selectNextMoveDirection(axis, finalTarget); +- } + this.projectileSource = shooter.getBukkitLivingEntity(); // CraftBukkit - } - ++ } ++ + // CraftBukkit start + @Nullable + public Entity getTarget() { -+ return this.finalTarget; ++ return this.finalTarget.getEntity(this.level(), Entity.class); + } + + public void setTarget(@Nullable Entity finalTarget) { -+ this.finalTarget = finalTarget; ++ this.finalTarget = finalTarget == null ? null : new net.minecraft.world.entity.EntityReference<>(finalTarget); + this.currentMoveDirection = Direction.UP; -+ this.selectNextMoveDirection(Direction.Axis.X); ++ this.selectNextMoveDirection(Direction.Axis.X, finalTarget); + } + // CraftBukkit end -+ + @Override public SoundSource getSoundSource() { - return SoundSource.HOSTILE; -@@ -180,7 +194,7 @@ public class ShulkerBullet extends Projectile { +@@ -179,7 +_,7 @@ @Override public void checkDespawn() { if (this.level().getDifficulty() == Difficulty.PEACEFUL) { @@ -40,7 +32,7 @@ index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3 } } -@@ -226,7 +240,7 @@ public class ShulkerBullet extends Projectile { +@@ -223,7 +_,7 @@ } if (hitResult != null && this.isAlive() && hitResult.getType() != HitResult.Type.MISS) { @@ -49,7 +41,7 @@ index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3 } ProjectileUtil.rotateTowardsMovement(this, 0.5F); -@@ -299,7 +313,7 @@ public class ShulkerBullet extends Projectile { +@@ -296,7 +_,7 @@ } if (entity instanceof LivingEntity livingEntity1) { @@ -58,7 +50,7 @@ index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3 } } } -@@ -312,14 +326,20 @@ public class ShulkerBullet extends Projectile { +@@ -309,14 +_,20 @@ } private void destroy() { @@ -81,7 +73,7 @@ index 43c36a76e633c34ee1f61d79dd6345af8b9ce8e0..0789b9b6904ae07d80a828ef18632fb3 } @Override -@@ -334,9 +354,14 @@ public class ShulkerBullet extends Projectile { +@@ -331,9 +_,14 @@ @Override public boolean hurtServer(ServerLevel level, DamageSource damageSource, float amount) { diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch similarity index 79% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch index b6a0ed317b..c12af27e86 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch @@ -1,14 +1,6 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e445eaf4f22 100644 --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -122,11 +122,18 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -119,11 +_,18 @@ Vec3 vec3 = this.oldPosition(); if (owner instanceof ServerPlayer serverPlayer) { if (serverPlayer.connection.isAcceptingMessages()) { @@ -28,7 +20,7 @@ index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e44 } } -@@ -134,15 +141,17 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -131,15 +_,17 @@ owner.setPortalCooldown(); } @@ -47,12 +39,12 @@ index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e44 if (serverPlayer1 != null) { serverPlayer1.resetFallDistance(); serverPlayer1.resetCurrentImpulseContext(); -- serverPlayer1.hurtServer(serverPlayer.serverLevel(), this.damageSources().enderPearl(), 5.0F); -+ serverPlayer1.hurtServer(serverPlayer.serverLevel(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API +- serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl(), 5.0F); ++ serverPlayer1.hurtServer(serverPlayer.level(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API } this.playSound(serverLevel, vec3); -@@ -158,9 +167,9 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -155,9 +_,9 @@ this.playSound(serverLevel, vec3); } @@ -64,16 +56,16 @@ index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e44 } } } -@@ -181,7 +190,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -178,7 +_,7 @@ if (owner instanceof ServerPlayer serverPlayer && !owner.isAlive() - && serverPlayer.serverLevel().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) { + && serverPlayer.level().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) { - this.discard(); + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else { super.tick(); } -@@ -208,7 +217,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -205,7 +_,7 @@ public Entity teleport(TeleportTransition teleportTransition) { Entity entity = super.teleport(teleportTransition); if (entity != null) { @@ -82,7 +74,7 @@ index cd7eb7037b223674ffa492a68c55b371e6db8195..bda858b1e1c6b28cd9d5a664758b3e44 } return entity; -@@ -216,7 +225,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -213,7 +_,7 @@ @Override public boolean canTeleport(Level fromLevel, Level toLevel) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch new file mode 100644 index 0000000000..5c4dabc734 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java.patch @@ -0,0 +1,33 @@ +--- a/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java ++++ b/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java +@@ -39,16 +_,25 @@ + protected void onHit(HitResult result) { + super.onHit(result); + if (this.level() instanceof ServerLevel serverLevel) { +- serverLevel.levelEvent(2002, this.blockPosition(), -13083194); ++ // CraftBukkit - moved to after event + int i = 3 + serverLevel.random.nextInt(5) + serverLevel.random.nextInt(5); ++ // Paper start - exp bottle event ++ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, result, i); ++ i = event.getExperience(); ++ // Paper end - exp bottle event + if (result instanceof BlockHitResult blockHitResult) { + Vec3 unitVec3 = blockHitResult.getDirection().getUnitVec3(); +- ExperienceOrb.awardWithDirection(serverLevel, result.getLocation(), unitVec3, i); ++ ExperienceOrb.awardWithDirection(serverLevel, result.getLocation(), unitVec3, i, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, this.getOwner(), this); // Paper + } else { +- ExperienceOrb.awardWithDirection(serverLevel, result.getLocation(), this.getDeltaMovement().scale(-1.0), i); +- } ++ ExperienceOrb.awardWithDirection(serverLevel, result.getLocation(), this.getDeltaMovement().scale(-1.0), i, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, this.getOwner(), this); // Paper ++ } ++ // Paper start - exp bottle event ++ if (event.getShowEffect()) { ++ this.level().levelEvent(net.minecraft.world.level.block.LevelEvent.PARTICLES_SPELL_POTION_SPLASH, this.blockPosition(), net.minecraft.world.item.alchemy.PotionContents.BASE_POTION_COLOR); ++ } ++ // Paper end - exp bottle event + +- this.discard(); ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause + } + } + } diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch similarity index 68% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch index 6081613826..8fc9c61e7f 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java.patch @@ -1,23 +1,15 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java b/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java -index c566e20f1f71f87dd7e92b78b36ce76b1d32ef1f..35492f6f1ebad32adbd79cc7e50d37fdcef84367 100644 --- a/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java +++ b/net/minecraft/world/entity/projectile/ThrownLingeringPotion.java -@@ -30,7 +30,7 @@ public class ThrownLingeringPotion extends AbstractThrownPotion { +@@ -29,7 +_,7 @@ } @Override -- public void onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity) { -+ public boolean onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity, @Nullable net.minecraft.world.phys.HitResult hitResult) { // Paper - Pass HitResult // Paper - More projectile API +- public void onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult) { ++ public boolean onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult) { // Paper - More projectile API AreaEffectCloud areaEffectCloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); if (this.getOwner() instanceof LivingEntity livingEntity) { areaEffectCloud.setOwner(livingEntity); -@@ -42,6 +42,15 @@ public class ThrownLingeringPotion extends AbstractThrownPotion { +@@ -41,6 +_,15 @@ areaEffectCloud.setWaitTime(10); areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / areaEffectCloud.getDuration()); areaEffectCloud.applyComponentsFromItemStack(stack); diff --git a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch similarity index 66% rename from paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch index ad1d7881e8..64d6f78a89 100644 --- a/paper-server/patches/rejected/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownSplashPotion.java.patch @@ -1,39 +1,28 @@ -From 09671551669244ef4f259d8b27547e463d6795d4 Mon Sep 17 00:00:00 2001 -From: File -Date: Sun, 20 Apr 1997 15:37:42 +0200 -Subject: [PATCH] paper File Patches - - -diff --git a/net/minecraft/world/entity/projectile/ThrownSplashPotion.java b/net/minecraft/world/entity/projectile/ThrownSplashPotion.java -index 13de6a2c8f4b04899af1687e827332c6a1874ab4..5be6707179c480cb33bf8ee9d40ec01b13d248df 100644 --- a/net/minecraft/world/entity/projectile/ThrownSplashPotion.java +++ b/net/minecraft/world/entity/projectile/ThrownSplashPotion.java -@@ -36,12 +36,13 @@ public class ThrownSplashPotion extends AbstractThrownPotion { +@@ -36,13 +_,14 @@ } @Override -- public void onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity) { -+ public boolean onHitAsPotion(ServerLevel level, ItemStack stack, @Nullable Entity entity, @Nullable net.minecraft.world.phys.HitResult hitResult) { // Paper - Add HitResult parameter // Paper - More projectile API +- public void onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult) { ++ public boolean onHitAsPotion(ServerLevel level, ItemStack stack, HitResult hitResult) { // Paper - More projectile API PotionContents potionContents = stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); float orDefault = stack.getOrDefault(DataComponents.POTION_DURATION_SCALE, 1.0F); Iterable allEffects = potionContents.getAllEffects(); - AABB aabb = this.getBoundingBox().inflate(4.0, 2.0, 4.0); - List entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, aabb); + AABB aabb = this.getBoundingBox().move(hitResult.getLocation().subtract(this.position())); + AABB aabb1 = aabb.inflate(4.0, 2.0, 4.0); + List entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, aabb1); + java.util.Map affected = new java.util.HashMap<>(); // CraftBukkit + float f = ProjectileUtil.computeMargin(this); if (!entitiesOfClass.isEmpty()) { Entity effectSource = this.getEffectSource(); - -@@ -50,12 +51,31 @@ public class ThrownSplashPotion extends AbstractThrownPotion { - double d = this.distanceToSqr(livingEntity); +@@ -51,8 +_,25 @@ + if (livingEntity.isAffectedByPotions()) { + double d = aabb.distanceToSqr(livingEntity.getBoundingBox().inflate(f)); if (d < 16.0) { - double d1; -+ // Paper - diff on change, used when calling the splash event for water splash potions - if (livingEntity == entity) { - d1 = 1.0; - } else { - d1 = 1.0 - Math.sqrt(d) / 4.0; - } - +- double d1 = 1.0 - Math.sqrt(d) / 4.0; +- ++ double d1 = 1.0 - Math.sqrt(d) / 4.0; // Paper - diff on change, used when calling the splash event for water splash potions + // CraftBukkit start + affected.put(livingEntity.getBukkitLivingEntity(), d1); + } @@ -55,7 +44,7 @@ index 13de6a2c8f4b04899af1687e827332c6a1874ab4..5be6707179c480cb33bf8ee9d40ec01b for (MobEffectInstance mobEffectInstance : allEffects) { Holder effect = mobEffectInstance.getEffect(); if (effect.value().isInstantenous()) { -@@ -66,7 +86,7 @@ public class ThrownSplashPotion extends AbstractThrownPotion { +@@ -63,7 +_,7 @@ effect, i, mobEffectInstance.getAmplifier(), mobEffectInstance.isAmbient(), mobEffectInstance.isVisible() ); if (!mobEffectInstance1.endsWithin(20)) { @@ -64,7 +53,7 @@ index 13de6a2c8f4b04899af1687e827332c6a1874ab4..5be6707179c480cb33bf8ee9d40ec01b } } } -@@ -74,5 +94,6 @@ public class ThrownSplashPotion extends AbstractThrownPotion { +@@ -71,5 +_,6 @@ } } }