From 07bebf187c050eefa464a48babb4095dbd3a8acd Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 19 Jun 2012 19:44:52 -0700 Subject: [PATCH] Should fix concurent modification exceptions when using removeSpawns --- fml/client/net/minecraft/src/ClientRegistry.java | 8 +++++--- fml/server/net/minecraft/src/ServerRegistry.java | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fml/client/net/minecraft/src/ClientRegistry.java b/fml/client/net/minecraft/src/ClientRegistry.java index 2f237d132..bf8fc3bbb 100644 --- a/fml/client/net/minecraft/src/ClientRegistry.java +++ b/fml/client/net/minecraft/src/ClientRegistry.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.Collections; +import java.util.Iterator; import java.util.List; import cpw.mods.fml.client.FMLClientHandler; @@ -131,13 +132,14 @@ public class ClientRegistry implements IMinecraftRegistry for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") - List spawns = biome.func_25063_a(typeOfCreature); + Iterator spawns = biome.func_25063_a(typeOfCreature).iterator(); - for (SpawnListEntry entry : Collections.unmodifiableList(spawns)) + while (spawns.hasNext()) { + SpawnListEntry entry = spawns.next(); if (entry.field_25212_a == entityClass) { - spawns.remove(entry); + spawns.remove(); } } } diff --git a/fml/server/net/minecraft/src/ServerRegistry.java b/fml/server/net/minecraft/src/ServerRegistry.java index b22d00678..7c819d314 100644 --- a/fml/server/net/minecraft/src/ServerRegistry.java +++ b/fml/server/net/minecraft/src/ServerRegistry.java @@ -1,6 +1,7 @@ package net.minecraft.src; import java.util.Collections; +import java.util.Iterator; import java.util.List; import cpw.mods.fml.common.registry.IMinecraftRegistry; @@ -121,13 +122,14 @@ public class ServerRegistry implements IMinecraftRegistry for (BiomeGenBase biome : biomes) { @SuppressWarnings("unchecked") - List spawns = biome.func_25055_a(typeOfCreature); + Iterator spawns = biome.func_25055_a(typeOfCreature).iterator(); - for (SpawnListEntry entry : Collections.unmodifiableList(spawns)) + while (spawns.hasNext()) { + SpawnListEntry entry = spawns.next(); if (entry.field_25145_a == entityClass) { - spawns.remove(entry); + spawns.remove(); } } }