summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-03-08 10:08:19 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-03-08 10:08:19 +0000
commit091a7212b0f5477d0d72e331aeb7e8f8b8aa34de (patch)
tree98de99100b53668844dcc6ac2731f2b9a8d92c8a
parente8021880803a4fead8d342f0515956954d1a1bb6 (diff)
downloadcraftbukkit-091a7212b0f5477d0d72e331aeb7e8f8b8aa34de.tar
craftbukkit-091a7212b0f5477d0d72e331aeb7e8f8b8aa34de.tar.gz
craftbukkit-091a7212b0f5477d0d72e331aeb7e8f8b8aa34de.tar.lz
craftbukkit-091a7212b0f5477d0d72e331aeb7e8f8b8aa34de.tar.xz
craftbukkit-091a7212b0f5477d0d72e331aeb7e8f8b8aa34de.zip
SPIGOT-626: Add populators early to prevent chunks being missed
-rw-r--r--nms-patches/MinecraftServer.patch64
-rw-r--r--nms-patches/World.patch75
2 files changed, 69 insertions, 70 deletions
diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch
index 3da94870..1c0f94ad 100644
--- a/nms-patches/MinecraftServer.patch
+++ b/nms-patches/MinecraftServer.patch
@@ -1,5 +1,5 @@
---- /home/matt/mc-dev-private//net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.875608136 +0000
-+++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.879608136 +0000
+--- /home/matt/mc-dev-private//net/minecraft/server/MinecraftServer.java 2015-03-08 10:08:09.275589093 +0000
++++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-03-08 10:08:09.279589093 +0000
@@ -38,14 +38,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -104,7 +104,7 @@
this.i = new long[this.worldServer.length][100];
IDataManager idatamanager = this.convertable.a(s, true);
-@@ -167,37 +223,112 @@
+@@ -167,37 +223,108 @@
worlddata.a(s1);
worldsettings = new WorldSettings(worlddata);
}
@@ -204,10 +204,6 @@
+ }
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
+ world = (WorldServer) new SecondaryWorldServer(this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen).b();
-+ }
-+
-+ if (gen != null) {
-+ world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
}
- this.worldServer[j].addIWorldAccess(new WorldManager(this, this.worldServer[j]));
@@ -228,7 +224,7 @@
this.a(this.getDifficulty());
this.k();
}
-@@ -212,25 +343,38 @@
+@@ -212,25 +339,38 @@
this.b("menu.generatingTerrain");
byte b0 = 0;
@@ -282,7 +278,7 @@
this.r();
}
-@@ -264,35 +408,52 @@
+@@ -264,35 +404,52 @@
protected void r() {
this.f = null;
this.g = 0;
@@ -344,7 +340,7 @@
if (this.ap() != null) {
this.ap().b();
}
-@@ -307,11 +468,13 @@
+@@ -307,11 +464,13 @@
MinecraftServer.LOGGER.info("Saving worlds");
this.saveChunks(false);
@@ -358,7 +354,7 @@
}
if (this.n.d()) {
-@@ -352,6 +515,7 @@
+@@ -352,6 +511,7 @@
long k = j - this.ab;
if (k > 2000L && this.ab - this.R >= 15000L) {
@@ -366,7 +362,7 @@
MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)});
k = 2000L;
this.R = this.ab;
-@@ -364,11 +528,12 @@
+@@ -364,11 +524,12 @@
i += k;
this.ab = j;
@@ -380,7 +376,7 @@
i -= 50L;
this.z();
}
-@@ -406,6 +571,12 @@
+@@ -406,6 +567,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@@ -393,7 +389,7 @@
this.y();
}
-@@ -445,7 +616,7 @@
+@@ -445,7 +612,7 @@
protected void y() {}
@@ -402,7 +398,7 @@
long i = System.nanoTime();
++this.ticks;
-@@ -471,7 +642,7 @@
+@@ -471,7 +638,7 @@
this.r.b().a(agameprofile);
}
@@ -411,7 +407,7 @@
this.methodProfiler.a("save");
this.v.savePlayers();
this.saveChunks(true);
-@@ -506,20 +677,40 @@
+@@ -506,20 +673,40 @@
this.methodProfiler.c("levels");
@@ -455,7 +451,7 @@
this.methodProfiler.a("tick");
-@@ -546,9 +737,9 @@
+@@ -546,9 +733,9 @@
worldserver.getTracker().updatePlayers();
this.methodProfiler.b();
this.methodProfiler.b();
@@ -467,7 +463,7 @@
}
this.methodProfiler.c("connection");
-@@ -572,10 +763,11 @@
+@@ -572,10 +759,11 @@
this.p.add(iupdateplayerlistbox);
}
@@ -480,7 +476,7 @@
boolean flag = true;
String s = null;
String s1 = ".";
-@@ -653,6 +845,27 @@
+@@ -653,6 +841,27 @@
dedicatedserver.stop();
}
});
@@ -508,7 +504,7 @@
} catch (Exception exception) {
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
}
-@@ -660,8 +873,10 @@
+@@ -660,8 +869,10 @@
}
public void C() {
@@ -519,7 +515,7 @@
}
public File d(String s) {
-@@ -677,7 +892,14 @@
+@@ -677,7 +888,14 @@
}
public WorldServer getWorldServer(int i) {
@@ -535,7 +531,7 @@
}
public String D() {
-@@ -713,7 +935,7 @@
+@@ -713,7 +931,7 @@
}
public boolean isDebugging() {
@@ -544,7 +540,7 @@
}
public void g(String s) {
-@@ -728,7 +950,7 @@
+@@ -728,7 +946,7 @@
}
public String getServerModName() {
@@ -553,7 +549,7 @@
}
public CrashReport b(CrashReport crashreport) {
-@@ -757,6 +979,7 @@
+@@ -757,6 +975,7 @@
}
public List<String> tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) {
@@ -561,7 +557,7 @@
ArrayList arraylist = Lists.newArrayList();
if (s.startsWith("/")) {
-@@ -795,6 +1018,9 @@
+@@ -795,6 +1014,9 @@
return arraylist;
}
@@ -571,7 +567,7 @@
}
public static MinecraftServer getServer() {
-@@ -802,7 +1028,7 @@
+@@ -802,7 +1024,7 @@
}
public boolean N() {
@@ -580,7 +576,7 @@
}
public String getName() {
-@@ -858,8 +1084,10 @@
+@@ -858,8 +1080,10 @@
}
public void a(EnumDifficulty enumdifficulty) {
@@ -593,7 +589,7 @@
if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) {
-@@ -901,15 +1129,17 @@
+@@ -901,15 +1125,17 @@
this.N = true;
this.getConvertable().d();
@@ -615,7 +611,7 @@
this.safeShutdown();
}
-@@ -942,9 +1172,11 @@
+@@ -942,9 +1168,11 @@
int i = 0;
if (this.worldServer != null) {
@@ -630,7 +626,7 @@
WorldData worlddata = worldserver.getWorldData();
mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension()));
-@@ -977,7 +1209,7 @@
+@@ -977,7 +1205,7 @@
public abstract boolean ad();
public boolean getOnlineMode() {
@@ -639,7 +635,7 @@
}
public void setOnlineMode(boolean flag) {
-@@ -1049,8 +1281,9 @@
+@@ -1049,8 +1277,9 @@
}
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@@ -651,7 +647,7 @@
}
}
-@@ -1082,7 +1315,7 @@
+@@ -1082,7 +1311,7 @@
}
public World getWorld() {
@@ -660,7 +656,7 @@
}
public Entity f() {
-@@ -1153,8 +1386,10 @@
+@@ -1153,8 +1382,10 @@
WorldServer[] aworldserver = this.worldServer;
int i = aworldserver.length;
@@ -673,7 +669,7 @@
if (worldserver != null) {
Entity entity = worldserver.getEntity(uuid);
-@@ -1169,7 +1404,7 @@
+@@ -1169,7 +1400,7 @@
}
public boolean getSendCommandFeedback() {
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index aab5c2dc..be4db23b 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 00:44:40.231645140 +0000
-+++ src/main/java/net/minecraft/server/World.java 2015-03-08 00:44:40.239645140 +0000
+--- /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
@@ -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,72 @@
+@@ -36,27 +52,75 @@
protected float r;
private int J;
public final Random random = new Random();
@@ -98,13 +98,16 @@
+ 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 +128,35 @@
+@@ -67,6 +131,35 @@
this.worldProvider = worldprovider;
this.isClientSide = flag;
this.N = worldprovider.getWorldBorder();
@@ -140,7 +143,7 @@
}
public World b() {
-@@ -193,6 +283,27 @@
+@@ -193,6 +286,27 @@
}
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -168,7 +171,7 @@
if (!this.isValidLocation(blockposition)) {
return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
-@@ -200,9 +311,23 @@
+@@ -200,9 +314,23 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
@@ -192,7 +195,7 @@
return false;
} else {
Block block1 = iblockdata1.getBlock();
-@@ -213,6 +338,7 @@
+@@ -213,6 +341,7 @@
this.methodProfiler.b();
}
@@ -200,7 +203,7 @@
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) {
this.notify(blockposition);
}
-@@ -223,12 +349,35 @@
+@@ -223,12 +352,35 @@
this.updateAdjacentComparators(blockposition, block);
}
}
@@ -236,7 +239,7 @@
public boolean setAir(BlockPosition blockposition) {
return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
}
-@@ -262,6 +411,11 @@
+@@ -262,6 +414,11 @@
public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -248,7 +251,7 @@
this.applyPhysics(blockposition, block);
}
-@@ -337,6 +491,17 @@
+@@ -337,6 +494,17 @@
IBlockData iblockdata = this.getType(blockposition);
try {
@@ -266,7 +269,7 @@
iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
-@@ -518,6 +683,17 @@
+@@ -518,6 +686,17 @@
}
public IBlockData getType(BlockPosition blockposition) {
@@ -284,7 +287,7 @@
if (!this.isValidLocation(blockposition)) {
return Blocks.AIR.getBlockData();
} else {
-@@ -723,6 +899,13 @@
+@@ -723,6 +902,13 @@
}
public boolean addEntity(Entity entity) {
@@ -298,7 +301,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -731,7 +914,35 @@
+@@ -731,7 +917,35 @@
flag = true;
}
@@ -334,7 +337,7 @@
return false;
} else {
if (entity instanceof EntityHuman) {
-@@ -753,6 +964,7 @@
+@@ -753,6 +967,7 @@
((IWorldAccess) this.u.get(i)).a(entity);
}
@@ -342,7 +345,7 @@
}
protected void b(Entity entity) {
-@@ -760,6 +972,7 @@
+@@ -760,6 +975,7 @@
((IWorldAccess) this.u.get(i)).b(entity);
}
@@ -350,7 +353,7 @@
}
public void kill(Entity entity) {
-@@ -794,7 +1007,15 @@
+@@ -794,7 +1010,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -367,7 +370,7 @@
this.b(entity);
}
-@@ -978,6 +1199,11 @@
+@@ -978,6 +1202,11 @@
for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i);
@@ -379,7 +382,7 @@
try {
++entity.ticksLived;
-@@ -1021,8 +1247,10 @@
+@@ -1021,8 +1250,10 @@
this.g.clear();
this.methodProfiler.c("regular");
@@ -392,7 +395,7 @@
if (entity.vehicle != null) {
if (!entity.vehicle.dead && entity.vehicle.passenger == entity) {
continue;
-@@ -1053,7 +1281,7 @@
+@@ -1053,7 +1284,7 @@
this.getChunkAt(j, k).b(entity);
}
@@ -401,7 +404,7 @@
this.b(entity);
}
-@@ -1062,6 +1290,13 @@
+@@ -1062,6 +1293,13 @@
this.methodProfiler.c("blockEntities");
this.M = true;
@@ -415,7 +418,7 @@
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
-@@ -1093,11 +1328,13 @@
+@@ -1093,11 +1331,13 @@
}
this.M = false;
@@ -429,7 +432,7 @@
this.methodProfiler.c("pendingBlockEntities");
if (!this.b.isEmpty()) {
-@@ -1105,9 +1342,11 @@
+@@ -1105,9 +1345,11 @@
TileEntity tileentity1 = (TileEntity) this.b.get(l);
if (!tileentity1.x()) {
@@ -441,7 +444,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1);
-@@ -1161,7 +1400,10 @@
+@@ -1161,7 +1403,10 @@
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
@@ -453,7 +456,7 @@
entity.P = entity.locX;
entity.Q = entity.locY;
entity.R = entity.locZ;
-@@ -1679,12 +1921,20 @@
+@@ -1679,12 +1924,20 @@
}
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
@@ -475,7 +478,7 @@
this.methodProfiler.a("buildList");
int i;
-@@ -1701,7 +1951,7 @@
+@@ -1701,7 +1954,7 @@
for (int i1 = -l; i1 <= l; ++i1) {
for (int j1 = -l; j1 <= l; ++j1) {
@@ -484,7 +487,7 @@
}
}
}
-@@ -1879,7 +2129,10 @@
+@@ -1879,7 +2132,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -496,7 +499,7 @@
return false;
} else {
int i = 0;
-@@ -2024,6 +2277,13 @@
+@@ -2024,6 +2280,13 @@
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D);
@@ -510,7 +513,7 @@
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1, true)) {
-@@ -2042,7 +2302,7 @@
+@@ -2042,7 +2305,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -519,7 +522,7 @@
arraylist.add(entity);
}
}
-@@ -2057,7 +2317,7 @@
+@@ -2057,7 +2320,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -528,7 +531,7 @@
arraylist.add(entity);
}
}
-@@ -2105,7 +2365,7 @@
+@@ -2105,7 +2368,7 @@
}
}
@@ -537,7 +540,7 @@
}
public Entity a(int i) {
-@@ -2125,8 +2385,17 @@
+@@ -2125,8 +2388,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -557,7 +560,7 @@
++i;
}
}
-@@ -2135,12 +2404,18 @@
+@@ -2135,12 +2407,18 @@
}
public void b(Collection<Entity> collection) {
@@ -577,7 +580,7 @@
this.a(entity);
}
-@@ -2154,7 +2429,13 @@
+@@ -2154,7 +2432,13 @@
Block block1 = this.getType(blockposition).getBlock();
AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData());
@@ -592,7 +595,7 @@
}
public int F() {
-@@ -2253,6 +2534,11 @@
+@@ -2253,6 +2537,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -604,7 +607,7 @@
if (IEntitySelector.d.apply(entityhuman1)) {
double d5 = entityhuman1.e(d0, d1, d2);
-@@ -2369,6 +2655,16 @@
+@@ -2369,6 +2658,16 @@
public void everyoneSleeping() {}
@@ -621,7 +624,7 @@
public float h(float f) {
return (this.q + (this.r - this.q) * f) * this.j(f);
}
-@@ -2592,6 +2888,6 @@
+@@ -2592,6 +2891,6 @@
int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128;