Fix tile tick capping variable becoming out of sync

This commit is contained in:
Evan Haskell 2015-04-30 15:54:10 -04:00 committed by Zach Brown
parent 9012499383
commit 7b3e9e5197

View File

@ -1,4 +1,4 @@
From 4763b6199dc30b36bded79df0be5d4aeec86e5a7 Mon Sep 17 00:00:00 2001 From 714118c140a88bd44a0f3d03dc1f51a1bcc32f15 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net> From: md_5 <git@md-5.net>
Date: Fri, 20 Feb 2015 21:39:31 +1100 Date: Fri, 20 Feb 2015 21:39:31 +1100
Subject: [PATCH] Allow Capping (Tile)Entity Tick Time. 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. 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c09ea1f..f9203a7 100644 index c09ea1f..7e4aff2 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
@@ -137,6 +137,9 @@ public abstract class World implements IBlockAccess { @@ -137,6 +137,9 @@ public abstract class World implements IBlockAccess {
@ -46,7 +46,7 @@ index c09ea1f..f9203a7 100644
entity = (Entity) this.entityList.get(this.tickPosition); entity = (Entity) this.entityList.get(this.tickPosition);
// CraftBukkit end // CraftBukkit end
if (entity.vehicle != null) { if (entity.vehicle != null) {
@@ -1452,14 +1462,18 @@ public abstract class World implements IBlockAccess { @@ -1452,14 +1462,19 @@ public abstract class World implements IBlockAccess {
this.c.clear(); this.c.clear();
} }
// CraftBukkit end // CraftBukkit end
@ -65,15 +65,17 @@ index c09ea1f..f9203a7 100644
if (tileentity == null) { if (tileentity == null) {
getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
- iterator.remove(); - iterator.remove();
+ tilesThisCycle--;
+ this.tileEntityList.remove(tileTickPosition--); + this.tileEntityList.remove(tileTickPosition--);
continue; continue;
} }
// Spigot end // Spigot end
@@ -1487,7 +1501,7 @@ public abstract class World implements IBlockAccess { @@ -1487,7 +1502,8 @@ public abstract class World implements IBlockAccess {
} }
if (tileentity.x()) { if (tileentity.x()) {
- iterator.remove(); - iterator.remove();
+ tilesThisCycle--;
+ this.tileEntityList.remove(tileTickPosition--); + this.tileEntityList.remove(tileTickPosition--);
this.h.remove(tileentity); this.h.remove(tileentity);
if (this.isLoaded(tileentity.getPosition())) { if (this.isLoaded(tileentity.getPosition())) {