int i2 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D);
int l = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D);
int j2 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D);
- List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double)i, (double)k, (double)l, (double)j, (double)i2, (double)j2));
+ // PaperSpigot start - Fix lag from explosions processing dead entities
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double)i, (double)k, (double)l, (double)j, (double)i2, (double)j2), new net.minecraft.command.IEntitySelector() {
+ @Override
+ public boolean isEntityApplicable(Entity entity) {
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this)))
{
loadedEntityList.add(entity);
@@ -3314,8 +3974,17 @@
@@ -3314,8 +3987,17 @@
public boolean canPlaceEntityOnSide(Block p_147472_1_, int p_147472_2_, int p_147472_3_, int p_147472_4_, boolean p_147472_5_, int p_147472_6_, Entity p_147472_7_, ItemStack p_147472_8_)
extendedblockstorage.setExtBlockMetadata(p_150807_1_, p_150807_2_ & 15, p_150807_3_, p_150807_5_); // This line duplicates the one below, so breakBlock fires with valid worldstate
@@ -777,8 +800,20 @@
@@ -777,8 +832,20 @@
if (i != this.xPosition || j != this.zPosition)
{
@ -109,7 +143,7 @@
}
int k = MathHelper.floor_double(p_76612_1_.posY / 16.0D);
@@ -799,6 +834,26 @@
@@ -799,6 +866,26 @@
p_76612_1_.chunkCoordY = k;
p_76612_1_.chunkCoordZ = this.zPosition;
this.entityLists[k].add(p_76612_1_);
@ -136,7 +170,7 @@
}
public void removeEntity(Entity p_76622_1_)
@@ -819,6 +874,26 @@
@@ -819,6 +906,26 @@
}
this.entityLists[p_76608_2_].remove(p_76608_1_);
@ -163,7 +197,7 @@
}
public boolean canBlockSeeTheSky(int p_76619_1_, int p_76619_2_, int p_76619_3_)
- else if (this.hasEntities && this.worldObj.getTotalWorldTime() >= this.lastSaveTime + 600L)
+ else if (this.hasEntities && this.worldObj.getTotalWorldTime() >= this.lastSaveTime + net.minecraft.server.MinecraftServer.getServer().autosavePeriod * 4) // PaperSpigot - Only save if we've passed 4 auto save intervals without modification
{
return true;
}
@@ -1025,7 +1171,7 @@
public Random getRandomWithSeed(long p_76617_1_)
{
@ -236,7 +279,7 @@
}
public boolean isEmpty()
@@ -1035,6 +1149,7 @@
@@ -1035,6 +1181,7 @@
public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_)
@ -45,8 +45,7 @@ public class CauldronConfig extends ConfigBase
publicfinalBoolSettingcheckEntityMaxSpeeds=newBoolSetting(this,"settings.check-entity-max-speeds",false,"Removes any entity that exceeds max speed.");
publicfinalIntSettinglargeBoundingBoxLogSize=newIntSetting(this,"settings.entity-bounding-box-max-size",1000,"Max size of an entity's bounding box before removing it (either being too large or bugged and 'moving' too fast)");
publicfinalIntSettingentityMaxSpeed=newIntSetting(this,"settings.entity-max-speed",100,"Square of the max speed of an entity before removing it");
publicfinalIntSettingchunkGCGracePeriod=newIntSetting(this,"settings.chunk-gc-grace-period",0,"Grace period of no-ticks before unload");
// Debug settings
publicfinalBoolSettingenableThreadContentionMonitoring=newBoolSetting(this,"debug.thread-contention-monitoring",false,"Set true to enable Java's thread contention monitoring for thread dumps");
@ -101,7 +100,6 @@ public class CauldronConfig extends ConfigBase