Should fix concurent modification exceptions when using removeSpawns

This commit is contained in:
LexManos 2012-06-19 19:44:52 -07:00
parent 5ee3a057a2
commit 07bebf187c
2 changed files with 10 additions and 6 deletions

View File

@ -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<SpawnListEntry> spawns = biome.func_25063_a(typeOfCreature);
Iterator<SpawnListEntry> 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();
}
}
}

View File

@ -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<SpawnListEntry> spawns = biome.func_25055_a(typeOfCreature);
Iterator<SpawnListEntry> 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();
}
}
}