(Temporarily?) Disable Spigot's TE changes in favor of our own

Pending proper benchmarks and a potential rewrite, this appears to be a
good short-term solution
This commit is contained in:
Zach Brown 2015-02-22 02:38:45 -06:00
parent b2f0432d2e
commit d871bd8d00
3 changed files with 64 additions and 8 deletions

View File

@ -1,4 +1,4 @@
From f3f9681b466aa0d0682a67e293c06ba928ffad9f Mon Sep 17 00:00:00 2001 From f239a7099cb973e65d130657977527269e7d3d32 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 28 Nov 2014 04:14:14 -0600 Date: Fri, 28 Nov 2014 04:14:14 -0600
Subject: [PATCH] Optimize TileEntity Ticking Subject: [PATCH] Optimize TileEntity Ticking
@ -74,7 +74,7 @@ index 7b6f8ae..c6b593f 100644
if (this.e instanceof BlockDaylightDetector) { if (this.e instanceof BlockDaylightDetector) {
((BlockDaylightDetector) this.e).d(this.world, this.position); ((BlockDaylightDetector) this.e).d(this.world, this.position);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fa68938..7507580 100644 index a105351..b59e88a 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -3,13 +3,7 @@ package net.minecraft.server; @@ -3,13 +3,7 @@ package net.minecraft.server;
@ -101,6 +101,62 @@ index fa68938..7507580 100644
private final List a = Lists.newArrayList(); private final List a = Lists.newArrayList();
private final List b = Lists.newArrayList(); private final List b = Lists.newArrayList();
public final List players = Lists.newArrayList(); public final List players = Lists.newArrayList();
@@ -133,8 +127,8 @@ public abstract class World implements IBlockAccess {
public static String blockLocation;
public List<TileEntity> triggerHoppersList = new ArrayList<TileEntity>(); // Spigot, When altHopperTicking, tile entities being added go through here.
private org.spigotmc.TickLimiter entityLimiter;
- private org.spigotmc.TickLimiter tileLimiter;
- private int tileTickPosition;
+ //private org.spigotmc.TickLimiter tileLimiter; // PaperSpigot - Disable Spigot's TE handling in favor of our own
+ //private int tileTickPosition; // PaperSpigot - Disable Spigot's TE handling in favor of our own
public static long chunkToKey(int x, int z)
{
@@ -240,7 +234,7 @@ public abstract class World implements IBlockAccess {
this.getServer().addWorld(this.world); // CraftBukkit
timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
+ //this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); // PaperSpigot - Disable Spigot's TE handling in favor of our own
}
public World b() {
@@ -1462,7 +1456,12 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently.
+ // PaperSpigot Start - Return to previous behavior, theoretically tile entity ticks should no longer be long enough for this to be an issue
+ Iterator iterator = this.tileEntityList.iterator();
+ while (iterator.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator.next();
+ /*
// Spigot start
int tilesThisCycle = 0;
for (tileLimiter.initTick();
@@ -1470,10 +1469,12 @@ public abstract class World implements IBlockAccess {
tileTickPosition++, tilesThisCycle++) {
tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0;
TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition);
+ */
+ // PaperSpigot end
// Spigot start
if (tileentity == null) {
getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
- this.tileEntityList.remove(tileTickPosition--);
+ iterator.remove(); // PaperSpigot - Remove Spigot's TE handling in favor of our own
continue;
}
// Spigot end
@@ -1501,7 +1502,7 @@ public abstract class World implements IBlockAccess {
}
if (tileentity.x()) {
- this.tileEntityList.remove(tileTickPosition--);
+ iterator.remove(); // PaperSpigot - Remove Spigot's TE handling in favor of our own
this.h.remove(tileentity);
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition());
diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java
new file mode 100644 new file mode 100644
index 0000000..1a53e94 index 0000000..1a53e94

View File

@ -1,4 +1,4 @@
From 9698258d27c861c74452db8fd49fa728ea4dd532 Mon Sep 17 00:00:00 2001 From 55bbadaa2107d3a9e7635abbb11dc5807a0420b7 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv> From: Iceee <andrew@opticgaming.tv>
Date: Fri, 28 Nov 2014 12:11:03 -0600 Date: Fri, 28 Nov 2014 12:11:03 -0600
Subject: [PATCH] Remove specific entities that fly through an unloaded chunk Subject: [PATCH] Remove specific entities that fly through an unloaded chunk
@ -70,7 +70,7 @@ index 4823698..7b856ef 100644
this.motY *= 0.9800000190734863D; this.motY *= 0.9800000190734863D;
this.motZ *= 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 753865f..51f3d8a 100644 index b59e88a..c350281 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1158,6 +1158,7 @@ public abstract class World implements IBlockAccess { @@ -1158,6 +1158,7 @@ public abstract class World implements IBlockAccess {
@ -81,7 +81,7 @@ index 753865f..51f3d8a 100644
continue; continue;
} }
int cz = chunkz << 4; int cz = chunkz << 4;
@@ -1583,6 +1584,14 @@ public abstract class World implements IBlockAccess { @@ -1590,6 +1591,14 @@ public abstract class World implements IBlockAccess {
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
entity.ticksLived++; entity.ticksLived++;
entity.inactiveTick(); entity.inactiveTick();

View File

@ -1,4 +1,4 @@
From eb00fa1302dd89b00cad3ef3173925be55487710 Mon Sep 17 00:00:00 2001 From 66a31ac97a2475d69922718578ec3f410a4d8a67 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 3 Jul 2013 08:29:26 -0400 Date: Wed, 3 Jul 2013 08:29:26 -0400
Subject: [PATCH] Prevent tile entity and entity crashes Subject: [PATCH] Prevent tile entity and entity crashes
@ -24,7 +24,7 @@ index 76cdc7e..d976515 100644
crashreportsystemdetails.a("Actual block data value", (Callable) (new CrashReportTileEntityData(this))); crashreportsystemdetails.a("Actual block data value", (Callable) (new CrashReportTileEntityData(this)));
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 51f3d8a..82f2e9e 100644 index c350281..e5e6030 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1418,10 +1418,13 @@ public abstract class World implements IBlockAccess { @@ -1418,10 +1418,13 @@ public abstract class World implements IBlockAccess {
@ -45,7 +45,7 @@ index 51f3d8a..82f2e9e 100644
} }
} }
@@ -1481,11 +1484,13 @@ public abstract class World implements IBlockAccess { @@ -1488,11 +1491,13 @@ public abstract class World implements IBlockAccess {
tileentity.tickTimer.startTiming(); // Spigot tileentity.tickTimer.startTiming(); // Spigot
((IUpdatePlayerListBox) tileentity).c(); ((IUpdatePlayerListBox) tileentity).c();
} catch (Throwable throwable2) { } catch (Throwable throwable2) {