Guest User

Untitled

a guest
Apr 14th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1.         try {
  2.             for (World world : getServer().getWorlds()) {
  3.                 for (Chunk c : world.getLoadedChunks()) {
  4.                     CraftChunk cc = (CraftChunk) c;
  5.                     Field f = net.minecraft.server.v1_9_R1.Chunk.class.getDeclaredField("entityCount");
  6.                     f.setAccessible(true);
  7.                     gnu.trove.map.hash.TObjectIntHashMap<Class<?>> counts = (TObjectIntHashMap<Class<?>>) f.get(cc.getHandle());
  8.  
  9.                     TObjectIntIterator<Class<?>> it = counts.iterator();
  10.                     while (it.hasNext()) {
  11.                         it.advance();
  12.                         Class<?> key = it.key();
  13.                         int value = it.value();
  14.                         if (value != 0) {
  15.                             System.out.println(key + ": " + value);
  16.                         }
  17.                     }
  18.                 }
  19.             }
  20.         } catch (Exception e) {
  21.             e.printStackTrace();
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment