From d9e04a5b2412b0b5e09cd3a0c0b86c3c694ff4e5 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Tue, 11 Feb 2014 14:55:21 -0500 Subject: [PATCH] Check if entity is in list before decrementing. Fixes BUKKIT-5404 --- src/main/java/net/minecraft/server/World.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 419149ed28..4a42bb450a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -976,10 +976,12 @@ public abstract class World implements IBlockAccess { // CraftBukkit start - Decrement loop variable field if we've already ticked this entity int index = this.entityList.indexOf(entity); - if (index <= this.tickPosition) { - this.tickPosition--; + if (index != -1) { + if (index <= this.tickPosition) { + this.tickPosition--; + } + this.entityList.remove(index); } - this.entityList.remove(index); // CraftBukkit end this.b(entity);