summaryrefslogtreecommitdiffstats
path: root/nms-patches/WorldServer.patch
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2017-01-18 17:42:35 -0800
committerPokechu22 <Pokechu022@gmail.com>2017-01-18 17:42:35 -0800
commit4d3bf2015504897fc69af2a209d4c8bbe217394d (patch)
tree06e9d3e385c7810bd877d389e825be810e61f4b0 /nms-patches/WorldServer.patch
parent7fdc749bf17b8a80b931f58ad4ac101d4b20676e (diff)
downloadcraftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar
craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.gz
craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.lz
craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.xz
craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.zip
Re-enable the vanilla debug MethodProfiler and /debug command
This is highly useful for profiling vanilla code, and in some cases plugin code. It is somewhat expensive, though, which is why it was initially disabled. I chose to use a system property instead of a configuration setting because 1) the MethodProfiler is exclusive to CraftBukkit and not part of the general API (the timings system is the general API equivalent), and 2) using a static final boolean property _may_ allow the JITter to optimize out the methods when disabled (though I'm not sure of it). There are several changes to fix cases where the profiler code was broken slightly by other craftbukkit changes. All of cases have been fixed, except for the block entity ticking one, due to the cost of the getSimpleName call. For that, a ticking entry is used instead, so that time spent actually ticking the block entities can be compared with time processing the list. This (effectively) reverts 7dde6cc5663e1f6b84f549c54a47bc623b49fdf1.
Diffstat (limited to 'nms-patches/WorldServer.patch')
-rw-r--r--nms-patches/WorldServer.patch61
1 files changed, 30 insertions, 31 deletions
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 386a0a48..caf5664b 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -174,11 +174,10 @@
public void doTick() {
super.doTick();
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
-@@ -106,9 +221,11 @@
- this.f();
+@@ -107,8 +222,11 @@
}
-- this.methodProfiler.a("mobSpawner");
+ this.methodProfiler.a("mobSpawner");
- if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
- this.spawnerCreature.a(this, this.allowMonsters, this.allowAnimals, this.worldData.getTime() % 400L == 0L);
+ // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
@@ -189,7 +188,7 @@
}
this.methodProfiler.c("chunkSource");
-@@ -137,6 +254,8 @@
+@@ -137,6 +255,8 @@
this.portalTravelAgent.a(this.getTime());
this.methodProfiler.b();
this.ao();
@@ -198,7 +197,7 @@
}
@Nullable
-@@ -164,7 +283,7 @@
+@@ -164,7 +284,7 @@
if (entityhuman.isSpectator()) {
++i;
@@ -207,7 +206,7 @@
++j;
}
}
-@@ -193,25 +312,46 @@
+@@ -193,25 +313,46 @@
}
private void c() {
@@ -258,7 +257,7 @@
return false;
} else {
-@@ -281,7 +421,7 @@
+@@ -281,7 +422,7 @@
entityhorseskeleton.p(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -267,7 +266,7 @@
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
} else {
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
-@@ -297,11 +437,11 @@
+@@ -297,11 +438,11 @@
BlockPosition blockposition1 = blockposition.down();
if (this.v(blockposition1)) {
@@ -281,7 +280,7 @@
}
if (flag && this.getBiome(blockposition1).d()) {
-@@ -376,7 +516,7 @@
+@@ -376,7 +517,7 @@
public boolean b(BlockPosition blockposition, Block block) {
NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block);
@@ -290,7 +289,7 @@
}
public void a(BlockPosition blockposition, Block block, int i) {
-@@ -415,8 +555,8 @@
+@@ -415,8 +556,8 @@
nextticklistentry.a(j);
}
@@ -301,7 +300,7 @@
this.nextTickList.add(nextticklistentry);
}
}
-@@ -438,15 +578,15 @@
+@@ -438,15 +579,15 @@
nextticklistentry.a((long) i + this.worldData.getTime());
}
@@ -320,7 +319,7 @@
if (this.emptyTime++ >= 300) {
return;
}
-@@ -516,11 +656,17 @@
+@@ -516,11 +657,17 @@
} else {
int i = this.nextTickList.size();
@@ -340,7 +339,7 @@
}
this.methodProfiler.a("cleaning");
-@@ -533,8 +679,9 @@
+@@ -533,8 +680,9 @@
break;
}
@@ -351,7 +350,7 @@
this.U.add(nextticklistentry);
}
-@@ -604,7 +751,7 @@
+@@ -604,7 +752,7 @@
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
if (flag) {
if (i == 0) {
@@ -360,7 +359,7 @@
}
iterator.remove();
-@@ -622,6 +769,7 @@
+@@ -622,6 +770,7 @@
return arraylist;
}
@@ -368,7 +367,7 @@
public void entityJoinedWorld(Entity entity, boolean flag) {
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
-@@ -633,6 +781,7 @@
+@@ -633,6 +782,7 @@
super.entityJoinedWorld(entity, flag);
}
@@ -376,7 +375,7 @@
private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs();
-@@ -645,7 +794,54 @@
+@@ -645,7 +795,54 @@
protected IChunkProvider n() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
@@ -432,7 +431,7 @@
}
public boolean a(EntityHuman entityhuman, BlockPosition blockposition) {
-@@ -707,6 +903,23 @@
+@@ -707,6 +904,23 @@
int j = this.worldProvider.getSeaLevel();
int k = 8;
@@ -456,7 +455,7 @@
if (blockposition != null) {
i = blockposition.getX();
k = blockposition.getZ();
-@@ -716,7 +929,7 @@
+@@ -716,7 +930,7 @@
int l = 0;
@@ -465,7 +464,7 @@
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
-@@ -758,6 +971,7 @@
+@@ -758,6 +972,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
if (chunkproviderserver.e()) {
@@ -473,7 +472,7 @@
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
-@@ -768,7 +982,8 @@
+@@ -768,7 +983,8 @@
}
chunkproviderserver.a(flag);
@@ -483,7 +482,7 @@
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
-@@ -803,6 +1018,12 @@
+@@ -803,6 +1019,12 @@
}
}
@@ -496,7 +495,7 @@
this.worldData.a(this.getWorldBorder().getSize());
this.worldData.d(this.getWorldBorder().getCenterX());
this.worldData.c(this.getWorldBorder().getCenterZ());
-@@ -816,9 +1037,13 @@
+@@ -816,9 +1038,13 @@
this.worldMaps.a();
}
@@ -512,7 +511,7 @@
public void a(Collection<Entity> collection) {
ArrayList arraylist = Lists.newArrayList(collection);
-@@ -837,7 +1062,7 @@
+@@ -837,7 +1063,7 @@
private boolean j(Entity entity) {
if (entity.dead) {
@@ -521,7 +520,7 @@
return false;
} else {
UUID uuid = entity.getUniqueID();
-@@ -849,7 +1074,7 @@
+@@ -849,7 +1075,7 @@
this.f.remove(entity1);
} else {
if (!(entity instanceof EntityHuman)) {
@@ -530,7 +529,7 @@
return false;
}
-@@ -902,8 +1127,16 @@
+@@ -902,8 +1128,16 @@
}
public boolean strikeLightning(Entity entity) {
@@ -548,7 +547,7 @@
return true;
} else {
return false;
-@@ -919,10 +1152,20 @@
+@@ -919,10 +1153,20 @@
}
public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@@ -569,7 +568,7 @@
if (!flag1) {
explosion.clearBlocks();
}
-@@ -968,7 +1211,8 @@
+@@ -968,7 +1212,8 @@
BlockActionData blockactiondata = (BlockActionData) iterator.next();
if (this.a(blockactiondata)) {
@@ -579,7 +578,7 @@
}
}
-@@ -991,6 +1235,7 @@
+@@ -991,6 +1236,7 @@
boolean flag = this.W();
super.t();
@@ -587,7 +586,7 @@
if (this.n != this.o) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
}
-@@ -1009,6 +1254,21 @@
+@@ -1009,6 +1255,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
}
@@ -609,7 +608,7 @@
}
-@@ -1038,10 +1298,20 @@
+@@ -1038,10 +1299,20 @@
}
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) {