Files
Opis/mcp/mobius/opis/data/ChunkData.java
T
ProfMobius e676b8dc23 Added tick & player handlers to the server to keep track of players and send updates when required.
Client can request a chunk status update (Packet0x02)
OverlayLoadedchunk is now a singleton and will send a request packet when activated.
Player status is saved in the server proxy.
ChunkData is a "static" class to gather chunk related data (loaded chunks for now).
2013-10-28 00:13:05 +01:00

27 lines
818 B
Java

package mcp.mobius.opis.data;
import java.util.HashMap;
import java.util.Set;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
public class ChunkData {
public static HashMap<ChunkCoordIntPair, Boolean> getLoadedChunks(int dimension){
HashMap<ChunkCoordIntPair, Boolean> chunkStatus = new HashMap<ChunkCoordIntPair, Boolean>();
WorldServer world = DimensionManager.getWorld(dimension);
if (world != null)
{
Set<ChunkCoordIntPair> persistantChunks = world.getPersistentChunks().keySet();
Set<ChunkCoordIntPair> chunks = (Set<ChunkCoordIntPair>)world.activeChunkSet;
for (ChunkCoordIntPair chunk : chunks){
chunkStatus.put(chunk, persistantChunks.contains(chunk));
}
}
return chunkStatus;
}
}