aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEsoteric Enderman <[email protected]>2024-09-28 20:32:56 +0100
committerGitHub <[email protected]>2024-09-28 21:32:56 +0200
commit355b1cbaf6f0d6331476cb6e45291da647493dd1 (patch)
tree7c9976e61893fac5d41106a31513f6653ccf1947
parent7b031414984efcfe74e9aeb9db10a78e7af63b1a (diff)
downloadPaper-355b1cbaf6f0d6331476cb6e45291da647493dd1.tar.gz
Paper-355b1cbaf6f0d6331476cb6e45291da647493dd1.zip
Add API for explosions to damage the explosion cause (#11180)
This intends to give plugin developers more control over explosions created using the World#createExplosion method, specifically by adding the option for explosions to damage the explosion cause (not the default behavior, and previously impossible to do, as far as I know). This is done by overloading existing methods with an extra `excludeSourceFromDamage` parameter. Co-authored-by: Bjarne Koll <[email protected]>
-rw-r--r--patches/api/0112-Expand-Explosions-API.patch25
-rw-r--r--patches/api/0166-Fix-Spigot-annotation-mistakes.patch10
-rw-r--r--patches/api/0260-More-World-API.patch4
-rw-r--r--patches/api/0348-Expand-FallingBlock-API.patch8
-rw-r--r--patches/api/0456-More-Raid-API.patch4
-rw-r--r--patches/server/0203-Expand-Explosions-API.patch100
-rw-r--r--patches/server/0207-Implement-World.getEntity-UUID-API.patch4
-rw-r--r--patches/server/0208-InventoryCloseEvent-Reason-API.patch4
-rw-r--r--patches/server/0285-Optimize-Captured-BlockEntity-Lookup.patch4
-rw-r--r--patches/server/0306-Optimize-call-to-getFluid-for-explosions.patch4
-rw-r--r--patches/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch6
-rw-r--r--patches/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch4
-rw-r--r--patches/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch4
-rw-r--r--patches/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch6
-rw-r--r--patches/server/0398-Prevent-headless-pistons-from-being-created.patch4
-rw-r--r--patches/server/0460-Add-WorldGameRuleChangeEvent.patch6
-rw-r--r--patches/server/0468-Remove-stale-POIs.patch4
-rw-r--r--patches/server/0516-More-World-API.patch4
-rw-r--r--patches/server/0540-Add-cause-to-Weather-ThunderChangeEvents.patch8
-rw-r--r--patches/server/0597-Improve-and-expand-AsyncCatcher.patch10
-rw-r--r--patches/server/0598-Add-paper-mobcaps-and-paper-playermobcaps.patch4
-rw-r--r--patches/server/0609-Fix-merchant-inventory-not-closing-on-entity-removal.patch4
-rw-r--r--patches/server/0671-Fix-falling-block-spawn-methods.patch6
-rw-r--r--patches/server/0699-Don-t-tick-markers.patch4
-rw-r--r--patches/server/0725-Warn-on-plugins-accessing-faraway-chunks.patch8
-rw-r--r--patches/server/0746-Remove-unnecessary-onTrackingStart-during-navigation.patch6
-rw-r--r--patches/server/0766-check-global-player-list-where-appropriate.patch4
-rw-r--r--patches/server/0847-Only-capture-actual-tree-growth.patch4
-rw-r--r--patches/server/0854-Bandaid-fix-for-Effect.patch4
-rw-r--r--patches/server/0889-Fix-missing-map-initialize-event-call.patch4
-rw-r--r--patches/server/0898-Add-predicate-for-blocks-when-raytracing.patch8
-rw-r--r--patches/server/0936-More-Raid-API.patch4
-rw-r--r--patches/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch6
-rw-r--r--patches/server/0981-Moonrise-optimisation-patches.patch50
-rw-r--r--patches/server/0985-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch4
-rw-r--r--patches/server/0994-Add-Alternate-Current-redstone-implementation.patch8
-rw-r--r--patches/server/1052-Add-FeatureFlag-API.patch4
37 files changed, 233 insertions, 122 deletions
diff --git a/patches/api/0112-Expand-Explosions-API.patch b/patches/api/0112-Expand-Explosions-API.patch
index 081f96fab3..ef8fe10eea 100644
--- a/patches/api/0112-Expand-Explosions-API.patch
+++ b/patches/api/0112-Expand-Explosions-API.patch
@@ -5,6 +5,9 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
+Co-authored-by: Slqmy <[email protected]>
+Co-authored-by: Bjarne Koll <[email protected]>
+
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 3161eae2fa5f03b7d3a5e9945ab659c15cf568c6..af737017ee397f80c44ee02c6cc60cefa07f59c1 100644
--- a/src/main/java/org/bukkit/Location.java
@@ -108,10 +111,10 @@ index 3161eae2fa5f03b7d3a5e9945ab659c15cf568c6..af737017ee397f80c44ee02c6cc60cef
/**
* Returns a list of entities within a bounding box centered around a Location.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index 44a74f15bea60ecd8380520e8faaea41a6c261c5..50c1e4957f66826feb0a2eb04293dbd6b5595700 100644
+index 44a74f15bea60ecd8380520e8faaea41a6c261c5..c2b5fdaace13c8bd46c073ac6d427fe411d96367 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
-@@ -1424,6 +1424,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -1424,6 +1424,104 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire);
@@ -125,9 +128,25 @@ index 44a74f15bea60ecd8380520e8faaea41a6c261c5..50c1e4957f66826feb0a2eb04293dbd6
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param breakBlocks Whether or not to have blocks be destroyed
++ * @param excludeSourceFromDamage whether the explosion should exclude the passed source from taking damage like vanilla explosions do.
++ * @return false if explosion was canceled, otherwise true
++ */
++ public boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks, boolean excludeSourceFromDamage);
++
++ /**
++ * Creates explosion at given location with given power and optionally
++ * setting blocks on fire, with the specified entity as the source.
++ *
++ * @param source The source entity of the explosion
++ * @param loc Location to blow up
++ * @param power The power of explosion, where 4F is TNT
++ * @param setFire Whether or not to set blocks on fire
++ * @param breakBlocks Whether or not to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
-+ public boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks);
++ default boolean createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
++ return createExplosion(source, loc, power, setFire, breakBlocks, true);
++ }
+
+ /**
+ * Creates explosion at given location with given power and optionally
diff --git a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch
index c82d4b4a60..47e2270732 100644
--- a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch
+++ b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch
@@ -618,7 +618,7 @@ index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114
return origin;
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index fcdc5d83621acff5f9210585455be1ea50abb77c..216995288f6b8b407ef8240411b5ed4713379a7a 100644
+index 7dbc2e4883feb5b0b1a20cf36cda01ef3795a262..e4471e86e1b0993425087d8331e7c3d9896b3908 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -418,9 +418,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -632,7 +632,7 @@ index fcdc5d83621acff5f9210585455be1ea50abb77c..216995288f6b8b407ef8240411b5ed47
public boolean refreshChunk(int x, int z);
/**
-@@ -3797,6 +3796,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -3813,6 +3812,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored);
// Spigot start
@@ -640,7 +640,7 @@ index fcdc5d83621acff5f9210585455be1ea50abb77c..216995288f6b8b407ef8240411b5ed47
public class Spigot {
/**
-@@ -3830,7 +3830,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -3846,7 +3846,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
}
@@ -652,7 +652,7 @@ index fcdc5d83621acff5f9210585455be1ea50abb77c..216995288f6b8b407ef8240411b5ed47
Spigot spigot();
// Spigot end
-@@ -4048,9 +4052,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -4064,9 +4068,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* Gets the dimension ID of this environment
*
* @return dimension ID
@@ -664,7 +664,7 @@ index fcdc5d83621acff5f9210585455be1ea50abb77c..216995288f6b8b407ef8240411b5ed47
public int getId() {
return id;
}
-@@ -4060,9 +4064,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -4076,9 +4080,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*
* @param id The ID of the environment
* @return The environment
diff --git a/patches/api/0260-More-World-API.patch b/patches/api/0260-More-World-API.patch
index cd64788d2f..3e453dac00 100644
--- a/patches/api/0260-More-World-API.patch
+++ b/patches/api/0260-More-World-API.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] More World API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index 216995288f6b8b407ef8240411b5ed4713379a7a..d3fc033aba36c5fd99846e9200ed0071fddd6045 100644
+index e4471e86e1b0993425087d8331e7c3d9896b3908..ce1f3ffbab6a8dc8395e3a5b74a7874bb6b38aa9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
-@@ -3795,6 +3795,72 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -3811,6 +3811,72 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored);
diff --git a/patches/api/0348-Expand-FallingBlock-API.patch b/patches/api/0348-Expand-FallingBlock-API.patch
index 8c86249a45..787bb82c19 100644
--- a/patches/api/0348-Expand-FallingBlock-API.patch
+++ b/patches/api/0348-Expand-FallingBlock-API.patch
@@ -10,10 +10,10 @@ Subject: [PATCH] Expand FallingBlock API
Co-authored-by: Lukas Planz <[email protected]>
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index 8e9ab00503167799c6c929d00e48c07cb328848c..907906e15c9250fea385e49f10d3c248236fd004 100644
+index 2720f290a632dd32fd9e70a40e73db9d1d161e94..f037f46a9c6ce894f24af14c20fb514a58a8aee9 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
-@@ -2228,8 +2228,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -2244,8 +2244,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block
@@ -24,7 +24,7 @@ index 8e9ab00503167799c6c929d00e48c07cb328848c..907906e15c9250fea385e49f10d3c248
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException;
/**
-@@ -2242,8 +2244,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -2258,8 +2260,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* BlockData} are null
@@ -35,7 +35,7 @@ index 8e9ab00503167799c6c929d00e48c07cb328848c..907906e15c9250fea385e49f10d3c248
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException;
/**
-@@ -2260,7 +2264,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -2276,7 +2280,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The spawned {@link FallingBlock} instance
* @throws IllegalArgumentException if {@link Location} or {@link
* Material} are null or {@link Material} is not a block
diff --git a/patches/api/0456-More-Raid-API.patch b/patches/api/0456-More-Raid-API.patch
index b365913e82..947b51c645 100644
--- a/patches/api/0456-More-Raid-API.patch
+++ b/patches/api/0456-More-Raid-API.patch
@@ -39,10 +39,10 @@ index 983a8c20a06d2b509602b27f49c090598b8ecc42..fa98599e3eee37bf68f0e9813497c718
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index ecc2d486cfec79cce27a947dfeed4853575a594d..d8a23aa0d898ca3360757721e38ddb97387f7d21 100644
+index 16570c3c7ed5e7ad25f20c1034f7b966d6e694da..adcd8161846b06fd1a7895750f98b629204a8406 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
-@@ -4111,6 +4111,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
+@@ -4127,6 +4127,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public Raid locateNearestRaid(@NotNull Location location, int radius);
diff --git a/patches/server/0203-Expand-Explosions-API.patch b/patches/server/0203-Expand-Explosions-API.patch
index eb56a95124..472715a97d 100644
--- a/patches/server/0203-Expand-Explosions-API.patch
+++ b/patches/server/0203-Expand-Explosions-API.patch
@@ -5,18 +5,110 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
+Co-authored-by: Slqmy <[email protected]>
+Co-authored-by: Bjarne Koll <[email protected]>
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
+index 1fac100819e59d00f50e530d3a4157b56d966dba..f2e75b36cbceb9cfa0755bd045f23073712d0e8a 100644
+--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
+@@ -1424,8 +1424,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
+ }
+
+ @Override
+- public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent) {
+- Explosion explosion = this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, false, particle, emitterParticle, soundEvent);
++ // Paper start - Allow explosions to damage source
++ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent, java.util.function.Consumer<Explosion> configurator) {
++ Explosion explosion = this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, false, particle, emitterParticle, soundEvent, configurator);
++ // Paper end - Allow explosions to damage source
+ // CraftBukkit start
+ if (explosion.wasCanceled) {
+ return explosion;
+diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
+index b216140a8be65e210250358af8daf49344850f20..ce8ac06b47e81161ad5ff6cc865ad6d3d59807c1 100644
+--- a/src/main/java/net/minecraft/world/level/Explosion.java
++++ b/src/main/java/net/minecraft/world/level/Explosion.java
+@@ -74,6 +74,7 @@ public class Explosion {
+ public boolean wasCanceled = false;
+ public float yield;
+ // CraftBukkit end
++ public boolean excludeSourceFromDamage = true; // Paper - Allow explosions to damage source
+
+ public static DamageSource getDefaultDamageSource(Level world, @Nullable Entity source) {
+ return world.damageSources().explosion(source, Explosion.getIndirectSourceEntityInternal(source));
+@@ -227,7 +228,7 @@ public class Explosion {
+ int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
+ int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
+ int k1 = Mth.floor(this.z + (double) f2 + 1.0D);
+- List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
++ List<Entity> list = this.level.getEntities(excludeSourceFromDamage ? this.source : null, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities, Allow explosions to damage source
+ Vec3 vec3d = new Vec3(this.x, this.y, this.z);
+ Iterator iterator = list.iterator();
+
+diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
+index 6944c0b0cfcde9fa4dd78742aee3e3b87d679abf..7138fb36062eceaf92ae8513f9b8aef3d1238656 100644
+--- a/src/main/java/net/minecraft/world/level/Level.java
++++ b/src/main/java/net/minecraft/world/level/Level.java
+@@ -782,7 +782,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+ }
+
+ public Explosion explode(@Nullable Entity entity, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType) {
+- return this.explode(entity, Explosion.getDefaultDamageSource(this, entity), (ExplosionDamageCalculator) null, x, y, z, power, createFire, explosionSourceType, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE);
++ // Paper start - Allow explosions to damage source
++ return this.explode(entity, x, y, z, power, createFire, explosionSourceType, null);
++ }
++ public Explosion explode(@Nullable Entity entity, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, @Nullable Consumer<Explosion> configurator) {
++ return this.explode(entity, Explosion.getDefaultDamageSource(this, entity), (ExplosionDamageCalculator) null, x, y, z, power, createFire, explosionSourceType, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE, configurator);
++ // Paper end - Allow explosions to damage source
+ }
+
+ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, Vec3 pos, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType) {
+@@ -794,10 +799,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+ }
+
+ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent) {
+- return this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, true, particle, emitterParticle, soundEvent);
++ // Paper start - Allow explosions to damage source
++ return this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, particle, emitterParticle, soundEvent, null);
++ }
++
++ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent, @Nullable Consumer<Explosion> configurator) {
++ return this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, true, particle, emitterParticle, soundEvent, configurator);
++ // Paper end - Allow explosions to damage source
+ }
+
+ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, boolean particles, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent) {
++ // Paper start - Allow explosions to damage source
++ return this.explode(entity, damageSource, behavior, x, y, z, power, createFire, explosionSourceType, particle, emitterParticle, soundEvent, null);
++ }
++ public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Level.ExplosionInteraction explosionSourceType, boolean particles, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent, @Nullable Consumer<Explosion> configurator) {
++ // Paper end - Allow explosions to damage source
+ Explosion.BlockInteraction explosion_effect;
+
+ switch (explosionSourceType.ordinal()) {
+@@ -827,6 +843,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+
+ Explosion.BlockInteraction explosion_effect1 = explosion_effect;
+ Explosion explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1, particle, emitterParticle, soundEvent);
++ if (configurator != null) configurator.accept(explosion); // Paper - Allow explosions to damage source
+
+ explosion.explode();
+ explosion.finalizeExplosion(particles);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 3c00eaf52ab04d1396f226cc074d9dd013c57027..b2a1f7e6576757d02a0369c42d4526ca3ac3d775 100644
+index 3c00eaf52ab04d1396f226cc074d9dd013c57027..2c13ece6592700126365a155f104d6971aab4ede 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -789,6 +789,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -789,6 +789,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, explosionType).wasCanceled;
}
+ // Paper start
+ @Override
-+ public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) {
-+ return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
++ public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks, boolean excludeSourceFromDamage) {
++ return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE, explosion -> {
++ explosion.excludeSourceFromDamage = excludeSourceFromDamage;
++ }).wasCanceled;
+ }
+ // Paper end
diff --git a/patches/server/0207-Implement-World.getEntity-UUID-API.patch b/patches/server/0207-Implement-World.getEntity-UUID-API.patch
index 315b2e7ac4..24247c437d 100644
--- a/patches/server/0207-Implement-World.getEntity-UUID-API.patch
+++ b/patches/server/0207-Implement-World.getEntity-UUID-API.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index b2a1f7e6576757d02a0369c42d4526ca3ac3d775..281fa67cb5c95e6016c7220c0ef912bbfd28cd9f 100644
+index 2c13ece6592700126365a155f104d6971aab4ede..f54038554bc184ecefbd32c69c234db8aada0309 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1125,6 +1125,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1127,6 +1127,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return list;
}
diff --git a/patches/server/0208-InventoryCloseEvent-Reason-API.patch b/patches/server/0208-InventoryCloseEvent-Reason-API.patch
index 69dc41d4ee..c932aab48f 100644
--- a/patches/server/0208-InventoryCloseEvent-Reason-API.patch
+++ b/patches/server/0208-InventoryCloseEvent-Reason-API.patch
@@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1fac100819e59d00f50e530d3a4157b56d966dba..4f777c9d8c3052f68bc0465c8a7386b8fb486c83 100644
+index f2e75b36cbceb9cfa0755bd045f23073712d0e8a..480025bb35a838cc05022e3e316f8536c47dd87b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1239,7 +1239,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -19,7 +19,7 @@ index 1fac100819e59d00f50e530d3a4157b56d966dba..4f777c9d8c3052f68bc0465c8a7386b8
}
}
}
-@@ -2196,7 +2196,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2198,7 +2198,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
diff --git a/patches/server/0285-Optimize-Captured-BlockEntity-Lookup.patch b/patches/server/0285-Optimize-Captured-BlockEntity-Lookup.patch
index 0cbe385bec..98f12d68db 100644
--- a/patches/server/0285-Optimize-Captured-BlockEntity-Lookup.patch
+++ b/patches/server/0285-Optimize-Captured-BlockEntity-Lookup.patch
@@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index 4c4449f7dee8695a362f83b9356e5754244fff18..60b04a16c6cb0a7109bda5c16e23c1d56ab7afad 100644
+index e414d417dc9226339f0d6c32406772a2eda92940..ba914a54d549b45bdbede2a9850aab34c3640c59 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
-@@ -912,9 +912,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -929,9 +929,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
diff --git a/patches/server/0306-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0306-Optimize-call-to-getFluid-for-explosions.patch
index 4cd45e61ca..7a9152c9ec 100644
--- a/patches/server/0306-Optimize-call-to-getFluid-for-explosions.patch
+++ b/patches/server/0306-Optimize-call-to-getFluid-for-explosions.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimize call to getFluid for explosions
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
-index b216140a8be65e210250358af8daf49344850f20..8bbc5025f202be784db78401154038f1f70f0163 100644
+index ce8ac06b47e81161ad5ff6cc865ad6d3d59807c1..d4fe425954d36f0baddb256e3c83009a84084b72 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
-@@ -193,7 +193,7 @@ public class Explosion {
+@@ -194,7 +194,7 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition);
diff --git a/patches/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch
index 2ab532b2d0..e7c3500d18 100644
--- a/patches/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch
+++ b/patches/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch
@@ -25,10 +25,10 @@ index ee54706b36bd227edacea2a1b6099009bd652039..8206ec366b429858d9582e437781191e
EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index f1fa4cb11f69e248dd55b8aa69f5d07268f182a1..89e05d9316b012a5c8103682ff9dbeae757f4f57 100644
+index b465f05d78e79ffbf70114b18204d85d32761c67..5b89d834a7c01530807e61ea25af2b01f004ce86 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2149,7 +2149,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2151,7 +2151,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@@ -37,7 +37,7 @@ index f1fa4cb11f69e248dd55b8aa69f5d07268f182a1..89e05d9316b012a5c8103682ff9dbeae
if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.add(entityplayer);
ServerLevel.this.updateSleepingPlayerList();
-@@ -2179,6 +2179,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2181,6 +2181,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.inWorld = true; // CraftBukkit - Mark entity as in world
entity.valid = true; // CraftBukkit
diff --git a/patches/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch
index 83b24b5924..cacf61907b 100644
--- a/patches/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch
+++ b/patches/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch
@@ -104,10 +104,10 @@ index 610661dec58b9170d2eb2093c7fab81585ff9a2c..89c4763b990ca9e801ee16c4a50e8067
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 20bb365b188c7081123db87186f0e1a999758817..a381688de78f5a78980b660f9765f839413a6c65 100644
+index c681b83ce59e6edfabd4d42da410f622747d9a6e..347016873354286ac3ec953049bca2cd21680911 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1165,7 +1165,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1167,7 +1167,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setDifficulty(Difficulty difficulty) {
diff --git a/patches/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch
index fff3dfb4d9..1c53244eb5 100644
--- a/patches/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch
+++ b/patches/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch
@@ -44,7 +44,7 @@ index 89c4763b990ca9e801ee16c4a50e806740d061d9..0b288cc080869efed42a28be682f7b68
this.printSaveWarning = false;
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index a381688de78f5a78980b660f9765f839413a6c65..6e01013228798f9682624e912618500f0d4fa485 100644
+index 347016873354286ac3ec953049bca2cd21680911..c35fd2fcb6ced6a16816637353d03c88f1d49d1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -266,7 +266,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -93,7 +93,7 @@ index a381688de78f5a78980b660f9765f839413a6c65..6e01013228798f9682624e912618500f
return true;
}
-@@ -2241,6 +2253,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2243,6 +2255,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
diff --git a/patches/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
index 37342b6ffe..b202f0e934 100644
--- a/patches/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
+++ b/patches/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 89e05d9316b012a5c8103682ff9dbeae757f4f57..9114ba1742a4fc8683848d431fa92046a85fe871 100644
+index 5b89d834a7c01530807e61ea25af2b01f004ce86..50d2e628590e8563d2ef5b987f764cf1785e3b50 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1666,7 +1666,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1668,7 +1668,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
float f1 = this.levelData.getSpawnAngle();
if (!blockposition1.equals(pos) || f1 != angle) {
@@ -19,7 +19,7 @@ index 89e05d9316b012a5c8103682ff9dbeae757f4f57..9114ba1742a4fc8683848d431fa92046
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 6e01013228798f9682624e912618500f0d4fa485..5ae307f9343ffea39c286992459a6c8069d9fb86 100644
+index c35fd2fcb6ced6a16816637353d03c88f1d49d1b..99fccedaab2600881683140e10ee17377375b911 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -246,12 +246,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
diff --git a/patches/server/0398-Prevent-headless-pistons-from-being-created.patch b/patches/server/0398-Prevent-headless-pistons-from-being-created.patch
index 58b77cb5be..9b5071ea2f 100644
--- a/patches/server/0398-Prevent-headless-pistons-from-being-created.patch
+++ b/patches/server/0398-Prevent-headless-pistons-from-being-created.patch
@@ -6,10 +6,10 @@ Subject: [PATCH] Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
-index 8bbc5025f202be784db78401154038f1f70f0163..6a1e2614453bc3d6fe082c1fd43228c4a182442e 100644
+index d4fe425954d36f0baddb256e3c83009a84084b72..edcc9d53ad81e2b2444335ac79abde5a4e2d9d47 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
-@@ -207,6 +207,15 @@ public class Explosion {
+@@ -208,6 +208,15 @@ public class Explosion {
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
set.add(blockposition);
diff --git a/patches/server/0460-Add-WorldGameRuleChangeEvent.patch b/patches/server/0460-Add-WorldGameRuleChangeEvent.patch
index 737b50a1b8..25259dc06e 100644
--- a/patches/server/0460-Add-WorldGameRuleChangeEvent.patch
+++ b/patches/server/0460-Add-WorldGameRuleChangeEvent.patch
@@ -64,10 +64,10 @@ index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a49
public int get() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 5ae307f9343ffea39c286992459a6c8069d9fb86..08124dd65d1f950bdec8fcb55d2553c601b30a66 100644
+index 99fccedaab2600881683140e10ee17377375b911..f698ac90bd3086519f49e92451228415efaf5530 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1885,8 +1885,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1887,8 +1887,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!this.isGameRule(rule)) return false;
@@ -82,7 +82,7 @@ index 5ae307f9343ffea39c286992459a6c8069d9fb86..08124dd65d1f950bdec8fcb55d2553c6
handle.onChanged(this.getHandle());
return true;
}
-@@ -1922,8 +1927,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1924,8 +1929,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!this.isGameRule(rule.getName())) return false;
diff --git a/patches/server/0468-Remove-stale-POIs.patch b/patches/server/0468-Remove-stale-POIs.patch
index 02c2f1843b..15a12eff2d 100644
--- a/patches/server/0468-Remove-stale-POIs.patch
+++ b/patches/server/0468-Remove-stale-POIs.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index c60967b7833a23cff0305219b02b308d92448109..373560fc82e491e6c8b755fecfe78d49a2fc3e2f 100644
+index fdcc744cd210535067a69362411305e23f0e4273..85c83c900c33d139072d17e1850e95d86da324a7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1741,6 +1741,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1743,6 +1743,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {
diff --git a/patches/server/0516-More-World-API.patch b/patches/server/0516-More-World-API.patch
index acbb18e7df..fde1559628 100644
--- a/patches/server/0516-More-World-API.patch
+++ b/patches/server/0516-More-World-API.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] More World API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 08124dd65d1f950bdec8fcb55d2553c601b30a66..c3581aa9a2d708e410c7eae1b7abe6c6f3427ad6 100644
+index f698ac90bd3086519f49e92451228415efaf5530..e882bc363f02b3acac489589e78b38468dfcaaa4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -2130,6 +2130,28 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2132,6 +2132,28 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value()), CraftLocation.toBukkit(found.getFirst(), this));
}
diff --git a/patches/server/0540-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0540-Add-cause-to-Weather-ThunderChangeEvents.patch
index 2807ad861f..f1396c14e2 100644
--- a/patches/server/0540-Add-cause-to-Weather-ThunderChangeEvents.patch
+++ b/patches/server/0540-Add-cause-to-Weather-ThunderChangeEvents.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1fe013b94cf1b5332f1e4645dd35df01e11fe0d9..055650b315d53b56798ded7af2054c3e8e3ee319 100644
+index b877884ef4adf82d5ca9c56277ef27a79773b711..08d25d41641cd031d2d84843268b13e650d8fb00 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -441,8 +441,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -95,10 +95,10 @@ index e50ad48658193f889d65d37c57b1e30ce46758b7..efd0bcfebb3b4f63018d4e20a6a89f79
if (weather.isCancelled()) {
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index c3581aa9a2d708e410c7eae1b7abe6c6f3427ad6..dc16ed952719a5203b1b9a61e0ad2bd39021e8f1 100644
+index e882bc363f02b3acac489589e78b38468dfcaaa4..1cafba435f53762cd5790998b0d96e1e743612b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1208,7 +1208,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1210,7 +1210,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setStorm(boolean hasStorm) {
@@ -107,7 +107,7 @@ index c3581aa9a2d708e410c7eae1b7abe6c6f3427ad6..dc16ed952719a5203b1b9a61e0ad2bd3
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
-@@ -1230,7 +1230,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1232,7 +1232,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setThundering(boolean thundering) {
diff --git a/patches/server/0597-Improve-and-expand-AsyncCatcher.patch b/patches/server/0597-Improve-and-expand-AsyncCatcher.patch
index 08143bc4aa..302d89f6e7 100644
--- a/patches/server/0597-Improve-and-expand-AsyncCatcher.patch
+++ b/patches/server/0597-Improve-and-expand-AsyncCatcher.patch
@@ -166,10 +166,10 @@ index 1cfc906317f07a44f06a4adf021c44e34a2f1d07..6baa313b8201ed23193d7885c85606b0
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason});
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 390cacc7916d1322a7e1e8bff004d415e9fa5622..786a3722f3a50d828e5abe2ff9d415b0e10995ce 100644
+index e165199e30c96e0402c581d389eaae4c0869385f..654935df9dcc80de31caeccdfbeb11010f9dde4b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1758,6 +1758,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1760,6 +1760,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void playSound(Location loc, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
@@ -177,7 +177,7 @@ index 390cacc7916d1322a7e1e8bff004d415e9fa5622..786a3722f3a50d828e5abe2ff9d415b0
if (loc == null || sound == null || category == null) return;
double x = loc.getX();
-@@ -1769,6 +1770,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1771,6 +1772,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
@@ -185,7 +185,7 @@ index 390cacc7916d1322a7e1e8bff004d415e9fa5622..786a3722f3a50d828e5abe2ff9d415b0
if (loc == null || sound == null || category == null) return;
double x = loc.getX();
-@@ -1801,6 +1803,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1803,6 +1805,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void playSound(Entity entity, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
@@ -193,7 +193,7 @@ index 390cacc7916d1322a7e1e8bff004d415e9fa5622..786a3722f3a50d828e5abe2ff9d415b0
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
-@@ -1812,6 +1815,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1814,6 +1817,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void playSound(Entity entity, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
diff --git a/patches/server/0598-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0598-Add-paper-mobcaps-and-paper-playermobcaps.patch
index 10f4a156d9..63ba16c1f3 100644
--- a/patches/server/0598-Add-paper-mobcaps-and-paper-playermobcaps.patch
+++ b/patches/server/0598-Add-paper-mobcaps-and-paper-playermobcaps.patch
@@ -294,10 +294,10 @@ index e09b0a624a80216db5b6f7882c3765f2eb967b06..b8117fac959a894c9821c82f624bc463
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 786a3722f3a50d828e5abe2ff9d415b0e10995ce..0c2734c1d06b6c5dff383f9c6139c0389f220a76 100644
+index 654935df9dcc80de31caeccdfbeb11010f9dde4b..d00ceebe07a837cd4b40a76379d1a8eec66e2272 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1716,9 +1716,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1718,9 +1718,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
diff --git a/patches/server/0609-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0609-Fix-merchant-inventory-not-closing-on-entity-removal.patch
index 2cd406fbc0..7a31528cdd 100644
--- a/patches/server/0609-Fix-merchant-inventory-not-closing-on-entity-removal.patch
+++ b/patches/server/0609-Fix-merchant-inventory-not-closing-on-entity-removal.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index de154106419d57a6b6c410fedc29cec1dbe532de..3c947dc0aea06d66a00aeca51355ea41e8d98f88 100644
+index dba04a8de93b9afe8b51e473de9e1d485c93987e..a473993ea48afd05a884e3ffcbdd15abe74580d2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2245,6 +2245,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2247,6 +2247,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
diff --git a/patches/server/0671-Fix-falling-block-spawn-methods.patch b/patches/server/0671-Fix-falling-block-spawn-methods.patch
index 978a204209..548b96559b 100644
--- a/patches/server/0671-Fix-falling-block-spawn-methods.patch
+++ b/patches/server/0671-Fix-falling-block-spawn-methods.patch
@@ -11,10 +11,10 @@ Restores the API behavior from previous versions of the server
public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 110a5d92d6154bc39c1916006a5cb74798092445..a1912eb5fd26898d7e9848ffb2052fce2fa10868 100644
+index ba011d3b56ed0e5019da61ccfec687042d863beb..20a954c8637c2cf9cc6c0c823e33a44f668cc4f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1393,7 +1393,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1395,7 +1395,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(material != null, "Material cannot be null");
Preconditions.checkArgument(material.isBlock(), "Material.%s must be a block", material);
@@ -28,7 +28,7 @@ index 110a5d92d6154bc39c1916006a5cb74798092445..a1912eb5fd26898d7e9848ffb2052fce
return (FallingBlock) entity.getBukkitEntity();
}
-@@ -1402,7 +1407,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1404,7 +1409,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(location != null, "Location cannot be null");
Preconditions.checkArgument(data != null, "BlockData cannot be null");
diff --git a/patches/server/0699-Don-t-tick-markers.patch b/patches/server/0699-Don-t-tick-markers.patch
index 2f7a18f647..5ab34da747 100644
--- a/patches/server/0699-Don-t-tick-markers.patch
+++ b/patches/server/0699-Don-t-tick-markers.patch
@@ -23,10 +23,10 @@ index 67fcba634f8183bb33834ac3b2c3dcfb8d87129e..777b789fdcdf297309cfb36fc7f77e3f
}
});
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 60a77bd04489ee592ec61d3d739cb3062c1eefbb..492e8a2ff5618c45bfffa3284f03be14ff162ce8 100644
+index a87a0c9672b53db0e06292c339b3b1e163901942..f4ab0ce684ae2a83a02848c4d18062e1b27377ce 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2160,6 +2160,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2162,6 +2162,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void onTickingStart(Entity entity) {
diff --git a/patches/server/0725-Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/0725-Warn-on-plugins-accessing-faraway-chunks.patch
index a0023ba6e1..1b42817dd9 100644
--- a/patches/server/0725-Warn-on-plugins-accessing-faraway-chunks.patch
+++ b/patches/server/0725-Warn-on-plugins-accessing-faraway-chunks.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Warn on plugins accessing faraway chunks
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index b4111bcc6a676dc42b233761aa667708669c2ab8..cc92d2e8b77c75da1d8b850c3bc251e8ac221c24 100644
+index f800975068135fb86b025254db6f88f406cf0b65..63beee706d820bba5fb93db0bf53b4a6ecd403a1 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -339,7 +339,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -18,7 +18,7 @@ index b4111bcc6a676dc42b233761aa667708669c2ab8..cc92d2e8b77c75da1d8b850c3bc251e8
private static boolean isOutsideSpawnableHeight(int y) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index a1912eb5fd26898d7e9848ffb2052fce2fa10868..cb28a7504e809a8b1e8ab6e34e14e414c542055f 100644
+index 20a954c8637c2cf9cc6c0c823e33a44f668cc4f6..58cd4ecd5582c01b836814f4151df2538b93143c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -305,9 +305,24 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -78,7 +78,7 @@ index a1912eb5fd26898d7e9848ffb2052fce2fa10868..cb28a7504e809a8b1e8ab6e34e14e414
this.getHandle().setChunkForced(x, z, forced);
}
-@@ -946,6 +965,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -948,6 +967,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
@@ -86,7 +86,7 @@ index a1912eb5fd26898d7e9848ffb2052fce2fa10868..cb28a7504e809a8b1e8ab6e34e14e414
// Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
}
-@@ -2343,6 +2363,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2345,6 +2365,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot end
// Paper start
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
diff --git a/patches/server/0746-Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/0746-Remove-unnecessary-onTrackingStart-during-navigation.patch
index 4de44632f0..104738383c 100644
--- a/patches/server/0746-Remove-unnecessary-onTrackingStart-during-navigation.patch
+++ b/patches/server/0746-Remove-unnecessary-onTrackingStart-during-navigation.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1edad85fc5c199dcab66497fa758e48dd14aec8c..faacbdcce7de32f4e3e4a9528ea59808ccaee70b 100644
+index d3707c3fabc09068f3b07edebe9a333c153dfab5..4bf6281a75597072b19658208e4447c4d1ee8ba2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2184,7 +2184,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2186,7 +2186,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (entity instanceof Mob entityinsentient) {
@@ -17,7 +17,7 @@ index 1edad85fc5c199dcab66497fa758e48dd14aec8c..faacbdcce7de32f4e3e4a9528ea59808
String s = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
-@@ -2264,7 +2264,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2266,7 +2266,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (entity instanceof Mob entityinsentient) {
diff --git a/patches/server/0766-check-global-player-list-where-appropriate.patch b/patches/server/0766-check-global-player-list-where-appropriate.patch
index cc1aa7af3e..f777294a49 100644
--- a/patches/server/0766-check-global-player-list-where-appropriate.patch
+++ b/patches/server/0766-check-global-player-list-where-appropriate.patch
@@ -7,10 +7,10 @@ Makes certain entities check all players when searching for a player
instead of just checking players in their world.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index faacbdcce7de32f4e3e4a9528ea59808ccaee70b..07f7752651095abdd9e9408a419aed7d78173d3a 100644
+index 4bf6281a75597072b19658208e4447c4d1ee8ba2..688f9f13ae06337250e2e9ac2ddf9ad90d049f9b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2300,4 +2300,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2302,4 +2302,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::move);
}
}
diff --git a/patches/server/0847-Only-capture-actual-tree-growth.patch b/patches/server/0847-Only-capture-actual-tree-growth.patch
index aef612bcaa..de9896609a 100644
--- a/patches/server/0847-Only-capture-actual-tree-growth.patch
+++ b/patches/server/0847-Only-capture-actual-tree-growth.patch
@@ -29,10 +29,10 @@ index 10b3e41d589d480046e15a957902c2751b731cec..87cae96faf33fa0491b13add79e02fc2
entityhuman.awardStat(Stats.ITEM_USED.get(item)); // SPIGOT-7236 - award stat
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index 0a3e56302470f239d4840e4e32d2a0ce4611ff65..3f87e60c0d43703a8450b5920dac59a970809397 100644
+index bd909b08b5e604778d35ba6514cf8c353d489228..c8a3e49f08fd0d110ffc3be763cfda4e62f55916 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
-@@ -1378,4 +1378,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1395,4 +1395,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return range <= 0 ? 64.0 * 64.0 : range * range; // 64 is taken from default in ServerLevel#levelEvent
}
// Paper end - respect global sound events gamerule
diff --git a/patches/server/0854-Bandaid-fix-for-Effect.patch b/patches/server/0854-Bandaid-fix-for-Effect.patch
index c99dd754f1..867e3cef97 100644
--- a/patches/server/0854-Bandaid-fix-for-Effect.patch
+++ b/patches/server/0854-Bandaid-fix-for-Effect.patch
@@ -68,10 +68,10 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..c856384019eff2f2d0bb831ebe1ccb0f
break;
case BONE_MEAL_USE:
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index cb28a7504e809a8b1e8ab6e34e14e414c542055f..28458a499702989d640d88de8fa7e8861be95189 100644
+index 58cd4ecd5582c01b836814f4151df2538b93143c..cb50fca4867688d2572e8ab5b7fef7243c5b8ba9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1370,7 +1370,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1372,7 +1372,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
if (data != null) {
Preconditions.checkArgument(effect.getData() != null, "Effect.%s does not have a valid Data", effect);
diff --git a/patches/server/0889-Fix-missing-map-initialize-event-call.patch b/patches/server/0889-Fix-missing-map-initialize-event-call.patch
index c95f6abbf7..3cb380d89c 100644
--- a/patches/server/0889-Fix-missing-map-initialize-event-call.patch
+++ b/patches/server/0889-Fix-missing-map-initialize-event-call.patch
@@ -7,10 +7,10 @@ Subject: [PATCH] Fix missing map initialize event call
public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index fd4d1cab675b7b423ac0fdf9a8c9f472ddc68c36..60c75f7c4258efb26c2595ca7724b08d3c046c9d 100644
+index 1ed6002501b501e72bfff81ae9abc506133a10d0..c13652fccf08ff9235f22e89941a37b283f92f03 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -1662,13 +1662,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1664,13 +1664,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Nullable
@Override
public MapItemSavedData getMapData(MapId id) {
diff --git a/patches/server/0898-Add-predicate-for-blocks-when-raytracing.patch b/patches/server/0898-Add-predicate-for-blocks-when-raytracing.patch
index 43a753b5c2..d609b78620 100644
--- a/patches/server/0898-Add-predicate-for-blocks-when-raytracing.patch
+++ b/patches/server/0898-Add-predicate-for-blocks-when-raytracing.patch
@@ -47,10 +47,10 @@ index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa3
Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 28458a499702989d640d88de8fa7e8861be95189..166458785b507208caa7ecf8ee8b60650ca3523a 100644
+index cb50fca4867688d2572e8ab5b7fef7243c5b8ba9..7ada46aa24e1bc15207a34c15b056e4e76238757 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1104,9 +1104,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1106,9 +1106,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) {
@@ -68,7 +68,7 @@ index 28458a499702989d640d88de8fa7e8861be95189..166458785b507208caa7ecf8ee8b6065
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite();
-@@ -1156,9 +1162,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1158,9 +1164,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
@@ -87,7 +87,7 @@ index 28458a499702989d640d88de8fa7e8861be95189..166458785b507208caa7ecf8ee8b6065
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
direction.checkFinite();
-@@ -1171,16 +1184,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1173,16 +1186,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
Vector dir = direction.clone().normalize().multiply(maxDistance);
diff --git a/patches/server/0936-More-Raid-API.patch b/patches/server/0936-More-Raid-API.patch
index e218d301b5..8824526cad 100644
--- a/patches/server/0936-More-Raid-API.patch
+++ b/patches/server/0936-More-Raid-API.patch
@@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392
+ // Paper end - more Raid API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index cb85180daaa2b40cba2474784548d650bc4d639b..50b84939eee044ddadca046079286a72de5c8e04 100644
+index f27568d26e02b5244a84d0fb6d8c1d9f14b7a519..e8404d5bad60b8fa290f334d3c64ee5503e01e5c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -2311,6 +2311,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2313,6 +2313,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (raid == null) ? null : new CraftRaid(raid);
}
diff --git a/patches/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
index 12dc4db2ff..89974873d2 100644
--- a/patches/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
+++ b/patches/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch
@@ -13,10 +13,10 @@ A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
-index 6a1e2614453bc3d6fe082c1fd43228c4a182442e..b70ac21d8dc70fb1513ea7ce5270fb381552c29a 100644
+index edcc9d53ad81e2b2444335ac79abde5a4e2d9d47..2109257fde8606abda4f41427f690da3b96c0175 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
-@@ -193,6 +193,7 @@ public class Explosion {
+@@ -194,6 +194,7 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition);
@@ -25,7 +25,7 @@ index 6a1e2614453bc3d6fe082c1fd43228c4a182442e..b70ac21d8dc70fb1513ea7ce5270fb38
if (!this.level.isInWorldBounds(blockposition)) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index b7bf7b3b91046c81467aeb483087e12b6d9191bf..a2877f3eb206ab9ccb93e3606f1c9b3401def5d6 100644
+index 9ca71a060f916868e70222e0cdc0f96b96bac450..751da19e147049c4f196d9b200b7baf9bebaed81 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -447,6 +447,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
diff --git a/patches/server/0981-Moonrise-optimisation-patches.patch b/patches/server/0981-Moonrise-optimisation-patches.patch
index 4305cb9755..0e81124113 100644
--- a/patches/server/0981-Moonrise-optimisation-patches.patch
+++ b/patches/server/0981-Moonrise-optimisation-patches.patch
@@ -25574,7 +25574,7 @@ index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..12d86f27d04bffed8c3844e36b42fbc2
if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60a29e8e3c 100644
+index 342682178950c8986fb3c86924811089f4de887d..f910e37a8e7cd0358c149d84bafd941126a0b0f4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@@ -26106,7 +26106,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
return false;
} else {
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
-@@ -1850,7 +2056,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1852,7 +2058,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@@ -26115,7 +26115,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
-@@ -1899,7 +2105,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1901,7 +2107,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
try {
@@ -26124,7 +26124,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
} catch (Throwable throwable4) {
if (bufferedwriter2 != null) {
try {
-@@ -1920,7 +2126,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -1922,7 +2128,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
try {
@@ -26133,7 +26133,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
} catch (Throwable throwable6) {
if (bufferedwriter3 != null) {
try {
-@@ -2062,7 +2268,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2064,7 +2270,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting
public String getWatchdogStats() {
@@ -26142,7 +26142,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
}
-@@ -2092,15 +2298,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2094,15 +2300,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public LevelEntityGetter<Entity> getEntities() {
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
@@ -26171,7 +26171,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
}
public void startTickingChunk(LevelChunk chunk) {
-@@ -2120,34 +2336,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2122,34 +2338,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override
public void close() throws IOException {
super.close();
@@ -26226,7 +26226,7 @@ index 81f0a0dfefd9e1698548a68679dab0974921c37a..24d5e741aed1677d0df59c1455fbfc60
}
@Override
-@@ -2173,7 +2402,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -2175,7 +2404,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
crashreportsystemdetails.setDetail("Loaded entity count", () -> {
@@ -27715,12 +27715,12 @@ index bd20bea7f76a7307f1698fb2dfef37125032d166..141b748abe80402731cdaf14a3d36aa7
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
-index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f11e142e1b 100644
+index 2109257fde8606abda4f41427f690da3b96c0175..f696afd7e241bf1966a2d505b5d59bff824b43e4 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
-@@ -75,6 +75,247 @@ public class Explosion {
- public float yield;
+@@ -76,6 +76,247 @@ public class Explosion {
// CraftBukkit end
+ public boolean excludeSourceFromDamage = true; // Paper - Allow explosions to damage source
+ // Paper start - optimise collisions
+ private static final double[] CACHED_RAYS;
@@ -27966,7 +27966,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
public static DamageSource getDefaultDamageSource(Level world, @Nullable Entity source) {
return world.damageSources().explosion(source, Explosion.getIndirectSourceEntityInternal(source));
}
-@@ -167,68 +408,107 @@ public class Explosion {
+@@ -168,68 +409,107 @@ public class Explosion {
}
// CraftBukkit end
this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
@@ -28122,7 +28122,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
float f2 = this.radius * 2.0F;
i = Mth.floor(this.x - (double) f2 - 1.0D);
-@@ -241,6 +521,10 @@ public class Explosion {
+@@ -242,6 +522,10 @@ public class Explosion {
Vec3 vec3d = new Vec3(this.x, this.y, this.z);
Iterator iterator = list.iterator();
@@ -28133,7 +28133,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
-@@ -257,6 +541,7 @@ public class Explosion {
+@@ -258,6 +542,7 @@ public class Explosion {
d8 /= d11;
d9 /= d11;
d10 /= d11;
@@ -28141,7 +28141,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
if (this.damageCalculator.shouldDamageEntity(this, entity)) {
// CraftBukkit start
-@@ -272,6 +557,8 @@ public class Explosion {
+@@ -273,6 +558,8 @@ public class Explosion {
entity.lastDamageCancelled = false;
@@ -28150,7 +28150,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
if (entity instanceof EnderDragon) {
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
// Calculate damage separately for each EntityComplexPart
-@@ -280,16 +567,21 @@ public class Explosion {
+@@ -281,16 +568,21 @@ public class Explosion {
}
}
} else {
@@ -28175,7 +28175,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
double d13;
if (entity instanceof LivingEntity) {
-@@ -327,7 +619,11 @@ public class Explosion {
+@@ -328,7 +620,11 @@ public class Explosion {
}
}
}
@@ -28188,7 +28188,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
}
public void finalizeExplosion(boolean particles) {
-@@ -544,14 +840,14 @@ public class Explosion {
+@@ -545,14 +841,14 @@ public class Explosion {
private BlockInteraction() {}
}
// Paper start - Optimize explosions
@@ -28207,7 +28207,7 @@ index b70ac21d8dc70fb1513ea7ce5270fb381552c29a..ad57bf49476192dea6a7367cbd0ad3f1
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index e5abde76c354c3dd9940dd4e5ae3fe8b6a2b4680..347334130e99dbf938d570bd36440a96f92d475a 100644
+index 16e721ac80ba21511bdeccfccd055f7700bda61f..7a592a3c5491fc19ab33287e1e60b869a618497c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.LevelData;
@@ -28775,7 +28775,7 @@ index e5abde76c354c3dd9940dd4e5ae3fe8b6a2b4680..347334130e99dbf938d570bd36440a96
}
// Paper end - Option to prevent armor stands from doing entity lookups
-@@ -949,7 +1447,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -966,7 +1464,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end
@@ -28784,7 +28784,7 @@ index e5abde76c354c3dd9940dd4e5ae3fe8b6a2b4680..347334130e99dbf938d570bd36440a96
}
public void setBlockEntity(BlockEntity blockEntity) {
-@@ -1039,28 +1537,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1056,28 +1554,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities");
@@ -28818,7 +28818,7 @@ index e5abde76c354c3dd9940dd4e5ae3fe8b6a2b4680..347334130e99dbf938d570bd36440a96
}
@Override
-@@ -1075,36 +1558,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1092,36 +1575,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
}
@@ -32762,7 +32762,7 @@ index df15ce8d1da2737e339880d3d2f6731e0b92ca7f..b5644700878a3eda50a56cd2292c6ceb
// Paper start - Adventure
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 50b84939eee044ddadca046079286a72de5c8e04..15e075fc3a9b18e62e04f41fcadbe62e05cd8c79 100644
+index e8404d5bad60b8fa290f334d3c64ee5503e01e5c..65c77bce55121c95bf2264e9058af73bcf22fc4b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -461,10 +461,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -32824,7 +32824,7 @@ index 50b84939eee044ddadca046079286a72de5c8e04..15e075fc3a9b18e62e04f41fcadbe62e
long chunkKey = chunkTickets.getLongKey();
SortedArraySet<Ticket<?>> tickets = chunkTickets.getValue();
-@@ -1295,12 +1286,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -1297,12 +1288,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public int getViewDistance() {
@@ -32839,7 +32839,7 @@ index 50b84939eee044ddadca046079286a72de5c8e04..15e075fc3a9b18e62e04f41fcadbe62e
}
public BlockMetadataStore getBlockMetadata() {
-@@ -2438,17 +2429,20 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2440,17 +2431,20 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setSimulationDistance(final int simulationDistance) {
diff --git a/patches/server/0985-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0985-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
index 30dde1fadd..a5a550aaca 100644
--- a/patches/server/0985-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
+++ b/patches/server/0985-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
@@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index c2189752a422f39428b2c0f1408f359f20c388e5..dec865affbaaa71d09806143d13a854100b98f23 100644
+index 376443dfc846f7511c60125cb7714757d15590ea..81eb2d57045dd9d692109b33fc10804ff3d68d54 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -2494,6 +2494,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -2496,6 +2496,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
{
if ( iter.next().player == entity )
{
diff --git a/patches/server/0994-Add-Alternate-Current-redstone-implementation.patch b/patches/server/0994-Add-Alternate-Current-redstone-implementation.patch
index 8e8dac3c75..dc479927b8 100644
--- a/patches/server/0994-Add-Alternate-Current-redstone-implementation.patch
+++ b/patches/server/0994-Add-Alternate-Current-redstone-implementation.patch
@@ -2306,7 +2306,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 1f611e7c877bf89f598148db69c1d4166b00f8ac..d223ecfbb0b8986507ce8b6728edbf7c8d818b7d 100644
+index acc11fc7f30b6d4a3a4445b7db25bf99c93b39f2..6f3eedade396405d67ff56c66755929acda5cff0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2317,7 +2317,7 @@ index 1f611e7c877bf89f598148db69c1d4166b00f8ac..d223ecfbb0b8986507ce8b6728edbf7c
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
-@@ -2425,6 +2426,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
+@@ -2427,6 +2428,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return crashreportsystemdetails;
}
@@ -2332,10 +2332,10 @@ index 1f611e7c877bf89f598148db69c1d4166b00f8ac..d223ecfbb0b8986507ce8b6728edbf7c
EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index 87cde688976a45aa8848586b5371b3ab493813ea..5c4eaa6bcf20b0fcec14bd5ef76ea6f29a8613a2 100644
+index c4ec80bbab850fe767a345d96f02103ca43eb3cb..ca1dab96b40511d53aedd4f64e6cd0fb03583710 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
-@@ -2013,4 +2013,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
+@@ -2030,4 +2030,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
}
}
// Paper end - notify observers even if grow failed
diff --git a/patches/server/1052-Add-FeatureFlag-API.patch b/patches/server/1052-Add-FeatureFlag-API.patch
index 9c718a7db4..039bb83bf3 100644
--- a/patches/server/1052-Add-FeatureFlag-API.patch
+++ b/patches/server/1052-Add-FeatureFlag-API.patch
@@ -160,10 +160,10 @@ index 284234fcdd15c4c7a4567c7c887d47bf0b7967f4..c9ecec5da937bc5458f69736b68ff6ae
+ // Paper end - feature flag API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 90d4834f97d3ba996d46493246b1947511553424..cd3381d8225e0322b3e285b3c4aa0a1265a91cc0 100644
+index 77fb4ffdd548d858fbecfe31f6765ce0cb786944..38b046da5acac8633db8618a2957187d291f5e73 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -2372,10 +2372,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+@@ -2374,10 +2374,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.persistentDataContainer;
}