SPIGOT-4400: Populators running on existing chunks

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-09-27 21:41:24 +10:00
parent 0de14a04dd
commit d5f782996e
4 changed files with 124 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkMap.java
+++ b/net/minecraft/server/ChunkMap.java
@@ -31,6 +31,46 @@
@@ -31,6 +31,23 @@
}
}
@@ -19,35 +19,12 @@
+ }
+ }
+ }
+
+ if (chunk.newChunk) {
+ BlockSand.instaFall = true;
+ java.util.Random random = new java.util.Random();
+ random.setSeed(chunk.world.getSeed());
+ long xRand = random.nextLong() / 2L * 2L + 1L;
+ long zRand = random.nextLong() / 2L * 2L + 1L;
+ random.setSeed((long) chunk.locX * xRand + (long) chunk.locZ * zRand ^ chunk.world.getSeed());
+
+ org.bukkit.World world = chunk.world.getWorld();
+ if (world != null) {
+ chunk.world.populating = true;
+ try {
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
+ populator.populate(world, random, chunk.bukkitChunk);
+ }
+ } finally {
+ chunk.world.populating = false;
+ }
+ }
+ BlockSand.instaFall = false;
+ chunk.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk));
+ }
+ // CraftBukkit end
+
return chunk1;
}
@@ -69,23 +109,25 @@
@@ -69,23 +86,25 @@
throw new RuntimeException("Not yet implemented");
}