Disable spigot tick limiters

This commit is contained in:
Zach Brown 2015-10-16 21:43:03 -05:00
parent 978982edfd
commit 7d86a674eb
10 changed files with 80 additions and 93 deletions

View File

@ -1,4 +1,4 @@
From 6ec7f2863ddf38e1c9bb2cb7df05f280e90fb860 Mon Sep 17 00:00:00 2001
From 107454d78a44a4dd3d04fc0f68cce6b476ae6274 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 22:55:25 -0600
Subject: [PATCH] Optimize TileEntity Ticking
@ -186,29 +186,10 @@ index 794cdc8..00fceda 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index acfceb8..1729071 100644
index acfceb8..4b642ba 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -28,6 +28,18 @@ public abstract class World implements IBlockAccess {
// Spigot start - guard entity list from removals
public final List<Entity> entityList = new java.util.ArrayList<Entity>()
{
+ // PaperSpigot start - move always activated entities to top of tick list
+ @Override
+ public boolean add(Entity e) {
+ if (e.defaultActivationState) {
+ super.add(0, e);
+ return true;
+ } else {
+ return super.add(e);
+ }
+ }
+ // PaperSpigot end
+
@Override
public Entity remove(int index)
{
@@ -52,7 +64,7 @@ public abstract class World implements IBlockAccess {
@@ -52,7 +52,7 @@ public abstract class World implements IBlockAccess {
};
// Spigot end
protected final List<Entity> g = Lists.newArrayList();
@ -217,32 +198,7 @@ index acfceb8..1729071 100644
public final List<TileEntity> tileEntityList = Lists.newArrayList();
private final List<TileEntity> b = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
@@ -1394,10 +1406,22 @@ public abstract class World implements IBlockAccess {
guardEntityList = true; // Spigot
// CraftBukkit start - Use field for loop variable
int entitiesThisCycle = 0;
+
+ // PaperSpigot start - Compute minimum tick index
+ int minTickIndex = -1;
+ ListIterator<Entity> e = entityList.listIterator();
+ while (e.hasNext()) {
+ if (!e.next().defaultActivationState) {
+ minTickIndex = e.previousIndex();
+ break;
+ }
+ }
+ // PaperSpigot end
+
if (tickPosition < 0) tickPosition = 0;
for (entityLimiter.initTick();
- entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue());
- tickPosition++, entitiesThisCycle++) {
+ entitiesThisCycle < entityList.size() && (tickPosition <= minTickIndex || entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue()); // PaperSpigot
+ tickPosition++, entitiesThisCycle++) {
tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0;
entity = (Entity) this.entityList.get(this.tickPosition);
// CraftBukkit end
@@ -1450,7 +1474,7 @@ public abstract class World implements IBlockAccess {
@@ -1450,7 +1450,7 @@ public abstract class World implements IBlockAccess {
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.c.isEmpty()) {
this.tileEntityList.removeAll(this.c);
@ -251,7 +207,7 @@ index acfceb8..1729071 100644
this.c.clear();
}
// CraftBukkit end
@@ -1496,7 +1520,7 @@ public abstract class World implements IBlockAccess {
@@ -1496,7 +1496,7 @@ public abstract class World implements IBlockAccess {
if (tileentity.x()) {
tilesThisCycle--;
this.tileEntityList.remove(tileTickPosition--);
@ -260,7 +216,7 @@ index acfceb8..1729071 100644
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition());
}
@@ -1543,7 +1567,7 @@ public abstract class World implements IBlockAccess {
@@ -1543,7 +1543,7 @@ public abstract class World implements IBlockAccess {
}
public boolean a(TileEntity tileentity) {
@ -269,7 +225,7 @@ index acfceb8..1729071 100644
if (flag && tileentity instanceof IUpdatePlayerListBox) {
this.tileEntityList.add(tileentity);
@@ -1561,7 +1585,7 @@ public abstract class World implements IBlockAccess {
@@ -1561,7 +1561,7 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
@ -278,7 +234,7 @@ index acfceb8..1729071 100644
if (tileentity instanceof IUpdatePlayerListBox) {
this.tileEntityList.add(tileentity);
}
@@ -1997,7 +2021,7 @@ public abstract class World implements IBlockAccess {
@@ -1997,7 +1997,7 @@ public abstract class World implements IBlockAccess {
} else {
if (tileentity != null) {
this.b.remove(tileentity);

View File

@ -1,4 +1,4 @@
From 4baf22e970cea6e654c103d01f439c96887eadb7 Mon Sep 17 00:00:00 2001
From 7e20c9665dde62e307535c68d0a636c5f18898d9 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv>
Date: Sun, 8 Mar 2015 03:34:15 -0500
Subject: [PATCH] Remove certain entities that fly through unloaded chunks
@ -70,10 +70,10 @@ index 2d22327..50423eb 100644
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 8a2d2c0..6226a6e 100644
index 4b642ba..46e39f2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1172,6 +1172,7 @@ public abstract class World implements IBlockAccess {
@@ -1160,6 +1160,7 @@ public abstract class World implements IBlockAccess {
{
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
{
@ -81,7 +81,7 @@ index 8a2d2c0..6226a6e 100644
continue;
}
int cz = chunkz << 4;
@@ -1607,6 +1608,14 @@ public abstract class World implements IBlockAccess {
@@ -1583,6 +1584,14 @@ public abstract class World implements IBlockAccess {
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
entity.ticksLived++;
entity.inactiveTick();
@ -116,5 +116,5 @@ index 5aa368f..729cbf1 100644
+ }
}
--
2.5.2
2.6.1.windows.1

View File

@ -1,4 +1,4 @@
From 444300b298e4126354a42bd37a086cf98da99bb0 Mon Sep 17 00:00:00 2001
From a68057fa44ba44de92cdaf84ed4a047960c9e1bd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 8 Mar 2015 04:37:23 -0500
Subject: [PATCH] Prevent tile entity and entity crashes
@ -23,10 +23,10 @@ index c268a40..3fc6450 100644
public String a() throws Exception {
int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6226a6e..a899ee2 100644
index 46e39f2..c50536e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1442,10 +1442,13 @@ public abstract class World implements IBlockAccess {
@@ -1418,10 +1418,13 @@ public abstract class World implements IBlockAccess {
this.g(entity);
SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
} catch (Throwable throwable1) {
@ -44,7 +44,7 @@ index 6226a6e..a899ee2 100644
}
}
@@ -1504,11 +1507,14 @@ public abstract class World implements IBlockAccess {
@@ -1480,11 +1483,14 @@ public abstract class World implements IBlockAccess {
tileentity.tickTimer.startTiming(); // Spigot
((IUpdatePlayerListBox) tileentity).c();
} catch (Throwable throwable2) {
@ -65,5 +65,5 @@ index 6226a6e..a899ee2 100644
// Spigot start
finally {
--
2.5.2
2.6.1.windows.1

View File

@ -1,4 +1,4 @@
From 430a2e0719a436e296f676022616e0f5174df805 Mon Sep 17 00:00:00 2001
From bd3df799507c4cf52bfa005a06acec8010a5dfea Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 1 Jul 2015 00:18:10 -0700
Subject: [PATCH] Configurable async light updates
@ -88,7 +88,7 @@ index 975d666..ae0f276 100644
if (!this.world.c(i, j)) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a899ee2..0de2af1 100644
index c50536e..82c43e3 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -18,6 +18,12 @@ import org.bukkit.generator.ChunkGenerator;
@ -104,7 +104,7 @@ index a899ee2..0de2af1 100644
// CraftBukkit start
// CraftBukkit end
@@ -140,6 +146,7 @@ public abstract class World implements IBlockAccess {
@@ -128,6 +134,7 @@ public abstract class World implements IBlockAccess {
private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition;
@ -112,7 +112,7 @@ index a899ee2..0de2af1 100644
public static long chunkToKey(int x, int z)
{
@@ -509,7 +516,7 @@ public abstract class World implements IBlockAccess {
@@ -497,7 +504,7 @@ public abstract class World implements IBlockAccess {
if (!this.worldProvider.o()) {
for (i1 = k; i1 <= l; ++i1) {
@ -121,7 +121,7 @@ index a899ee2..0de2af1 100644
}
}
@@ -2349,10 +2356,10 @@ public abstract class World implements IBlockAccess {
@@ -2325,10 +2332,10 @@ public abstract class World implements IBlockAccess {
boolean flag = false;
if (!this.worldProvider.o()) {
@ -134,7 +134,7 @@ index a899ee2..0de2af1 100644
return flag;
}
@@ -2399,10 +2406,10 @@ public abstract class World implements IBlockAccess {
@@ -2375,10 +2382,10 @@ public abstract class World implements IBlockAccess {
}
}
@ -148,7 +148,7 @@ index a899ee2..0de2af1 100644
// CraftBukkit end
return false;
} else {
@@ -2520,11 +2527,66 @@ public abstract class World implements IBlockAccess {
@@ -2496,11 +2503,66 @@ public abstract class World implements IBlockAccess {
}
}
@ -232,5 +232,5 @@ index 8421e3b..fa5066b 100644
+ }
}
--
2.5.2
2.6.1.windows.1

View File

@ -1,4 +1,4 @@
From b2518be88123abedcdf2dfad331dbd0ef7a68026 Mon Sep 17 00:00:00 2001
From 2cee191c817dee1d51419f6461e6a02f6be791fa Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 30 Jun 2015 20:45:24 -0700
Subject: [PATCH] Force load chunks for specific entities that fly through
@ -141,10 +141,10 @@ index 1daba4e..3a7c4fa 100644
protected void b(NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0de2af1..9cfa54c 100644
index 82c43e3..d2cb1f1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1179,8 +1179,14 @@ public abstract class World implements IBlockAccess {
@@ -1167,8 +1167,14 @@ public abstract class World implements IBlockAccess {
{
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
{
@ -161,7 +161,7 @@ index 0de2af1..9cfa54c 100644
}
int cz = chunkz << 4;
Chunk chunk = this.getChunkAt( chunkx, chunkz );
@@ -1672,6 +1678,7 @@ public abstract class World implements IBlockAccess {
@@ -1648,6 +1654,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.ad || entity.ae != k || entity.af != l || entity.ag != i1) {
@ -202,5 +202,5 @@ index d6311bd..5b0c64d 100644
return true;
}
--
2.6.0
2.6.1.windows.1

View File

@ -1,14 +1,14 @@
From 04270222ffbe066aa03eb70991cb243a771cf89a Mon Sep 17 00:00:00 2001
From 1b1ce3c1d7f3c2ede70f18412bbe050b80c844c9 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Fri, 5 Jun 2015 00:43:17 -0700
Subject: [PATCH] FallingBlock and TNT entities collide with specific blocks
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9cfa54c..7c90dd9 100644
index d2cb1f1..7660356 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1219,7 +1219,15 @@ public abstract class World implements IBlockAccess {
@@ -1207,7 +1207,15 @@ public abstract class World implements IBlockAccess {
}
if ( block != null )
{
@ -41,5 +41,5 @@ index beeaa0b..88e0644 100644
+ }
}
--
2.5.2
2.6.1.windows.1

View File

@ -1,4 +1,4 @@
From 583847a7988a8a24def401ec16a207e110cd2845 Mon Sep 17 00:00:00 2001
From 08d9141e892efb8b00b405903f3be94307236c8f Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 16 Jun 2015 00:43:17 -0700
Subject: [PATCH] Optimize explosions
@ -122,10 +122,10 @@ index 06ae3fc..eac71e8 100644
// this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7c90dd9..254e155 100644
index 7660356..68cb798 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -147,6 +147,7 @@ public abstract class World implements IBlockAccess {
@@ -135,6 +135,7 @@ public abstract class World implements IBlockAccess {
private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition;
public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("PaperSpigot - Lighting Thread").build()); // PaperSpigot - Asynchronous lighting updates
@ -149,5 +149,5 @@ index 88e0644..f3228d9 100644
+ }
}
--
2.6.0
2.6.1.windows.1

View File

@ -1,14 +1,14 @@
From 87d59743e8e845b874b622a0d9ef86cdd75ffda3 Mon Sep 17 00:00:00 2001
From ba096e647abc5ff61aea708c97dba3ba08d9a0df Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Tue, 14 Jul 2015 09:30:28 -0700
Subject: [PATCH] Disable mood sounds
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 254e155..1c82aaa 100644
index 68cb798..64713bd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2272,7 +2272,7 @@ public abstract class World implements IBlockAccess {
@@ -2248,7 +2248,7 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
@ -33,5 +33,5 @@ index 25e92f8..8e5de323 100644
+ }
}
--
2.5.2
2.6.1.windows.1

View File

@ -1,14 +1,14 @@
From 8e392550b6970e1553f6d09108797b60f618a7a4 Mon Sep 17 00:00:00 2001
From ad9631fe4ee824d1e2443306f6df0d782aea44cb Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 14 Jul 2015 10:03:45 -0700
Subject: [PATCH] Optimize getCubes()
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1c82aaa..816a2f6 100644
index 64713bd..08041af 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1178,11 +1178,12 @@ public abstract class World implements IBlockAccess {
@@ -1166,11 +1166,12 @@ public abstract class World implements IBlockAccess {
int cx = chunkx << 4;
for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ )
{
@ -23,7 +23,7 @@ index 1c82aaa..816a2f6 100644
} else {
entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
continue;
@@ -1190,7 +1191,6 @@ public abstract class World implements IBlockAccess {
@@ -1178,7 +1179,6 @@ public abstract class World implements IBlockAccess {
// PaperSpigot end
}
int cz = chunkz << 4;
@ -31,7 +31,7 @@ index 1c82aaa..816a2f6 100644
// Compute ranges within chunk
int xstart = ( i < cx ) ? cx : i;
int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 );
@@ -1237,6 +1237,8 @@ public abstract class World implements IBlockAccess {
@@ -1225,6 +1225,8 @@ public abstract class World implements IBlockAccess {
}
// Spigot end
@ -41,5 +41,5 @@ index 1c82aaa..816a2f6 100644
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
--
2.5.2
2.6.1.windows.1

View File

@ -0,0 +1,31 @@
From 783776aa9f216cda60f8a336942118797db85a32 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 16 Oct 2015 21:39:07 -0500
Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 08041af..a9c627e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1421,7 +1421,7 @@ public abstract class World implements IBlockAccess {
int entitiesThisCycle = 0;
if (tickPosition < 0) tickPosition = 0;
for (entityLimiter.initTick();
- entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue());
+ entitiesThisCycle < entityList.size() /*&& (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue())*/; // PaperSpigot - Disable tick limiters
tickPosition++, entitiesThisCycle++) {
tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0;
entity = (Entity) this.entityList.get(this.tickPosition);
@@ -1486,7 +1486,7 @@ public abstract class World implements IBlockAccess {
// Spigot start
int tilesThisCycle = 0;
for (tileLimiter.initTick();
- tilesThisCycle < tileEntityList.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue());
+ tilesThisCycle < tileEntityList.size() /*&& (tilesThisCycle % 10 == 0 || tileLimiter.shouldContinue())*/; // PaperSpigot - Disable tick limiters
tileTickPosition++, tilesThisCycle++) {
tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0;
TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition);
--
2.6.1.windows.1