| 
					
				 | 
			
			
				@@ -29,7 +29,6 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private HashMap<UUID, Boolean> oldData = new HashMap<UUID, Boolean>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<Entity> spawnedMobs = new ArrayList<Entity>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private List<Entity> spawnedPets = new ArrayList<Entity>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<Entity> mobsToRemove = new ArrayList<Entity>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<String> savedChunks = new ArrayList<String>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<Entity> checkedMobs = new ArrayList<Entity>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -174,26 +173,21 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             store.put(world.getName() + "," + cx + "," + cz, in); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<UUID> mobs = in.getSpawnedMobs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<UUID> pets = in.getSpawnedPets(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (mobs.isEmpty() && pets.isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (mobs.isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             iteratingMobs = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (LivingEntity entity : world.getLivingEntities()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Entity entity : world.getEntities()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (mobs.contains(entity.getUniqueId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     addSpawnedMob(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (pets.contains(entity.getUniqueId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addSpawnedPet(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(safeToRemoveMobs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 iteratingMobs = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             in.clearSpawnedMobs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            in.clearSpawnedPets(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -217,20 +211,8 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 removalCheckedMobs.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tempSpawnedPets.remove(removalCheckedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tempSpawnedPets.remove(checkedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!isEntityInChunk(entity, cx, cz, world)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                mobsToRemove.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                removalCheckedMobs.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (safeToRemoveMobs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 spawnedMobs.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                spawnedPets.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mobsToRemove.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 removalCheckedMobs.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 iteratingMobs = false; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -258,19 +240,6 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 unloaded = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!unloaded) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tempSpawnedPets.remove(checkedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!isEntityInChunk(entity, cx, cz, world)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    loadChunk(cx, cz, world); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    unloaded = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -291,16 +260,6 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 checkedMobs.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            tempSpawnedPets.remove(checkedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!isEntityInChunk(entity, cx, cz, world)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                out.addSpawnedPet(entity.getUniqueId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                checkedMobs.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!out.isDirty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -389,20 +348,6 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             saveChunk(cx, cz, world); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        tempSpawnedPets.remove(checkedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            World entityWorld = entity.getWorld(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (world != entityWorld) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int cx = entity.getLocation().getChunk().getX(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int cz = entity.getLocation().getChunk().getZ(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            saveChunk(cx, cz, world); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         savingWorld = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         savedChunks.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         checkedMobs.clear(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -452,25 +397,9 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             unloadChunk(cx, cz, world); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	tempSpawnedPets.remove(checkedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        tempSpawnedMobs.remove(removalCheckedMobs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            World entityWorld = entity.getWorld(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (world != entityWorld) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int cx = entity.getLocation().getChunk().getX(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int cz = entity.getLocation().getChunk().getZ(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            unloadChunk(cx, cz, world); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         safeToRemoveMobs = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         spawnedMobs.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        spawnedPets.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mobsToRemove.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         checkedMobs.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         removalCheckedMobs.clear(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -642,7 +571,7 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public boolean isSpawnedPet(Entity entity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return spawnedPets.contains(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return spawnedMobs.contains(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void addSpawnedMob(Entity entity) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -651,8 +580,8 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void addSpawnedPet(Entity entity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!isSpawnedPet(entity)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            spawnedPets.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!isSpawnedMob(entity)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            spawnedMobs.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void removeSpawnedMob(Entity entity) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -661,8 +590,8 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void removeSpawnedPet(Entity entity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (isSpawnedPet(entity)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            spawnedPets.remove(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (isSpawnedMob(entity)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            spawnedMobs.remove(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public synchronized void cleanMobLists() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -680,17 +609,7 @@ public class HashChunkManager implements ChunkManager { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mobsToRemove.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (Entity entity : tempSpawnedPets) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (entity.isDead()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                mobsToRemove.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!entity.isValid()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                mobsToRemove.add(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         spawnedMobs.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        spawnedPets.remove(mobsToRemove); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mobsToRemove.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |