forked from xjboss/KCauldronX
Some improvements in spigot timings and fix #179
This commit is contained in:
@ -1166,7 +1166,17 @@
|
||||
}
|
||||
|
||||
public boolean func_147469_q(int p_147469_1_, int p_147469_2_, int p_147469_3_)
|
||||
@@ -2718,7 +3258,15 @@
|
||||
@@ -2666,7 +3206,9 @@
|
||||
|
||||
public void tick()
|
||||
{
|
||||
+ timings.weatherUpdate.startTiming(); // KCauldron
|
||||
this.updateWeather();
|
||||
+ timings.weatherUpdate.stopTiming(); // KCauldron
|
||||
}
|
||||
|
||||
private void calculateInitialWeather()
|
||||
@@ -2718,7 +3260,15 @@
|
||||
|
||||
if (i <= 0)
|
||||
{
|
||||
@ -1183,7 +1193,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2754,7 +3302,15 @@
|
||||
@@ -2754,7 +3304,15 @@
|
||||
|
||||
if (j <= 0)
|
||||
{
|
||||
@ -1200,7 +1210,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2777,8 +3333,41 @@
|
||||
@@ -2777,8 +3335,41 @@
|
||||
protected void setActivePlayerChunksAndCheckLight()
|
||||
{
|
||||
this.activeChunkSet.clear();
|
||||
@ -1243,7 +1253,7 @@
|
||||
int i;
|
||||
EntityPlayer entityplayer;
|
||||
int j;
|
||||
@@ -2788,17 +3377,28 @@
|
||||
@@ -2788,17 +3379,28 @@
|
||||
for (i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1278,7 +1288,7 @@
|
||||
}
|
||||
|
||||
this.theProfiler.endSection();
|
||||
@@ -2810,7 +3410,7 @@
|
||||
@@ -2810,7 +3412,7 @@
|
||||
|
||||
this.theProfiler.startSection("playerCheckLight");
|
||||
|
||||
@ -1287,7 +1297,7 @@
|
||||
{
|
||||
i = this.rand.nextInt(this.playerEntities.size());
|
||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||
@@ -3280,12 +3880,23 @@
|
||||
@@ -3280,12 +3882,23 @@
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -1314,7 +1324,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -3298,9 +3909,10 @@
|
||||
@@ -3298,9 +3911,10 @@
|
||||
for (int i = 0; i < p_72868_1_.size(); ++i)
|
||||
{
|
||||
Entity entity = (Entity)p_72868_1_.get(i);
|
||||
@ -1326,7 +1336,7 @@
|
||||
this.onEntityAdded(entity);
|
||||
}
|
||||
}
|
||||
@@ -3308,14 +3920,25 @@
|
||||
@@ -3308,14 +3922,25 @@
|
||||
|
||||
public void unloadEntities(List p_72828_1_)
|
||||
{
|
||||
@ -1354,7 +1364,7 @@
|
||||
}
|
||||
|
||||
public PathEntity getPathEntityToEntity(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_)
|
||||
@@ -3464,6 +4087,12 @@
|
||||
@@ -3464,6 +4089,12 @@
|
||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1367,7 +1377,7 @@
|
||||
double d5 = entityplayer1.getDistanceSq(p_72977_1_, p_72977_3_, p_72977_5_);
|
||||
|
||||
if ((p_72977_7_ < 0.0D || d5 < p_72977_7_ * p_72977_7_) && (d4 == -1.0D || d5 < d4))
|
||||
@@ -3489,7 +4118,12 @@
|
||||
@@ -3489,7 +4120,12 @@
|
||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1381,7 +1391,7 @@
|
||||
if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive())
|
||||
{
|
||||
double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_);
|
||||
@@ -3612,11 +4246,11 @@
|
||||
@@ -3612,11 +4248,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -1395,7 +1405,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3660,6 +4294,18 @@
|
||||
@@ -3660,6 +4296,18 @@
|
||||
|
||||
public void updateAllPlayersSleepingFlag() {}
|
||||
|
||||
@ -1414,7 +1424,7 @@
|
||||
public float getWeightedThunderStrength(float p_72819_1_)
|
||||
{
|
||||
return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_);
|
||||
@@ -3932,8 +4578,8 @@
|
||||
@@ -3932,8 +4580,8 @@
|
||||
*/
|
||||
public void addTileEntity(TileEntity entity)
|
||||
{
|
||||
@ -1425,7 +1435,7 @@
|
||||
{
|
||||
dest.add(entity);
|
||||
}
|
||||
@@ -4020,13 +4666,82 @@
|
||||
@@ -4020,13 +4668,82 @@
|
||||
public int countEntities(EnumCreatureType type, boolean forSpawnCount)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user