Interface EntityTracker
public interface EntityTracker
-
Method Summary
Modifier and TypeMethodDescriptionaddEntity(int id, EntityType type) Tracks an entity.voidaddRegistryKeys(String registryKey, KeyMappings mappings) intbooleanReturns whether the client player has the "insta build" ability, usually from creative mode.chunkType(boolean mapped) Returns the cached chunk type for the current dimension if set.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 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.@Nullable KeyMappingsregistryKeys(String registryKey) @Nullable TrackedEntityremoveEntity(int id) Untracks an entity.voidsetBiomesSent(int biomesSent) voidsetChunkType(boolean mapped, @Nullable Type<Chunk> chunkType) Caches the chunk type for the current dimension.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- Returns:
- tracked entity
-
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
Untracks an entity.- Parameters:
id- entity id- Returns:
- previously tracked entity
-
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. -
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) -
chunkType
Returns the cached chunk type for the current dimension if set.- Parameters:
mapped- whether to return the mapped chunk type- Returns:
- cached chunk type
-
setChunkType
Caches the chunk type for the current dimension.Invalidates when the world section height or the number of biomes change.
- Parameters:
mapped- whether to set the mapped chunk typechunkType- chunk type
-
playerType
EntityType playerType() -
dimensionData
-
dimensionData
-
setDimensions
-
registryKeys
-
addRegistryKeys
-