Once and for all fixed ConcurrentModificationException

This commit is contained in:
Aidan C. Brady 2013-11-12 20:19:06 -05:00
parent 3b64a043df
commit 8e08c9adb8
2 changed files with 5 additions and 3 deletions

View file

@ -20,8 +20,8 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
{ {
public HashSet<ITransmitter<N>> transmitters = new HashSet<ITransmitter<N>>(); public HashSet<ITransmitter<N>> transmitters = new HashSet<ITransmitter<N>>();
public Set<A> possibleAcceptors = Collections.synchronizedSet(new HashSet<A>()); public HashSet<A> possibleAcceptors = new HashSet<A>();
public Map<A, ForgeDirection> acceptorDirections = Collections.synchronizedMap(new HashMap<A, ForgeDirection>()); public HashMap<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
protected int ticksSinceCreate = 0; protected int ticksSinceCreate = 0;

View file

@ -164,7 +164,9 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
{ {
Set<TileEntity> toReturn = new HashSet<TileEntity>(); Set<TileEntity> toReturn = new HashSet<TileEntity>();
for(TileEntity acceptor : possibleAcceptors) Set<TileEntity> copy = (Set<TileEntity>)possibleAcceptors.clone();
for(TileEntity acceptor : copy)
{ {
if(acceptor instanceof IStrictEnergyAcceptor) if(acceptor instanceof IStrictEnergyAcceptor)
{ {