aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0117-Prevent-Fire-from-loading-chunks.patch
blob: b58eb9585348a52ea512854a3094542c63999dde (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From cf26fbf700eb4d7f23c9a35ef6cb56859d52ca39 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Apr 2016 17:27:09 -0400
Subject: [PATCH] Prevent Fire from loading chunks

This causes the nether to spam unload/reload chunks, plus overall
bad behavior.

diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 94cb9d462..dfc328850 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -164,6 +164,7 @@ public class BlockFire extends Block {
                                 }
 
                                 BlockPosition blockposition1 = blockposition.a(j, l, k);
+                                if (!world.isLoaded(blockposition1)) continue; // Paper
                                 int j1 = this.d(world, blockposition1);
 
                                 if (j1 > 0) {
@@ -232,10 +233,14 @@ public class BlockFire extends Block {
     }
 
     private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
-        int k = this.c(world.getType(blockposition).getBlock());
+        // Paper start
+        final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
+        if (iblockdata == null) return;
+        int k = this.c(iblockdata.getBlock());
+        // Paper end
 
         if (random.nextInt(i) < k) {
-            IBlockData iblockdata = world.getType(blockposition);
+            //IBlockData iblockdata = world.getType(blockposition); // Paper
 
             // CraftBukkit start
             org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
@@ -294,7 +299,9 @@ public class BlockFire extends Block {
             for (int k = 0; k < j; ++k) {
                 EnumDirection enumdirection = aenumdirection[k];
 
-                i = Math.max(this.d(world.getType(blockposition.shift(enumdirection)).getBlock()), i);
+                final IBlockData type = world.getTypeIfLoaded(blockposition.shift(enumdirection)); // Paper
+                if (type == null) continue; // Paper
+                i = Math.max(this.d(type.getBlock()), i); // Paper
             }
 
             return i;
-- 
2.12.2