Interface EntityTracker
public interface EntityTracker
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntity
(int id, EntityType type) Tracks an entity.int
void
Clears stored entity types and data, only leaving behind the client entity.int
Returns the client entity id.int
Returns the minimum y of the current player world.@Nullable String
Returns the name of the world the player is currently in.int
Returns the current world section height (block height / 16).@Nullable DimensionData
dimensionData
(int dimensionId) @Nullable DimensionData
dimensionData
(String dimension) @Nullable TrackedEntity
entity
(int entityId) Returns the tracked entity for the given entity id if present.@Nullable StoredEntityData
entityData
(int id) Returns the stored entity data if an entity with the id is tracked, else null.@Nullable StoredEntityData
entityDataIfPresent
(int id) Returns stored entity data if it has previously been initialized byentityData(int)
, else null.@Nullable EntityType
entityType
(int id) Entity type of the entity if tracked.boolean
Returns whether the client entity id has been set.boolean
hasEntity
(int id) Returns whether the entity is currently tracked.void
removeEntity
(int id) Untracks an entity.void
setBiomesSent
(int biomesSent) void
setClientEntityId
(int clientEntityId) Sets the client entity id.void
setCurrentMinY
(int currentMinY) Sets the minimum y of the current player world.void
setCurrentWorld
(String currentWorld) Sets the name of the world the player is currently in.void
setCurrentWorldSectionHeight
(int currentWorldSectionHeight) Sets the current world section height.void
setDimensions
(Map<String, DimensionData> dimensions) user()
Deprecated.
-
Method Details
-
user
Deprecated.User connection the tracker belongs to.- Returns:
- user connection
-
addEntity
Tracks an entity.- Parameters:
id
- entity idtype
- entity type
-
hasEntity
boolean hasEntity(int id) Returns whether the entity is currently tracked.- Parameters:
id
- entity id- Returns:
- whether the entity is tracked
-
entity
Returns the tracked entity for the given entity id if present.- Parameters:
entityId
- entity id- Returns:
- tracked entity if tracked
-
entityType
Entity type of the entity if tracked. This returning null does not necessarily mean no entity by the id exists.- Parameters:
id
- entity id- Returns:
- entity type of the entity if tracked
-
removeEntity
void removeEntity(int id) Untracks an entity.- Parameters:
id
- entity id
-
clearEntities
void clearEntities()Clears stored entity types and data, only leaving behind the client entity. -
entityData
Returns the stored entity data if an entity with the id is tracked, else null. If no data has been initialized yet, it will be done and returned by this method.- Parameters:
id
- entity id- Returns:
- stored entity data if an entity with the id is tracked, else null
- Throws:
IllegalArgumentException
- if entity data storage has not been enabled via the implementation
-
entityDataIfPresent
Returns stored entity data if it has previously been initialized byentityData(int)
, else null.- Parameters:
id
- entity id- Returns:
- stored entity data if it has previously been initialized by
entityData(int)
- Throws:
IllegalArgumentException
- if entity data storage has not been enabled via the implementation
-
hasClientEntityId
boolean hasClientEntityId()Returns whether the client entity id has been set.- Returns:
- whether the client entity id has been set
-
clientEntityId
Returns the client entity id. Should be wrapped aroundhasClientEntityId()
.- Returns:
- client entity id
- Throws:
IllegalStateException
- if the client entity id has not been set
-
setClientEntityId
void setClientEntityId(int clientEntityId) Sets the client entity id.- Parameters:
clientEntityId
- client entity id
-
currentWorldSectionHeight
int currentWorldSectionHeight()Returns the current world section height (block height / 16). This is always 16 for sub 1.17 worlds.- Returns:
- current world section height
-
setCurrentWorldSectionHeight
void setCurrentWorldSectionHeight(int currentWorldSectionHeight) Sets the current world section height.- Parameters:
currentWorldSectionHeight
- world section height
-
currentMinY
int currentMinY()Returns the minimum y of the current player world.- Returns:
- minimum y of the current world
-
setCurrentMinY
void setCurrentMinY(int currentMinY) Sets the minimum y of the current player world.- Parameters:
currentMinY
- minimum y of the current world
-
currentWorld
@Nullable String currentWorld()Returns the name of the world the player is currently in.- Returns:
- world name of the current world
-
setCurrentWorld
Sets the name of the world the player is currently in.- Parameters:
currentWorld
- name of the current world
-
biomesSent
int biomesSent() -
setBiomesSent
void setBiomesSent(int biomesSent) -
playerType
EntityType playerType() -
dimensionData
-
dimensionData
-
setDimensions
-