1
0
forked from xjboss/KCauldronX

Some improvements in spigot timings and fix #179

This commit is contained in:
Prototik
2015-09-05 23:31:58 +07:00
parent 923b9e81a0
commit 9d56192606
8 changed files with 233 additions and 110 deletions

View File

@ -150,7 +150,17 @@
public void tick()
{
super.tick();
@@ -155,12 +245,19 @@
@@ -141,7 +231,9 @@
this.difficultySetting = EnumDifficulty.HARD;
}
+ timings.cleanupCache.startTiming(); // KCauldron
this.provider.worldChunkMgr.cleanupCache();
+ timings.cleanupCache.stopTiming(); // KCauldron
if (this.areAllPlayersAsleep())
{
@@ -155,12 +247,19 @@
}
this.theProfiler.startSection("mobSpawner");
@ -173,7 +183,7 @@
this.theProfiler.endStartSection("chunkSource");
this.chunkProvider.unloadQueuedChunks();
int j = this.calculateSkylightSubtracted(1.0F);
@@ -170,30 +267,47 @@
@@ -170,30 +269,47 @@
this.skylightSubtracted = j;
}
@ -189,7 +199,7 @@
this.theProfiler.endStartSection("tickPending");
+ timings.doTickPending.startTiming(); // Spigot
this.tickUpdates(false);
+ timings.doChunkUnload.stopTiming(); // Spigot
+ timings.doTickPending.stopTiming(); // Spigot
this.theProfiler.endStartSection("tickBlocks");
+ timings.doTickTiles.startTiming(); // Spigot
this.func_147456_g();
@ -222,7 +232,7 @@
}
public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_)
@@ -212,7 +326,7 @@
@@ -212,7 +328,7 @@
{
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
@ -231,7 +241,7 @@
{
this.allPlayersSleeping = false;
break;
@@ -240,7 +354,25 @@
@@ -240,7 +356,25 @@
private void resetRainAndThunder()
{
@ -258,7 +268,7 @@
}
public boolean areAllPlayersAsleep()
@@ -248,19 +380,26 @@
@@ -248,19 +382,26 @@
if (this.allPlayersSleeping && !this.isRemote)
{
Iterator iterator = this.playerEntities.iterator();
@ -288,7 +298,7 @@
return false;
}
else
@@ -302,15 +441,29 @@
@@ -302,15 +443,29 @@
super.func_147456_g();
int i = 0;
int j = 0;
@ -324,7 +334,7 @@
this.func_147467_a(k, l, chunk);
this.theProfiler.endStartSection("tickChunk");
chunk.func_150804_b(false);
@@ -346,12 +499,32 @@
@@ -346,12 +501,32 @@
if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l))
{
@ -359,7 +369,7 @@
}
if (this.isRaining())
@@ -388,6 +561,7 @@
@@ -388,6 +563,7 @@
if (block.getTickRandomly())
{
++i;
@ -367,7 +377,7 @@
block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand);
}
}
@@ -396,6 +570,13 @@
@@ -396,6 +572,13 @@
this.theProfiler.endSection();
}
@ -381,7 +391,7 @@
}
public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_)
@@ -474,7 +655,7 @@
@@ -474,7 +657,7 @@
public void updateEntities()
{
@ -390,7 +400,7 @@
{
if (this.updateEntityTick++ >= 1200)
{
@@ -506,7 +687,16 @@
@@ -506,7 +689,16 @@
{
if (i > 1000)
{
@ -408,7 +418,7 @@
}
this.theProfiler.startSection("cleaning");
@@ -651,7 +841,37 @@
@@ -651,7 +843,37 @@
protected IChunkProvider createChunkProvider()
{
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
@ -447,7 +457,7 @@
return this.theChunkProviderServer;
}
@@ -659,29 +879,31 @@
@@ -659,29 +881,31 @@
{
ArrayList arraylist = new ArrayList();
@ -494,7 +504,7 @@
return arraylist;
}
@@ -733,7 +955,28 @@
@@ -733,7 +957,28 @@
int i = 0;
int j = this.provider.getAverageGroundLevel();
int k = 0;
@ -523,7 +533,7 @@
if (chunkposition != null)
{
i = chunkposition.chunkPosX;
@@ -876,6 +1119,20 @@
@@ -876,6 +1121,20 @@
public boolean addWeatherEffect(Entity p_72942_1_)
{
@ -544,7 +554,7 @@
if (super.addWeatherEffect(p_72942_1_))
{
this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_));
@@ -894,13 +1151,23 @@
@@ -894,13 +1153,23 @@
public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
{
@ -569,7 +579,7 @@
if (!p_72885_10_)
{
explosion.affectedBlockPositions.clear();
@@ -977,7 +1244,7 @@
@@ -977,7 +1246,7 @@
{
boolean flag = this.isRaining();
super.updateWeather();
@ -578,7 +588,7 @@
if (this.prevRainingStrength != this.rainingStrength)
{
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
@@ -988,10 +1255,6 @@
@@ -988,10 +1257,6 @@
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
}
@ -589,7 +599,7 @@
if (flag != this.isRaining())
{
if (flag)
@@ -1006,6 +1269,33 @@
@@ -1006,6 +1271,33 @@
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
}
@ -623,7 +633,7 @@
}
protected int func_152379_p()
@@ -1069,4 +1359,51 @@
@@ -1069,4 +1361,51 @@
this();
}
}