public class PlayerManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
PlayerManager.PlayerInstance |
Modifier and Type | Field and Description |
---|---|
private java.util.List<PlayerManager.PlayerInstance> |
playerInstanceList |
private LongHashMap<PlayerManager.PlayerInstance> |
playerInstances |
private java.util.List<PlayerManager.PlayerInstance> |
playerInstancesToUpdate |
private java.util.List<EntityPlayerMP> |
players |
private int |
playerViewRadius
Number of chunks the server sends to the client.
|
private static org.apache.logging.log4j.Logger |
pmLogger |
private long |
previousTotalWorldTime
time what is using to check if InhabitedTime should be calculated
|
private WorldServer |
theWorldServer |
private int[][] |
xzDirectionsConst
x, z direction vectors: east, south, west, north
|
Constructor and Description |
---|
PlayerManager(WorldServer serverWorld) |
Modifier and Type | Method and Description |
---|---|
void |
addPlayer(EntityPlayerMP player)
Adds an EntityPlayerMP to the PlayerManager and to all player instances within player visibility
|
void |
filterChunkLoadQueue(EntityPlayerMP player)
Removes all chunks from the given player's chunk load queue that are not in viewing range of the player.
|
static int |
getFurthestViewableBlock(int distance)
Get the furthest viewable block given player's view distance
|
private PlayerManager.PlayerInstance |
getPlayerInstance(int chunkX,
int chunkZ,
boolean createIfAbsent)
passi n the chunk x and y and a flag as to whether or not the instance should be made if it doesnt exist
|
WorldServer |
getWorldServer()
Returns the WorldServer associated with this PlayerManager
|
boolean |
hasPlayerInstance(int chunkX,
int chunkZ) |
boolean |
isPlayerWatchingChunk(EntityPlayerMP player,
int chunkX,
int chunkZ) |
void |
markBlockForUpdate(BlockPos pos) |
private boolean |
overlaps(int x1,
int z1,
int x2,
int z2,
int radius)
Determine if two rectangles centered at the given points overlap for the provided radius.
|
void |
removePlayer(EntityPlayerMP player)
Removes an EntityPlayerMP from the PlayerManager.
|
void |
setPlayerViewRadius(int radius) |
void |
updateMountedMovingPlayer(EntityPlayerMP player)
update chunks around a player being moved by server logic (e.g.
|
void |
updatePlayerInstances()
updates all the player instances that need to be updated
|
private static final org.apache.logging.log4j.Logger pmLogger
private final WorldServer theWorldServer
private final java.util.List<EntityPlayerMP> players
private final LongHashMap<PlayerManager.PlayerInstance> playerInstances
private final java.util.List<PlayerManager.PlayerInstance> playerInstancesToUpdate
private final java.util.List<PlayerManager.PlayerInstance> playerInstanceList
private int playerViewRadius
private long previousTotalWorldTime
private final int[][] xzDirectionsConst
public PlayerManager(WorldServer serverWorld)
public WorldServer getWorldServer()
public void updatePlayerInstances()
public boolean hasPlayerInstance(int chunkX, int chunkZ)
private PlayerManager.PlayerInstance getPlayerInstance(int chunkX, int chunkZ, boolean createIfAbsent)
public void markBlockForUpdate(BlockPos pos)
public void addPlayer(EntityPlayerMP player)
public void filterChunkLoadQueue(EntityPlayerMP player)
public void removePlayer(EntityPlayerMP player)
private boolean overlaps(int x1, int z1, int x2, int z2, int radius)
public void updateMountedMovingPlayer(EntityPlayerMP player)
public boolean isPlayerWatchingChunk(EntityPlayerMP player, int chunkX, int chunkZ)
public void setPlayerViewRadius(int radius)
public static int getFurthestViewableBlock(int distance)