{
WorldServer[] worlds = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers;
for (int i = 0; i < worlds.length; i++)
{
WorldServer world = worlds[i];
ChunkProviderServer chunkProviderServer = world.theChunkProviderServer;
Map<Long, List<Footprint>> footprintMap = TickHandlerServer.serverFootprintMap.get(world.provider.dimensionId);
if (footprintMap != null)
{
boolean mapChanged = false;
if (chunkProviderServer != null)
{
Iterator iterator = chunkProviderServer.loadedChunks.iterator();
while (iterator.hasNext())
{
Chunk chunk = (Chunk) iterator.next();
long chunkKey = ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition);
List<Footprint> footprints = footprintMap.get(chunkKey);
if (footprints != null)
{
List<Footprint> toRemove = new ArrayList<Footprint>();
for (int j = 0; j < footprints.size(); j++)
{
footprints.get(j).age += 100;
if (footprints.get(j).age >= Footprint.MAX_AGE)
{
toRemove.add(footprints.get(j));
}
}
if (!toRemove.isEmpty())
{
footprints.removeAll(toRemove);
}
footprintMap.put(chunkKey, footprints);
mapChanged = true;
GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(EnumSimplePacket.C_UPDATE_FOOTPRINT_LIST, new Object[] { chunkKey, footprints.toArray(new Footprint[footprints.size()]) }), worlds[i].provider.dimensionId);
}
}
}
if (mapChanged)
{
TickHandlerServer.serverFootprintMap.put(world.provider.dimensionId, footprintMap);
}
}
}
}
else if (!footprintRefreshList.isEmpty())
{
for (NetworkRegistry.TargetPoint targetPoint : footprintRefreshList)
{
WorldServer[] worlds = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers;
for (int i = 0; i < worlds.length; i++)
{
WorldServer world = worlds[i];
if (world.provider.dimensionId == targetPoint.dimension)
{
long chunkKey = ChunkCoordIntPair.chunkXZ2Int((int)targetPoint.x >> 4, (int)targetPoint.z >> 4);
Map<Long, List<Footprint>> footprintMap = TickHandlerServer.serverFootprintMap.get(world.provider.dimensionId);