Fixed problems with World.getPlayers()

This commit is contained in:
Johannes Donath 2015-02-27 21:14:00 +01:00 committed by Zach Brown
parent 78f0bacf0a
commit 89cb2c0a86
1 changed files with 7 additions and 15 deletions

View File

@ -1,4 +1,4 @@
From d9ff34fe89d480c31bfe4d0b183cc3c1dcbee6bf Mon Sep 17 00:00:00 2001
From 6166b3835f703314b49c21eb0420e184c61da949 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 20 Feb 2015 21:39:31 +1100
Subject: [PATCH] Allow Capping (Tile)Entity Tick Time.
@ -10,7 +10,7 @@ For tiles there is very little tradeoff for this option, as tile ticks are based
This feature was commisioned by Chunkr.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c50aa62..9806e49 100644
index c50aa62..e921f55 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -134,6 +134,9 @@ public abstract class World implements IBlockAccess {
@ -32,21 +32,13 @@ index c50aa62..9806e49 100644
}
public World b() {
@@ -1114,7 +1119,7 @@ public abstract class World implements IBlockAccess {
this.everyoneSleeping();
}
- if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking
+ if (false) { // Spigot - It will get removed next tick
int i = entity.ae;
int j = entity.ag;
@@ -1393,7 +1398,11 @@ public abstract class World implements IBlockAccess {
@@ -1393,7 +1398,12 @@ public abstract class World implements IBlockAccess {
timings.entityTick.startTiming(); // Spigot
guardEntityList = true; // Spigot
// CraftBukkit start - Use field for loop variable
- for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) {
+ int entitiesThisCycle = 0;
+ if (tickPosition < 0) tickPosition = 0;
+ for (entityLimiter.initTick();
+ entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue());
+ tickPosition++, entitiesThisCycle++) {
@ -54,7 +46,7 @@ index c50aa62..9806e49 100644
entity = (Entity) this.entityList.get(this.tickPosition);
// CraftBukkit end
if (entity.vehicle != null) {
@@ -1451,14 +1460,18 @@ public abstract class World implements IBlockAccess {
@@ -1451,14 +1461,18 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently.
@ -77,7 +69,7 @@ index c50aa62..9806e49 100644
continue;
}
// Spigot end
@@ -1486,7 +1499,7 @@ public abstract class World implements IBlockAccess {
@@ -1486,7 +1500,7 @@ public abstract class World implements IBlockAccess {
}
if (tileentity.x()) {
@ -131,5 +123,5 @@ index 0000000..23a3938
+ }
+}
--
2.1.0
2.3.1