Adds support for vanilla negative explosions (#12705)

Fixes #10460
This commit is contained in:
Owen
2025-06-21 00:54:53 -04:00
committed by GitHub
parent e4eb69b8a1
commit 71b0c76861
3 changed files with 15 additions and 29 deletions

View File

@ -30766,7 +30766,7 @@ index c59f2c0634e3ebb11b8f6bc09020f951cb602f9b..0842fd6488c8b27d98c4344e1244996b
ChunkAccess getChunk(int x, int z, ChunkStatus chunkStatus, boolean requireChunk);
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 8afaded394fcbf5d7ad4c51ea49642ce93cd5198..e5ccfb8cbfafed7bb0a1d888b5bc98a923e46e59 100644
index 677780bf473f56a4083b984e1eb75b74f7716540..07e4025ca6c9c31905db2e6921138a0ded479dde 100644
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -60,6 +60,249 @@ public class ServerExplosion implements Explosion {
@ -31019,7 +31019,7 @@ index 8afaded394fcbf5d7ad4c51ea49642ce93cd5198..e5ccfb8cbfafed7bb0a1d888b5bc98a9
public ServerExplosion(
ServerLevel level,
@@ -131,63 +374,102 @@ public class ServerExplosion implements Explosion {
@@ -134,63 +377,102 @@ public class ServerExplosion implements Explosion {
}
private List<BlockPos> calculateExplodedPositions() {
@ -31169,10 +31169,10 @@ index 8afaded394fcbf5d7ad4c51ea49642ce93cd5198..e5ccfb8cbfafed7bb0a1d888b5bc98a9
}
private void hurtEntities() {
@@ -360,6 +642,14 @@ public class ServerExplosion implements Explosion {
return;
}
// CraftBukkit end
@@ -358,6 +640,14 @@ public class ServerExplosion implements Explosion {
}
public void explode() {
+ // Paper start - collision optimisations
+ this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
+ this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
@ -31184,7 +31184,7 @@ index 8afaded394fcbf5d7ad4c51ea49642ce93cd5198..e5ccfb8cbfafed7bb0a1d888b5bc98a9
this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center);
List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities();
@@ -373,6 +663,13 @@ public class ServerExplosion implements Explosion {
@@ -371,6 +661,13 @@ public class ServerExplosion implements Explosion {
if (this.fire) {
this.createFire(list);
}
@ -31198,7 +31198,7 @@ index 8afaded394fcbf5d7ad4c51ea49642ce93cd5198..e5ccfb8cbfafed7bb0a1d888b5bc98a9
}
private static void addOrAppendStack(List<ServerExplosion.StackCollector> stackCollectors, ItemStack stack, BlockPos pos) {
@@ -461,12 +758,12 @@ public class ServerExplosion implements Explosion {
@@ -459,12 +756,12 @@ public class ServerExplosion implements Explosion {
// Paper start - Optimize explosions
private float getBlockDensity(Vec3 vec3d, Entity entity) {
if (!this.level.paperConfig().environment.optimizeExplosions) {