Interface EntityTracker
public interface EntityTracker
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntity(int id, EntityType type) Tracks an entity.intbooleanReturns whether the client player has the "insta build" ability, usually from creative mode.voidclear()Clears all stored data, including entity types, entity data and client entity id.voidClears stored entity types and data, only leaving behind the client entity.intReturns the client entity id.intReturns the id of the current dimension, or -1 if unset (i.e.intReturns the minimum y of the current player world.@Nullable StringReturns the name of the world the player is currently in.intReturns the current world section height (block height / 16).@Nullable DimensionDatadimensionData(int dimensionId) @Nullable DimensionDatadimensionData(String dimension) @Nullable TrackedEntityentity(int entityId) Returns the tracked entity for the given entity id if present.@Nullable StoredEntityDataentityData(int id) Returns the stored entity data if an entity with the id is tracked, else null.@Nullable StoredEntityDataentityDataIfPresent(int id) Returns stored entity data if it has previously been initialized byentityData(int), else null.@Nullable EntityTypeentityType(int id) Entity type of the entity if tracked.booleanReturns whether the client entity id has been set.booleanhasEntity(int id) Returns whether the entity is currently tracked.voidremoveEntity(int id) Untracks an entity.voidsetBiomesSent(int biomesSent) voidsetClientEntityId(int clientEntityId) Sets the client entity id.voidsetCurrentDimensionId(int currentDimensionId) Sets the id of the current dimension.voidsetCurrentMinY(int currentMinY) Sets the minimum y of the current player world.voidsetCurrentWorld(String currentWorld) Sets the name of the world the player is currently in.voidsetCurrentWorldSectionHeight(int currentWorldSectionHeight) Sets the current world section height.voidsetDimensions(Map<String, DimensionData> dimensions) voidsetInstaBuild(boolean instaBuild) Sets whether the client player has the "insta build" ability, usually from creative mode.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. -
clear
void clear()Clears all stored data, including entity types, entity data and client entity id. -
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
-
canInstaBuild
boolean canInstaBuild()Returns whether the client player has the "insta build" ability, usually from creative mode.- Returns:
- whether the client player can insta build
-
setInstaBuild
void setInstaBuild(boolean instaBuild) Sets whether the client player has the "insta build" ability, usually from creative mode.- Parameters:
instaBuild- whether the client player can insta build
-
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
-
currentDimensionId
int currentDimensionId()Returns the id of the current dimension, or -1 if unset (i.e. before 1.20.5).- Returns:
- id of the current dimension, or -1 if unset
-
setCurrentDimensionId
void setCurrentDimensionId(int currentDimensionId) Sets the id of the current dimension.- Parameters:
currentDimensionId- id of the current dimension
-
biomesSent
int biomesSent() -
setBiomesSent
void setBiomesSent(int biomesSent) -
playerType
EntityType playerType() -
dimensionData
-
dimensionData
-
setDimensions
-