Paper/patches/server/0386-Don-t-fire-BlockFade-on-worldgen-threads.patch

29 lines
1.6 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
2023-03-14 20:54:57 +01:00
index 33ece83c6d41c65042356c44eee2c76934c07d0b..9576f581bb61e6c71de427c52dcc3e56dc3ed81e 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
2023-03-14 20:54:57 +01:00
@@ -101,6 +101,7 @@ public class FireBlock extends BaseFireBlock {
2021-06-11 14:02:28 +02:00
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
2021-06-11 14:02:28 +02:00
// CraftBukkit start
+ if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation
if (!this.canSurvive(state, world, pos)) {
// Suppress during worldgen
if (!(world instanceof Level)) {
2023-03-14 20:54:57 +01:00
@@ -116,7 +117,7 @@ public class FireBlock extends BaseFireBlock {
2021-06-11 14:02:28 +02:00
return blockState.getHandle();
}
}
- return this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE));
+ return this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)); // Paper - diff on change, see "don't fire events in world generation"
// CraftBukkit end
}