From 00f24fd5bdac67e4e695b8da1981dd795a17652d Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Fri, 18 Jan 2013 14:55:29 -0800 Subject: [PATCH] Reducing CPU usage on chunk load. --- .../util/blockmeta/chunkmeta/HashChunkManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index f9a239e60..eecfeb84b 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -17,6 +17,7 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.LivingEntity; import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionZDirectory; @@ -179,7 +180,12 @@ public class HashChunkManager implements ChunkManager { iteratingMobs = true; - for (Entity entity : world.getEntities()) { + for (LivingEntity entity : world.getLivingEntities()) { + if (mobs.contains(entity.getUniqueId())) + addSpawnedMob(entity); + } + + for(FallingBlock entity: world.getEntitiesByClass(FallingBlock.class)) { if (mobs.contains(entity.getUniqueId())) addSpawnedMob(entity); }