summaryrefslogtreecommitdiffstats
path: root/nms-patches/Location2D.patch
blob: 4214968723a6fb9eb35df350321e06fc4919637e (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
--- ../work/decompile-8eb82bde//net/minecraft/server/Location2D.java	2014-12-26 21:29:07.829484981 +0000
+++ src/main/java/net/minecraft/server/Location2D.java	2014-12-26 21:29:07.829484981 +0000
@@ -68,7 +68,7 @@
             }
 
             blockposition = blockposition.down();
-        } while (world.getType(blockposition).getBlock().getMaterial() == Material.AIR);
+        } while (getType(world, blockposition).getBlock().getMaterial() == Material.AIR); // CraftBukkit
 
         return blockposition.getY() + 1;
     }
@@ -84,7 +84,7 @@
             }
 
             blockposition = blockposition.down();
-            material = world.getType(blockposition).getBlock().getMaterial();
+            material = getType(world, blockposition).getBlock().getMaterial(); // CraftBukkit
         } while (material == Material.AIR);
 
         return !material.isLiquid() && material != Material.FIRE;
@@ -94,4 +94,11 @@
         this.a = MathHelper.a(random, d0, d2);
         this.b = MathHelper.a(random, d1, d3);
     }
+
+    // CraftBukkit start - add a version of getType which force loads chunks
+    private static IBlockData getType(World world, BlockPosition position) {
+        ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
+        return world.getType(position);
+    }
+    // CraftBukkit end
 }