aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0408-Don-t-fire-BlockFade-on-worldgen-threads.patch
blob: 8a5268c81a8b6bbdf0304757c9083ee97dc493fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
index 33752432af861a708e0dbb1afafcd5968d795931..08bc35b40720ca001d3f6c1185bdd11c61ec9ee1 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -100,6 +100,7 @@ public class FireBlock extends BaseFireBlock {
     @Override
     public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
         // 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)) {
@@ -115,7 +116,7 @@ public class FireBlock extends BaseFireBlock {
                 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
     }