From 20ef9f5676c3c2790c96e8ec4b835c9a7e2149ef Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Wed, 11 Mar 2015 10:15:39 +0000 Subject: SPIGOT-677: Add populators slightly later to make sure everything is initialized --- nms-patches/World.patch | 75 +++++++++++++++++++++---------------------- nms-patches/WorldServer.patch | 61 ++++++++++++++++++++--------------- 2 files changed, 71 insertions(+), 65 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/World.patch b/nms-patches/World.patch index be4db23b..cf881890 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/World.java 2015-03-08 10:08:09.827589087 +0000 -+++ src/main/java/net/minecraft/server/World.java 2015-03-08 10:08:09.831589087 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/World.java 2015-03-11 10:15:29.115595382 +0000 ++++ src/main/java/net/minecraft/server/World.java 2015-03-11 10:15:29.119595382 +0000 @@ -13,6 +13,22 @@ import java.util.UUID; import java.util.concurrent.Callable; @@ -23,7 +23,7 @@ public abstract class World implements IBlockAccess { private int a = 63; -@@ -36,27 +52,75 @@ +@@ -36,27 +52,72 @@ protected float r; private int J; public final Random random = new Random(); @@ -98,16 +98,13 @@ + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.generator = gen; + this.world = new CraftWorld((WorldServer) this, gen, env); -+ if (gen != null) { -+ getWorld().getPopulators().addAll(gen.getDefaultPopulators(getWorld())); -+ } + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit + this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit + // CraftBukkit end this.L = this.random.nextInt(12000); this.allowMonsters = true; this.allowAnimals = true; -@@ -67,6 +131,35 @@ +@@ -67,6 +128,35 @@ this.worldProvider = worldprovider; this.isClientSide = flag; this.N = worldprovider.getWorldBorder(); @@ -143,7 +140,7 @@ } public World b() { -@@ -193,6 +286,27 @@ +@@ -193,6 +283,27 @@ } public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { @@ -171,7 +168,7 @@ if (!this.isValidLocation(blockposition)) { return false; } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { -@@ -200,9 +314,23 @@ +@@ -200,9 +311,23 @@ } else { Chunk chunk = this.getChunkAtWorldCoords(blockposition); Block block = iblockdata.getBlock(); @@ -195,7 +192,7 @@ return false; } else { Block block1 = iblockdata1.getBlock(); -@@ -213,6 +341,7 @@ +@@ -213,6 +338,7 @@ this.methodProfiler.b(); } @@ -203,7 +200,7 @@ if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) { this.notify(blockposition); } -@@ -223,12 +352,35 @@ +@@ -223,12 +349,35 @@ this.updateAdjacentComparators(blockposition, block); } } @@ -239,7 +236,7 @@ public boolean setAir(BlockPosition blockposition) { return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); } -@@ -262,6 +414,11 @@ +@@ -262,6 +411,11 @@ public void update(BlockPosition blockposition, Block block) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { @@ -251,7 +248,7 @@ this.applyPhysics(blockposition, block); } -@@ -337,6 +494,17 @@ +@@ -337,6 +491,17 @@ IBlockData iblockdata = this.getType(blockposition); try { @@ -269,7 +266,7 @@ iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); -@@ -518,6 +686,17 @@ +@@ -518,6 +683,17 @@ } public IBlockData getType(BlockPosition blockposition) { @@ -287,7 +284,7 @@ if (!this.isValidLocation(blockposition)) { return Blocks.AIR.getBlockData(); } else { -@@ -723,6 +902,13 @@ +@@ -723,6 +899,13 @@ } public boolean addEntity(Entity entity) { @@ -301,7 +298,7 @@ int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); boolean flag = entity.attachedToPlayer; -@@ -731,7 +917,35 @@ +@@ -731,7 +914,35 @@ flag = true; } @@ -337,7 +334,7 @@ return false; } else { if (entity instanceof EntityHuman) { -@@ -753,6 +967,7 @@ +@@ -753,6 +964,7 @@ ((IWorldAccess) this.u.get(i)).a(entity); } @@ -345,7 +342,7 @@ } protected void b(Entity entity) { -@@ -760,6 +975,7 @@ +@@ -760,6 +972,7 @@ ((IWorldAccess) this.u.get(i)).b(entity); } @@ -353,7 +350,7 @@ } public void kill(Entity entity) { -@@ -794,7 +1010,15 @@ +@@ -794,7 +1007,15 @@ this.getChunkAt(i, j).b(entity); } @@ -370,7 +367,7 @@ this.b(entity); } -@@ -978,6 +1202,11 @@ +@@ -978,6 +1199,11 @@ for (i = 0; i < this.k.size(); ++i) { entity = (Entity) this.k.get(i); @@ -382,7 +379,7 @@ try { ++entity.ticksLived; -@@ -1021,8 +1250,10 @@ +@@ -1021,8 +1247,10 @@ this.g.clear(); this.methodProfiler.c("regular"); @@ -395,7 +392,7 @@ if (entity.vehicle != null) { if (!entity.vehicle.dead && entity.vehicle.passenger == entity) { continue; -@@ -1053,7 +1284,7 @@ +@@ -1053,7 +1281,7 @@ this.getChunkAt(j, k).b(entity); } @@ -404,7 +401,7 @@ this.b(entity); } -@@ -1062,6 +1293,13 @@ +@@ -1062,6 +1290,13 @@ this.methodProfiler.c("blockEntities"); this.M = true; @@ -418,7 +415,7 @@ Iterator iterator = this.tileEntityList.iterator(); while (iterator.hasNext()) { -@@ -1093,11 +1331,13 @@ +@@ -1093,11 +1328,13 @@ } this.M = false; @@ -432,7 +429,7 @@ this.methodProfiler.c("pendingBlockEntities"); if (!this.b.isEmpty()) { -@@ -1105,9 +1345,11 @@ +@@ -1105,9 +1342,11 @@ TileEntity tileentity1 = (TileEntity) this.b.get(l); if (!tileentity1.x()) { @@ -444,7 +441,7 @@ if (this.isLoaded(tileentity1.getPosition())) { this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1); -@@ -1161,7 +1403,10 @@ +@@ -1161,7 +1400,10 @@ int j = MathHelper.floor(entity.locZ); byte b0 = 32; @@ -456,7 +453,7 @@ entity.P = entity.locX; entity.Q = entity.locY; entity.R = entity.locZ; -@@ -1679,12 +1924,20 @@ +@@ -1679,12 +1921,20 @@ } this.p = MathHelper.a(this.p, 0.0F, 1.0F); @@ -478,7 +475,7 @@ this.methodProfiler.a("buildList"); int i; -@@ -1701,7 +1954,7 @@ +@@ -1701,7 +1951,7 @@ for (int i1 = -l; i1 <= l; ++i1) { for (int j1 = -l; j1 <= l; ++j1) { @@ -487,7 +484,7 @@ } } } -@@ -1879,7 +2132,10 @@ +@@ -1879,7 +2129,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -499,7 +496,7 @@ return false; } else { int i = 0; -@@ -2024,6 +2280,13 @@ +@@ -2024,6 +2277,13 @@ int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D); int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D); @@ -513,7 +510,7 @@ for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.isChunkLoaded(i1, j1, true)) { -@@ -2042,7 +2305,7 @@ +@@ -2042,7 +2302,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -522,7 +519,7 @@ arraylist.add(entity); } } -@@ -2057,7 +2320,7 @@ +@@ -2057,7 +2317,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -531,7 +528,7 @@ arraylist.add(entity); } } -@@ -2105,7 +2368,7 @@ +@@ -2105,7 +2365,7 @@ } } @@ -540,7 +537,7 @@ } public Entity a(int i) { -@@ -2125,8 +2388,17 @@ +@@ -2125,8 +2385,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -560,7 +557,7 @@ ++i; } } -@@ -2135,12 +2407,18 @@ +@@ -2135,12 +2404,18 @@ } public void b(Collection collection) { @@ -580,7 +577,7 @@ this.a(entity); } -@@ -2154,7 +2432,13 @@ +@@ -2154,7 +2429,13 @@ Block block1 = this.getType(blockposition).getBlock(); AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData()); @@ -595,7 +592,7 @@ } public int F() { -@@ -2253,6 +2537,11 @@ +@@ -2253,6 +2534,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -607,7 +604,7 @@ if (IEntitySelector.d.apply(entityhuman1)) { double d5 = entityhuman1.e(d0, d1, d2); -@@ -2369,6 +2658,16 @@ +@@ -2369,6 +2655,16 @@ public void everyoneSleeping() {} @@ -624,7 +621,7 @@ public float h(float f) { return (this.q + (this.r - this.q) * f) * this.j(f); } -@@ -2592,6 +2891,6 @@ +@@ -2592,6 +2888,6 @@ int l = j * 16 + 8 - blockposition.getZ(); short short0 = 128; diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 22f986b9..6efc04a3 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -1,5 +1,5 @@ ---- /home/matt/mc-dev-private//net/minecraft/server/WorldServer.java 2015-03-07 12:10:53.194679070 +0000 -+++ src/main/java/net/minecraft/server/WorldServer.java 2015-03-07 12:10:53.198679070 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/WorldServer.java 2015-03-11 10:15:29.143595382 +0000 ++++ src/main/java/net/minecraft/server/WorldServer.java 2015-03-11 10:15:29.147595381 +0000 @@ -16,11 +16,23 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,7 +51,16 @@ this.B(); this.C(); this.getWorldBorder().a(minecraftserver.aH()); -@@ -87,6 +107,89 @@ +@@ -84,9 +104,98 @@ + this.getWorldBorder().setSize(this.worldData.E()); + } + ++ // CraftBukkit start ++ if (generator != null) { ++ getWorld().getPopulators().addAll(generator.getDefaultPopulators(getWorld())); ++ } ++ // CraftBukkit end ++ return this; } @@ -141,7 +150,7 @@ public void doTick() { super.doTick(); if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) { -@@ -104,9 +207,11 @@ +@@ -104,9 +213,11 @@ this.e(); } @@ -156,7 +165,7 @@ } this.methodProfiler.c("chunkSource"); -@@ -135,6 +240,8 @@ +@@ -135,6 +246,8 @@ this.Q.a(this.getTime()); this.methodProfiler.b(); this.ak(); @@ -165,7 +174,7 @@ } public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { -@@ -161,7 +268,7 @@ +@@ -161,7 +274,7 @@ if (entityhuman.v()) { ++i; @@ -174,7 +183,7 @@ ++j; } } -@@ -187,25 +294,46 @@ +@@ -187,25 +300,46 @@ } private void ag() { @@ -225,7 +234,7 @@ return false; } else { -@@ -228,13 +356,20 @@ +@@ -228,13 +362,20 @@ int i = 0; int j = 0; @@ -251,7 +260,7 @@ this.a(k, l, chunk); this.methodProfiler.c("tickChunk"); -@@ -260,11 +395,29 @@ +@@ -260,11 +401,29 @@ BlockPosition blockposition1 = blockposition.down(); if (this.w(blockposition1)) { @@ -283,7 +292,7 @@ } if (this.S() && this.getBiome(blockposition1).e()) { -@@ -383,7 +536,7 @@ +@@ -383,7 +542,7 @@ } public void tickEntities() { @@ -292,7 +301,7 @@ if (this.emptyTime++ >= 1200) { return; } -@@ -408,7 +561,13 @@ +@@ -408,7 +567,13 @@ throw new IllegalStateException("TickNextTick list out of synch"); } else { if (i > 1000) { @@ -307,7 +316,7 @@ } this.methodProfiler.a("cleaning"); -@@ -508,6 +667,7 @@ +@@ -508,6 +673,7 @@ return arraylist; } @@ -315,7 +324,7 @@ public void entityJoinedWorld(Entity entity, boolean flag) { if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { entity.die(); -@@ -519,6 +679,7 @@ +@@ -519,6 +685,7 @@ super.entityJoinedWorld(entity, flag); } @@ -323,7 +332,7 @@ private boolean getSpawnNPCs() { return this.server.getSpawnNPCs(); -@@ -531,13 +692,43 @@ +@@ -531,13 +698,43 @@ protected IChunkProvider k() { IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); @@ -368,7 +377,7 @@ for (int k1 = 0; k1 < this.h.size(); ++k1) { TileEntity tileentity = (TileEntity) this.h.get(k1); BlockPosition blockposition = tileentity.getPosition(); -@@ -546,6 +737,8 @@ +@@ -546,6 +743,8 @@ arraylist.add(tileentity); } } @@ -377,7 +386,7 @@ return arraylist; } -@@ -609,6 +802,23 @@ +@@ -609,6 +808,23 @@ int j = this.worldProvider.getSeaLevel(); int k = 0; @@ -401,7 +410,7 @@ if (blockposition != null) { i = blockposition.getX(); k = blockposition.getZ(); -@@ -618,7 +828,7 @@ +@@ -618,7 +834,7 @@ int l = 0; @@ -410,7 +419,7 @@ i += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64); ++l; -@@ -657,6 +867,7 @@ +@@ -657,6 +873,7 @@ public void save(boolean flag, IProgressUpdate iprogressupdate) throws ExceptionWorldConflict { if (this.chunkProvider.canSave()) { @@ -418,7 +427,7 @@ if (iprogressupdate != null) { iprogressupdate.a("Saving level"); } -@@ -667,7 +878,8 @@ +@@ -667,7 +884,8 @@ } this.chunkProvider.saveChunks(flag, iprogressupdate); @@ -428,7 +437,7 @@ Iterator iterator = arraylist.iterator(); while (iterator.hasNext()) { -@@ -698,8 +910,12 @@ +@@ -698,8 +916,12 @@ this.worldData.k(this.getWorldBorder().getWarningTime()); this.worldData.b(this.getWorldBorder().j()); this.worldData.e(this.getWorldBorder().i()); @@ -442,7 +451,7 @@ } protected void a(Entity entity) { -@@ -731,8 +947,16 @@ +@@ -731,8 +953,16 @@ } public boolean strikeLightning(Entity entity) { @@ -460,7 +469,7 @@ return true; } else { return false; -@@ -744,10 +968,20 @@ +@@ -744,10 +974,20 @@ } public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { @@ -481,7 +490,7 @@ if (!flag1) { explosion.clearBlocks(); } -@@ -793,7 +1027,8 @@ +@@ -793,7 +1033,8 @@ BlockActionData blockactiondata = (BlockActionData) iterator.next(); if (this.a(blockactiondata)) { @@ -491,7 +500,7 @@ } } -@@ -816,6 +1051,7 @@ +@@ -816,6 +1057,7 @@ boolean flag = this.S(); super.p(); @@ -499,7 +508,7 @@ if (this.o != this.p) { this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.p), this.worldProvider.getDimension()); } -@@ -834,6 +1070,21 @@ +@@ -834,6 +1076,21 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r)); } @@ -521,7 +530,7 @@ } -@@ -862,10 +1113,17 @@ +@@ -862,10 +1119,17 @@ } public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) { -- cgit v1.2.3