{
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);
if (footprintMap != null && !footprintMap.isEmpty())
{
List<Footprint> footprints = footprintMap.get(chunkKey);
if (footprints != null)
GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_FOOTPRINT_LIST, new Object[] { chunkKey, footprints.toArray(new Footprint[footprints.size()]) }), targetPoint);
}
}
}
}
}
if (tickCount % 20 == 0)
{
if (!playersRequestingMapData.isEmpty())
{
ArrayList<EntityPlayerMP> copy = new ArrayList<EntityPlayerMP>(playersRequestingMapData);
for (EntityPlayerMP playerMP : copy)
{
GCPlayerStats stats = GCPlayerStats.get(playerMP);
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair((int)Math.floor(stats.coordsTeleportedFromX) >> 4, (int)Math.floor(stats.coordsTeleportedFromZ) >> 4);
BufferedImage image = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB);
for (int x0 = -12; x0 <= 12; x0++)
{
for (int z0 = -12; z0 <= 12; z0++)
{
Chunk chunk = MinecraftServer.getServer().worldServerForDimension(0).getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos + x0, chunkCoordIntPair.chunkZPos + z0);
if (chunk != null)
{
for (int z = 0; z < 16; z++)
{
for (int x = 0; x < 16; x++)
{
int l4 = chunk.getHeightValue(x, z) + 1;
Block block = Blocks.air;
int i5 = 0;
if (l4 > 1)
{
do
{
--l4;
block = chunk.getBlock(x, l4, z);
i5 = chunk.getBlockMetadata(x, l4, z);
}
while (block.getMapColor(i5) == MapColor.airColor && l4 > 0);
}
int col = block.getMapColor(i5).colorValue;