3
0

Use iterator for entities loop

This commit is contained in:
Prototik
2015-08-29 17:37:03 +07:00
parent 4a63dcacca
commit 9ba84893f3
9 changed files with 439 additions and 110 deletions

View File

@ -334,16 +334,15 @@ public class CauldronHooks
writer.name("players").value(world.playerEntities.size());
writer.name("loadedChunks").value(world.theChunkProviderServer.loadedChunkHashMap_KC.size());
writer.name("activeChunks").value(world.activeChunkSet.size());
writer.name("entities").value(world.loadedEntityList.size());
writer.name("entities").value(world.loadedEntityList_KC.size());
writer.name("tiles").value(world.loadedTileEntityList.size());
TObjectIntHashMap<ChunkCoordIntPair> chunkEntityCounts = new TObjectIntHashMap<ChunkCoordIntPair>();
TObjectIntHashMap<Class> classEntityCounts = new TObjectIntHashMap<Class>();
TObjectIntHashMap<Entity> entityCollisionCounts = new TObjectIntHashMap<Entity>();
Set<ChunkCoordinates> collidingCoords = new HashSet<ChunkCoordinates>();
for (int i = 0; i < world.loadedEntityList.size(); i++)
for (Entity entity : world.loadedEntityList_KC)
{
Entity entity = (Entity) world.loadedEntityList.get(i);
ChunkCoordIntPair chunkCoords = new ChunkCoordIntPair((int) entity.posX >> 4, (int) entity.posZ >> 4);
chunkEntityCounts.adjustOrPutValue(chunkCoords, 1, 1);
classEntityCounts.adjustOrPutValue(entity.getClass(), 1, 1);