mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-19 19:59:37 +00:00
Modified to use the new way of getting cumulative data per class.
TileEntity list is now sent as an AmountHolder instead of the old whatever.
This commit is contained in:
1 parent
853920ac1e
commit
a5e9667e4f
6 files changed
+57
-56
No files matched your search
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -25,6 +26,7 @@ import mcp.mobius.opis.data.profilers.ProfilerEntityUpdate;
|
||||
import mcp.mobius.opis.helpers.Teleport;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
import mcp.mobius.opis.network.enums.PlayerEv;
|
||||
import mcp.mobius.mobiuscore.monitors.MonitoredEntityList;
|
||||
|
||||
public enum EntityManager {
|
||||
INSTANCE;
|
||||
@@ -125,27 +127,16 @@ public enum EntityManager {
|
||||
/* Returns a hashmap with the entity name and amount of it on the server */
|
||||
public ArrayList<AmountHolder> getCumulativeEntities(boolean filtered){
|
||||
ArrayList<AmountHolder> cumData = new ArrayList<AmountHolder>();
|
||||
HashMap<String, Integer> entities = new HashMap<String, Integer>();
|
||||
|
||||
|
||||
for (int dim : DimensionManager.getIDs()){
|
||||
World world = DimensionManager.getWorld(dim);
|
||||
if (world == null) continue;
|
||||
|
||||
for (Object o : world.loadedEntityList.toArray()){
|
||||
Entity ent = (Entity)o;
|
||||
//String name = ent.getClass().getName();
|
||||
String name = getEntityName(ent, filtered);
|
||||
|
||||
if (!entities.containsKey(name))
|
||||
entities.put(name, 0);
|
||||
|
||||
entities.put(name, entities.get(name) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : entities.keySet())
|
||||
cumData.add(new AmountHolder(key, entities.get(key)));
|
||||
if (world == null) continue;
|
||||
|
||||
Map<String, Integer> count = ((MonitoredEntityList)world.loadedEntityList).getCount();
|
||||
for (String key : count.keySet())
|
||||
if (count.get(key) > 0)
|
||||
cumData.add(new AmountHolder(key, count.get(key)));
|
||||
}
|
||||
return cumData;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user