Paper/Spigot-Server-Patches/0467-Don-t-fire-BlockFade-on-worldgen-threads.patch

29 Zeilen
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 23 Apr 2020 01:36:39 -0400
Subject: [PATCH] Don't fire BlockFade on worldgen threads
Caused a deadlock
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 1e6159f211fb445e45bab3ca1a3bf21750928302..70bcf165b187ba5b3d832f6ad2df87cc51e59bea 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -35,6 +35,7 @@ public class BlockFire extends BlockFireAbstract {
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
// CraftBukkit start
+ if (!(generatoraccess instanceof WorldServer)) return this.canPlace(iblockdata, generatoraccess, blockposition) ? (IBlockData) this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData(); // Paper - don't fire events in world generation
if (!this.canPlace(iblockdata, generatoraccess, blockposition)) {
CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
blockState.setData(Blocks.AIR.getBlockData());
@@ -46,7 +47,7 @@ public class BlockFire extends BlockFireAbstract {
return blockState.getHandle();
}
}
- return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE));
+ return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)); // Paper - diff on change, see "don't fire events in world generation"
// CraftBukkit end
}