@PossiblyThreadSafe public class TridentEntity extends Object implements Entity
Modifier and Type | Field and Description |
---|---|
protected AtomicLong |
airTicks
How many ticks of air the entity has left
|
protected BoundingBox |
boundingBox
TODO
|
protected static AtomicInteger |
counter |
protected String |
displayName
The name of the entity appearing above the head
|
protected SelectableThreadPool |
executor
Entity task executor
|
protected com.google.common.util.concurrent.AtomicDouble |
fallDistance
The distance the entity has fallen
|
protected AtomicInteger |
fireTicks
How long the entity has been on fire
|
protected boolean |
godMode
true to indicate the entity cannot be damaged |
static EntityHandler |
HANDLER
Internal entity tracker, used to spawn the entity and track movement, etc.
|
protected float |
height
TODO
|
protected int |
id
The entity ID for the entity
|
protected Position |
loc
The entity location
|
protected boolean |
nameVisible
Whether or not the name of the entity is visible
|
protected boolean |
onGround
Whether or not the entity is touching the ground
|
protected Entity |
passenger
The entity's passenger, if there are any
|
protected AtomicInteger |
portalCooldown
Length of time the entity must wait to enter a portal.
|
protected boolean |
silent
TODO
|
protected AtomicLong |
ticksExisted
The ticks that have passed since the entity was spawned, and alive
|
protected UUID |
uniqueId
The identifier UUID for the entity
|
protected Vector |
velocity
The movement vector for the entity
|
protected float |
width
TODO
|
Modifier | Constructor and Description |
---|---|
protected |
TridentEntity()
Deprecated.
|
|
TridentEntity(UUID uniqueId,
Position spawnLocation)
Creates a new entity
|
Modifier and Type | Method and Description |
---|---|
void |
applyProperties(EntityProperties properties)
Sets the properties of this entity to the specified properties
|
CompoundTag |
asNbt() |
BoundingBox |
boundingBox()
Returns the bounding box of the entity
|
String |
displayName()
Gets the display name for the entity, used on inventories and deaths
|
protected void |
doEncodeMeta(ProtocolMetadata protocolMeta) |
protected void |
doLoad(CompoundTag tag) |
protected void |
doRemove() |
protected void |
doTick() |
void |
eject()
Removes the mounted entity, if there are any
|
protected void |
encodeMetadata(ProtocolMetadata protocolMeta) |
int |
entityId()
The identifier for this entity for runtime, see uniqueId for a set id of the entity
|
boolean |
isNameVisible()
Gets if the entity's display name visible
|
boolean |
isSilent()
Gets if the entity is silent (sounds)
|
void |
load(CompoundTag tag) |
boolean |
onGround()
Checks if the entity is currently on the ground, or at least touching the ground
|
Entity |
passenger()
Gets the entity that is riding this entity, if there is any
|
Position |
position()
The position of the entity with respect to the coordinate grid
|
void |
remove()
Removes the entity from the world and destroys it, freeing all memory associated with it
|
void |
setDisplayName(String name)
Sets the entity's display name, effects inventories (if applicable) and death messages
|
void |
setOnGround(boolean onGround) |
void |
setPassenger(Entity entity)
Mounts the specified entity on this entity
|
void |
setPosition(Position loc) |
void |
setSize(float width,
float height)
Set the width and height of the entity
|
void |
setVelocity(Vector vector)
Sets the entity's movement direction and speed to the magnitude of the vector
|
TridentEntity |
spawn()
Begin entity management
|
void |
teleport(double x,
double y,
double z)
Moves the entity to the specified position
|
void |
teleport(Entity entity)
Moves the current entity to the provided entity's position
|
void |
teleport(Position location)
Moves the entity to the coordinates specified by the position object passed in
|
void |
tick() |
EntityType |
type()
Gets the type of entity
|
UUID |
uniqueId()
The unique id for the entity to the server
|
Vector |
velocity()
The direction and movement magnitude of the entity
|
Set<Entity> |
withinRange(double radius)
Gets the entities that are within proximity to this entity
|
World |
world()
The world which the entity resides in
|
@InternalUseOnly protected static final AtomicInteger counter
public static final EntityHandler HANDLER
protected final com.google.common.util.concurrent.AtomicDouble fallDistance
protected final AtomicLong ticksExisted
protected final AtomicInteger fireTicks
protected final AtomicLong airTicks
protected final AtomicInteger portalCooldown
protected volatile int id
protected volatile SelectableThreadPool executor
protected volatile boolean onGround
protected volatile String displayName
protected volatile boolean nameVisible
protected volatile boolean silent
protected volatile boolean godMode
true
to indicate the entity cannot be damagedprotected volatile BoundingBox boundingBox
protected volatile float width
protected volatile float height
public TridentEntity(UUID uniqueId, Position spawnLocation)
uniqueId
- the UUID of the entityspawnLocation
- the location which the entity is to be spawned@Deprecated protected TridentEntity()
protected void doTick()
protected void doRemove()
protected void doEncodeMeta(ProtocolMetadata protocolMeta)
protected void doLoad(CompoundTag tag)
public TridentEntity spawn()
protected void encodeMetadata(ProtocolMetadata protocolMeta)
public void teleport(double x, double y, double z)
Entity
public void teleport(Entity entity)
Entity
public void teleport(Position location)
Entity
public World world()
Entity
public Position position()
Entity
public void setPosition(Position loc)
public Vector velocity()
Entity
public void setVelocity(Vector vector)
Entity
setVelocity
in interface Entity
vector
- the vector to set the entity velocity topublic String displayName()
Entity
displayName
in interface Entity
public void setDisplayName(String name)
Entity
setDisplayName
in interface Entity
name
- Entity namepublic boolean isSilent()
Entity
public UUID uniqueId()
Entity
public void tick()
public boolean onGround()
Entity
public void setOnGround(boolean onGround)
public Set<Entity> withinRange(double radius)
Entity
withinRange
in interface Entity
radius
- the spherical radius to look for entities aroundpublic int entityId()
Entity
entityId
in interface Entity
Entity.uniqueId()
public void remove()
Entity
public Entity passenger()
Entity
public void setPassenger(Entity entity)
Entity
setPassenger
in interface Entity
entity
- the entity to set passenger to this entitypublic void eject()
Entity
public EntityType type()
Entity
public boolean isNameVisible()
Entity
isNameVisible
in interface Entity
public void applyProperties(EntityProperties properties)
Entity
applyProperties
in interface Entity
properties
- the properties to setpublic void load(CompoundTag tag)
public CompoundTag asNbt()
public void setSize(float width, float height)
Entity
public BoundingBox boundingBox()
Entity
boundingBox
in interface Entity
Copyright © 2016. All rights reserved.