diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-11 23:47:19 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-11 23:47:30 +0100 |
commit | b042f48b248bcf4b828739696066bc7f81ecc9c4 (patch) | |
tree | fef3c7604fe452f55bdefe47527083d90a01f775 /src/main | |
parent | 96b1b8a10cec88c724b83541aed6f87b188f5e14 (diff) | |
download | craftbukkit-b042f48b248bcf4b828739696066bc7f81ecc9c4.tar craftbukkit-b042f48b248bcf4b828739696066bc7f81ecc9c4.tar.gz craftbukkit-b042f48b248bcf4b828739696066bc7f81ecc9c4.tar.lz craftbukkit-b042f48b248bcf4b828739696066bc7f81ecc9c4.tar.xz craftbukkit-b042f48b248bcf4b828739696066bc7f81ecc9c4.zip |
Fixed random NPEs when generating a world
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/ChunkProviderServer.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 57da4a8a..0697b366 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -13,6 +13,7 @@ import java.util.Random; import org.bukkit.Server; import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.util.LongHashset; import org.bukkit.craftbukkit.util.LongHashtable; import org.bukkit.event.world.ChunkLoadEvent; @@ -182,8 +183,11 @@ public class ChunkProviderServer implements IChunkProvider { long xRand = random.nextLong() / 2L * 2L + 1L; long zRand = random.nextLong() / 2L * 2L + 1L; random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed()); - for (BlockPopulator populator : world.getWorld().getPopulators()) { - populator.populate(world.getWorld(), random, chunk.bukkitChunk); + CraftWorld world = (CraftWorld)this.world.getWorld(); + if (world != null) { + for (BlockPopulator populator : world.getPopulators()) { + populator.populate(world, random, chunk.bukkitChunk); + } } BlockSand.a = false; // CraftBukkit end |