Disable spigot tick limiters

This commit is contained in:
Zach Brown 2015-10-16 21:43:03 -05:00
parent 9f7447824d
commit 264f2c2d09
2 changed files with 29 additions and 44 deletions

View file

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ 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);
@@ -0,0 +0,0 @@ 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);
--

View file

@ -189,25 +189,6 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ 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)
{
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
};
// Spigot end
@ -217,31 +198,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final List<TileEntity> tileEntityList = Lists.newArrayList();
private final List<TileEntity> b = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
@@ -0,0 +0,0 @@ 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
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.c.isEmpty()) {