Should fix concurent modification exceptions when using removeSpawns
This commit is contained in:
parent
5ee3a057a2
commit
07bebf187c
2 changed files with 10 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue