Class Entity
- All Implemented Interfaces:
DataContainer
,EventHandler
,PermissionHandler
,Viewable
- Direct Known Subclasses:
ExperienceOrb
,LivingEntity
,ObjectEntity
public abstract class Entity extends java.lang.Object implements Viewable, EventHandler, DataContainer, PermissionHandler
To create your own entity you probably want to extends ObjectEntity
or EntityCreature
instead.
-
Field Summary
Fields Modifier and Type Field Description protected int
air
protected float
cachePitch
protected float
cacheX
protected float
cacheY
protected float
cacheYaw
protected float
cacheZ
protected boolean
crouched
protected ColoredText
customName
protected boolean
customNameVisible
protected float
eyeHeight
protected boolean
glowing
protected float
gravityDragPerTick
protected Instance
instance
protected boolean
invisible
protected float
lastPitch
protected long
lastVelocityUpdateTime
protected float
lastX
protected float
lastY
protected float
lastYaw
protected float
lastZ
protected static byte
METADATA_BOOLEAN
protected static byte
METADATA_BYTE
protected static byte
METADATA_CHAT
protected static byte
METADATA_FLOAT
protected static byte
METADATA_OPTCHAT
protected static byte
METADATA_PARTICLE
protected static byte
METADATA_POSE
protected static byte
METADATA_POSITION
protected static byte
METADATA_ROTATION
protected static byte
METADATA_SLOT
protected static byte
METADATA_STRING
protected static byte
METADATA_VARINT
protected java.util.concurrent.ConcurrentLinkedQueue<java.util.function.Consumer<Entity>>
nextTick
protected boolean
noGravity
protected boolean
onFire
protected boolean
onGround
protected net.minestom.server.entity.Entity.Pose
pose
protected Position
position
protected boolean
silent
protected boolean
sprinting
protected boolean
swimming
protected boolean
UNUSED_METADATA
protected boolean
usingElytra
protected java.util.UUID
uuid
protected Entity
vehicle
protected Vector
velocity
protected java.util.Set<Player>
viewers
-
Constructor Summary
Constructors Constructor Description Entity(EntityType entityType)
Entity(EntityType entityType, Position spawnPosition)
-
Method Summary
Modifier and Type Method Description void
addPassenger(Entity entity)
Adds a new passenger to this entity.boolean
addViewer(Player player)
Adds a viewer.void
askSynchronization()
Asks for a synchronization (position) to happen during next entity tick.<E extends Event>
voidcallEvent(java.lang.Class<E> eventClass, E event)
Calls the specifiedEvent
with all the assignedEventCallback
.protected void
fillMetadataIndex(BinaryWriter packet, int index)
Used to fill/write a specific metadata index.long
getAliveTicks()
Gets the number of ticks this entity has been active for.java.util.Collection<Permission>
getAllPermissions()
Returns all permissions associated to this command sender.BoundingBox
getBoundingBox()
Is used to check collision with coordinates or other blocks/entities.Chunk
getChunk()
Convenient method to get the entity current chunk.ColoredText
getCustomName()
Gets the entity custom name.Data
getData()
Gets theData
of this container.float
getDistance(Entity entity)
Gets the distance between two entities.static Entity
getEntity(int id)
Gets an entity based on its id (fromgetEntityId()
).int
getEntityId()
Each entity has an unique id (server-wide) which will change after a restart.EntityType
getEntityType()
Returns the entity type.java.util.Map<java.lang.Class<? extends Event>,java.util.Collection<EventCallback>>
getEventCallbacksMap()
Gets aMap
containing all the listeners assigned to a specificEvent
type.float
getEyeHeight()
Gets the entity eye height.Instance
getInstance()
Gets the entity current instance.java.util.function.Consumer<BinaryWriter>
getMetadataConsumer()
Should be override when wanting to add a new metadata indexEntityMetaDataPacket
getMetadataPacket()
Gets anEntityMetaDataPacket
sent when adding viewers.java.util.Set<Entity>
getPassengers()
Gets the entity passengers.protected SetPassengersPacket
getPassengersPacket()
Position
getPosition()
Gets the entity position.java.util.UUID
getUuid()
Gets the entityUUID
.Entity
getVehicle()
Gets the entity vehicle or null.Vector
getVelocity()
Gets the entity current velocity.protected EntityVelocityPacket
getVelocityPacket()
long
getVelocityUpdatePeriod()
Gets the period, in ms, between two velocity update packets.java.util.Set<Player>
getViewers()
Gets all the viewers of this viewable element.protected void
handleVoid()
How does this entity handle being in the void?boolean
hasNoGravity()
Gets the noGravity metadata field.boolean
hasPassenger()
Gets if the entity has any passenger.boolean
hasVelocity()
Gets if the entity currently has a velocity applied.boolean
isActive()
Returns false just after instantiation, set to true after callingsetInstance(Instance)
.boolean
isAutoViewable()
When set to true, the entity will automatically get new viewers when they come too close This can be use to complete control over which player can see it, without having to deal with raw packets.boolean
isCustomNameVisible()
Gets the custom name visible metadata field.boolean
isGlowing()
Gets if the entity is glowing or not.boolean
isInvisible()
Gets if the entity is invisible or not.boolean
isOnFire()
Gets if the entity is on fire.boolean
isOnGround()
boolean
isRemoved()
Gets if this entity has been removed.boolean
isRemoveScheduled()
Gets if the entity removal has been scheduled withscheduleRemove(long, TimeUnit)
.boolean
isSilent()
void
refreshPosition(float x, float y, float z)
Used to refresh the entity and its passengers position - put the entity in the right instance chunk - update the viewable chunks (load and unload) - add/remove players from the viewers list ifisAutoViewable()
is enabledvoid
refreshPosition(Position position)
void
refreshView(float yaw, float pitch)
Updates the entity view internally.void
remove()
Removes the entity from the server immediately.void
removePassenger(Entity entity)
Removes a passenger to this entity.boolean
removeViewer(Player player)
Removes a viewer.boolean
sameChunk(Entity entity)
Gets if the entity is in the same chunk as another.boolean
sameChunk(Position position)
Gets if this entity is in the same chunk as the specified position.void
scheduleNextTick(java.util.function.Consumer<Entity> callback)
Schedules a task to be run during the next entity tick.void
scheduleRemove(long delay, TimeUnit timeUnit)
Triggersremove()
after the specified time.protected void
sendMetadataIndex(int index)
Sends aEntityMetaDataPacket
containing only the specified index The index is wrote usingfillMetadataIndex(BinaryWriter, int)
.protected void
sendSynchronization()
void
sendVelocityPacket()
Equivalent tosendPacketsToViewers(getVelocityPacket());
.void
setAutoViewable(boolean autoViewable)
Makes the entity auto viewable or only manually.void
setBoundingBox(float x, float y, float z)
Changes the internal entity bounding box.void
setCustomName(ColoredText customName)
Changes the entity custom name.void
setCustomNameVisible(boolean customNameVisible)
Changes the internal custom name visible field and send aEntityMetaDataPacket
to update the entity state to its viewers.void
setData(Data data)
Sets theData
of this container.void
setEyeHeight(float eyeHeight)
Changes the entity eye height.void
setGlowing(boolean glowing)
Sets or remove the entity glowing effect.void
setGravity(float gravityDragPerTick)
Changes the gravity of the entity.void
setInstance(Instance instance)
Changes the entity instance.void
setInvisible(boolean invisible)
Changes the internal invisible value and send aEntityMetaDataPacket
to make visible or invisible the entity to its viewers.void
setNoGravity(boolean noGravity)
Changes the noGravity metadata field and change the gravity behaviour accordingly.void
setOnFire(boolean fire)
Sets the entity in fire visually.void
setSilent(boolean silent)
void
setSneaking(boolean sneaking)
Makes the entity sneak.void
setSprinting(boolean sprinting)
Makes the entity sprint.protected void
setUuid(java.util.UUID uuid)
Changes the internal entity UUID, mostly unsafe.void
setVelocity(Vector velocity)
Changes the entity velocity and callsEntityVelocityEvent
.void
setVelocityUpdatePeriod(long velocityUpdatePeriod)
Sets the period, in ms, between two velocity update packets.void
setView(float yaw, float pitch)
Changes the view of the entity.void
setView(Position position)
Changes the view of the entity.protected boolean
shouldRemove()
protected boolean
shouldSendVelocityUpdate(long time)
Checks if now is a good time to send a velocity update packet.abstract void
spawn()
Called when a new instance is set.void
teleport(Position position)
void
teleport(Position position, java.lang.Runnable callback)
Teleports the entity only if the chunk atposition
is loaded or ifInstance.hasEnabledAutoChunkLoad()
returns true.void
tick(long time)
Updates the entity, called every tick.void
triggerStatus(byte status)
Entity statuses can be found here.abstract void
update(long time)
Called each tick.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.handler.EventHandler
addEventCallback, callCancellableEvent, getEventCallbacks, getEventCallbacks, removeEventCallback
Methods inherited from interface net.minestom.server.permission.PermissionHandler
addPermission, hasPermission, hasPermission, hasPermission, hasPermission, removePermission
Methods inherited from interface net.minestom.server.Viewable
isViewer, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Field Details
-
METADATA_BYTE
protected static final byte METADATA_BYTE- See Also:
- Constant Field Values
-
METADATA_VARINT
protected static final byte METADATA_VARINT- See Also:
- Constant Field Values
-
METADATA_FLOAT
protected static final byte METADATA_FLOAT- See Also:
- Constant Field Values
-
METADATA_STRING
protected static final byte METADATA_STRING- See Also:
- Constant Field Values
-
METADATA_CHAT
protected static final byte METADATA_CHAT- See Also:
- Constant Field Values
-
METADATA_OPTCHAT
protected static final byte METADATA_OPTCHAT- See Also:
- Constant Field Values
-
METADATA_SLOT
protected static final byte METADATA_SLOT- See Also:
- Constant Field Values
-
METADATA_BOOLEAN
protected static final byte METADATA_BOOLEAN- See Also:
- Constant Field Values
-
METADATA_ROTATION
protected static final byte METADATA_ROTATION- See Also:
- Constant Field Values
-
METADATA_POSITION
protected static final byte METADATA_POSITION- See Also:
- Constant Field Values
-
METADATA_PARTICLE
protected static final byte METADATA_PARTICLE- See Also:
- Constant Field Values
-
METADATA_POSE
protected static final byte METADATA_POSE- See Also:
- Constant Field Values
-
instance
-
position
-
lastX
protected float lastX -
lastY
protected float lastY -
lastZ
protected float lastZ -
cacheX
protected float cacheX -
cacheY
protected float cacheY -
cacheZ
protected float cacheZ -
lastYaw
protected float lastYaw -
lastPitch
protected float lastPitch -
cacheYaw
protected float cacheYaw -
cachePitch
protected float cachePitch -
onGround
protected boolean onGround -
vehicle
-
velocity
-
lastVelocityUpdateTime
protected long lastVelocityUpdateTime -
gravityDragPerTick
protected float gravityDragPerTick -
eyeHeight
protected float eyeHeight -
viewers
-
uuid
protected java.util.UUID uuid -
onFire
protected boolean onFire -
crouched
protected boolean crouched -
UNUSED_METADATA
protected boolean UNUSED_METADATA -
sprinting
protected boolean sprinting -
swimming
protected boolean swimming -
invisible
protected boolean invisible -
glowing
protected boolean glowing -
usingElytra
protected boolean usingElytra -
air
protected int air -
customName
-
customNameVisible
protected boolean customNameVisible -
silent
protected boolean silent -
noGravity
protected boolean noGravity -
pose
protected net.minestom.server.entity.Entity.Pose pose -
nextTick
protected final java.util.concurrent.ConcurrentLinkedQueue<java.util.function.Consumer<Entity>> nextTick
-
-
Constructor Details
-
Method Details
-
scheduleNextTick
Schedules a task to be run during the next entity tick. It ensures that the task will be executed in the same thread as the entity (depending of theThreadProvider
).- Parameters:
callback
- the task to execute during the next entity tick
-
getEntity
Gets an entity based on its id (fromgetEntityId()
).Entity id are unique server-wide.
- Parameters:
id
- the entity unique id- Returns:
- the entity having the specified id, null if not found
-
update
public abstract void update(long time)Called each tick.- Parameters:
time
- time of the update in milliseconds
-
spawn
public abstract void spawn()Called when a new instance is set. -
isOnGround
public boolean isOnGround() -
shouldSendVelocityUpdate
protected boolean shouldSendVelocityUpdate(long time)Checks if now is a good time to send a velocity update packet.- Parameters:
time
- the current time in milliseconds- Returns:
- true if the velocity update packet should be send
-
getVelocityUpdatePeriod
public long getVelocityUpdatePeriod()Gets the period, in ms, between two velocity update packets.- Returns:
- period, in ms, between two velocity update packets
-
setVelocityUpdatePeriod
public void setVelocityUpdatePeriod(long velocityUpdatePeriod)Sets the period, in ms, between two velocity update packets.- Parameters:
velocityUpdatePeriod
- period, in ms, between two velocity update packets
-
teleport
Teleports the entity only if the chunk atposition
is loaded or ifInstance.hasEnabledAutoChunkLoad()
returns true.- Parameters:
position
- the teleport positioncallback
- the optional callback executed, even if auto chunk is not enabled
-
teleport
-
setView
public void setView(float yaw, float pitch)Changes the view of the entity.- Parameters:
yaw
- the new yawpitch
- the new pitch
-
setView
Changes the view of the entity. Only the yaw and pitch are used.- Parameters:
position
- the new view
-
isAutoViewable
public boolean isAutoViewable()When set to true, the entity will automatically get new viewers when they come too close This can be use to complete control over which player can see it, without having to deal with raw packets.True by default for all entities. When set to false, it is important to mention that the players will not be removed automatically from its viewers list, you would have to do that manually when being too far.
- Returns:
- true if the entity is automatically viewable for close players, false otherwise
-
setAutoViewable
public void setAutoViewable(boolean autoViewable)Makes the entity auto viewable or only manually.- Parameters:
autoViewable
- should the entity be automatically viewable for close players- See Also:
isAutoViewable()
-
addViewer
Description copied from interface:Viewable
Adds a viewer. -
removeViewer
Description copied from interface:Viewable
Removes a viewer.- Specified by:
removeViewer
in interfaceViewable
- Parameters:
player
- the viewer to remove- Returns:
- true if the player has been removed, false otherwise (could be because he was not a viewer)
-
getViewers
Description copied from interface:Viewable
Gets all the viewers of this viewable element.- Specified by:
getViewers
in interfaceViewable
- Returns:
- A Set containing all the element's viewers
-
getData
Description copied from interface:DataContainer
Gets theData
of this container.A
DataContainer
data is always optional, meaning that this will be null if no data has been defined.- Specified by:
getData
in interfaceDataContainer
- Returns:
- the
Data
of this container, can be null
-
setData
Description copied from interface:DataContainer
Sets theData
of this container.Default implementations are
DataImpl
andSerializableDataImpl
depending on your use-case.- Specified by:
setData
in interfaceDataContainer
- Parameters:
data
- the newData
of this container, null to remove it
-
getAllPermissions
Description copied from interface:PermissionHandler
Returns all permissions associated to this command sender. The returned collection should be modified only by subclasses.- Specified by:
getAllPermissions
in interfacePermissionHandler
- Returns:
- the permissions of this command sender.
-
tick
public void tick(long time)Updates the entity, called every tick.Ignored if
getInstance()
returns null.- Parameters:
time
- the update time in milliseconds
-
sendVelocityPacket
public void sendVelocityPacket()Equivalent tosendPacketsToViewers(getVelocityPacket());
. -
getAliveTicks
public long getAliveTicks()Gets the number of ticks this entity has been active for.- Returns:
- the number of ticks this entity has been active for
-
handleVoid
protected void handleVoid()How does this entity handle being in the void? -
getEventCallbacksMap
@NotNull public java.util.Map<java.lang.Class<? extends Event>,java.util.Collection<EventCallback>> getEventCallbacksMap()Description copied from interface:EventHandler
Gets aMap
containing all the listeners assigned to a specificEvent
type.- Specified by:
getEventCallbacksMap
in interfaceEventHandler
- Returns:
- a
Map
with all the listeners
-
callEvent
Description copied from interface:EventHandler
Calls the specifiedEvent
with all the assignedEventCallback
.Events are always called in the current thread.
- Specified by:
callEvent
in interfaceEventHandler
- Type Parameters:
E
- the event type- Parameters:
eventClass
- the event classevent
- the event object
-
getEntityId
public int getEntityId()Each entity has an unique id (server-wide) which will change after a restart.- Returns:
- the unique entity id
- See Also:
to retrive an entity based on its id
-
getEntityType
Returns the entity type.- Returns:
- the entity type
-
getUuid
@NotNull public java.util.UUID getUuid()Gets the entityUUID
.- Returns:
- the entity unique id
-
setUuid
protected void setUuid(@NotNull java.util.UUID uuid)Changes the internal entity UUID, mostly unsafe.- Parameters:
uuid
- the new entity uuid
-
isActive
public boolean isActive()Returns false just after instantiation, set to true after callingsetInstance(Instance)
.- Returns:
- true if the entity has been linked to an instance, false otherwise
-
getBoundingBox
Is used to check collision with coordinates or other blocks/entities.- Returns:
- the entity bounding box
-
setBoundingBox
public void setBoundingBox(float x, float y, float z)Changes the internal entity bounding box.WARNING: this does not change the entity hit-box which is client-side.
- Parameters:
x
- the bounding box X sizey
- the bounding box Y sizez
- the bounding box Z size
-
getChunk
Convenient method to get the entity current chunk.- Returns:
- the entity chunk, can be null even if unlikely
-
getInstance
Gets the entity current instance.- Returns:
- the entity instance, can be null if the entity doesn't have an instance yet
-
setInstance
Changes the entity instance.- Parameters:
instance
- the new instance of the entity- Throws:
java.lang.NullPointerException
- ifinstance
is nulljava.lang.IllegalStateException
- ifinstance
has not been registered inInstanceManager
-
getVelocity
Gets the entity current velocity.- Returns:
- the entity current velocity
-
setVelocity
Changes the entity velocity and callsEntityVelocityEvent
.The final velocity can be cancelled or modified by the event.
- Parameters:
velocity
- the new entity velocity
-
hasVelocity
public boolean hasVelocity()Gets if the entity currently has a velocity applied.- Returns:
- true if velocity is not set to 0
-
setGravity
public void setGravity(float gravityDragPerTick)Changes the gravity of the entity.- Parameters:
gravityDragPerTick
- the gravity drag per tick
-
getDistance
Gets the distance between two entities.- Parameters:
entity
- the entity to get the distance from- Returns:
- the distance between this and
entity
-
getVehicle
Gets the entity vehicle or null.- Returns:
- the entity vehicle, or null if there is not any
-
addPassenger
Adds a new passenger to this entity.- Parameters:
entity
- the new passenger- Throws:
java.lang.NullPointerException
- ifentity
is nulljava.lang.IllegalStateException
- ifgetInstance()
returns null
-
removePassenger
Removes a passenger to this entity.- Parameters:
entity
- the passenger to remove- Throws:
java.lang.NullPointerException
- ifentity
is nulljava.lang.IllegalStateException
- ifgetInstance()
returns null
-
hasPassenger
public boolean hasPassenger()Gets if the entity has any passenger.- Returns:
- true if the entity has any passenger, false otherwise
-
getPassengers
Gets the entity passengers.- Returns:
- an unmodifiable list containing all the entity passengers
-
getPassengersPacket
-
triggerStatus
public void triggerStatus(byte status)Entity statuses can be found here.- Parameters:
status
- the status to trigger
-
isOnFire
public boolean isOnFire()Gets if the entity is on fire.- Returns:
- true if the entity is in fire, false otherwise
-
setOnFire
public void setOnFire(boolean fire)Sets the entity in fire visually.WARNING: if you want to apply damage or specify a duration, see
LivingEntity.setFireForDuration(int, TimeUnit)
.- Parameters:
fire
- should the entity be set in fire
-
isInvisible
public boolean isInvisible()Gets if the entity is invisible or not.- Returns:
- true if the entity is invisible, false otherwise
-
setInvisible
public void setInvisible(boolean invisible)Changes the internal invisible value and send aEntityMetaDataPacket
to make visible or invisible the entity to its viewers.- Parameters:
invisible
- true to set the entity invisible, false otherwise
-
isGlowing
public boolean isGlowing()Gets if the entity is glowing or not.- Returns:
- true if the entity is glowing, false otherwise
-
setGlowing
public void setGlowing(boolean glowing)Sets or remove the entity glowing effect.- Parameters:
glowing
- true to make the entity glows, false otherwise
-
getCustomName
Gets the entity custom name.- Returns:
- the custom name of the entity, null if there is not
-
setCustomName
Changes the entity custom name.- Parameters:
customName
- the custom name of the entity, null to remove it
-
isCustomNameVisible
public boolean isCustomNameVisible()Gets the custom name visible metadata field.- Returns:
- true if the custom name is visible, false otherwise
-
setCustomNameVisible
public void setCustomNameVisible(boolean customNameVisible)Changes the internal custom name visible field and send aEntityMetaDataPacket
to update the entity state to its viewers.- Parameters:
customNameVisible
- true to make the custom name visible, false otherwise
-
isSilent
public boolean isSilent() -
setSilent
public void setSilent(boolean silent) -
setNoGravity
public void setNoGravity(boolean noGravity)Changes the noGravity metadata field and change the gravity behaviour accordingly.- Parameters:
noGravity
- should the entity ignore gravity
-
hasNoGravity
public boolean hasNoGravity()Gets the noGravity metadata field.- Returns:
- true if the entity ignore gravity, false otherwise
-
refreshPosition
public void refreshPosition(float x, float y, float z)Used to refresh the entity and its passengers position - put the entity in the right instance chunk - update the viewable chunks (load and unload) - add/remove players from the viewers list ifisAutoViewable()
is enabledWARNING: unsafe, should only be used internally in Minestom. Use
teleport(Position)
instead.- Parameters:
x
- new position Xy
- new position Yz
- new position Z
-
refreshPosition
- Parameters:
position
- the new position- See Also:
refreshPosition(float, float, float)
-
refreshView
public void refreshView(float yaw, float pitch)Updates the entity view internally.Warning: you probably want to use
setView(float, float)
.- Parameters:
yaw
- the yawpitch
- the pitch
-
setSneaking
public void setSneaking(boolean sneaking)Makes the entity sneak.WARNING: this will not work for the client itself.
- Parameters:
sneaking
- true to make the entity sneak
-
setSprinting
public void setSprinting(boolean sprinting)Makes the entity sprint.WARNING: this will not work on the client itself.
- Parameters:
sprinting
- true to make the entity sprint
-
getPosition
Gets the entity position.- Returns:
- the current position of the entity
-
getEyeHeight
public float getEyeHeight()Gets the entity eye height.- Returns:
- the entity eye height
-
setEyeHeight
public void setEyeHeight(float eyeHeight)Changes the entity eye height.- Parameters:
eyeHeight
- the entity eye height
-
sameChunk
Gets if this entity is in the same chunk as the specified position.- Parameters:
position
- the checked position chunk- Returns:
- true if the entity is in the same chunk as
position
-
sameChunk
Gets if the entity is in the same chunk as another.- Parameters:
entity
- the entity to check- Returns:
- true if both entities are in the same chunk, false otherwise
-
remove
public void remove()Removes the entity from the server immediately.WARNING: this do not trigger the
EntityDeathEvent
event. -
isRemoved
public boolean isRemoved()Gets if this entity has been removed.- Returns:
- true if this entity is removed
-
scheduleRemove
Triggersremove()
after the specified time.- Parameters:
delay
- the time before removing the entitytimeUnit
- the unit of the delay
-
isRemoveScheduled
public boolean isRemoveScheduled()Gets if the entity removal has been scheduled withscheduleRemove(long, TimeUnit)
.- Returns:
- true if the entity removal has been scheduled
-
getVelocityPacket
-
getMetadataPacket
Gets anEntityMetaDataPacket
sent when adding viewers. Used for synchronization.- Returns:
- The
EntityMetaDataPacket
related to this entity
-
getMetadataConsumer
Should be override when wanting to add a new metadata index- Returns:
- The consumer used to write
EntityMetaDataPacket
ingetMetadataPacket()
-
sendMetadataIndex
protected void sendMetadataIndex(int index)Sends aEntityMetaDataPacket
containing only the specified index The index is wrote usingfillMetadataIndex(BinaryWriter, int)
.- Parameters:
index
- the metadata index
-
fillMetadataIndex
Used to fill/write a specific metadata index. The proper use to add a new metadata index is to override this and add your case. Then you can also overridegetMetadataConsumer()
and fill your newly added index.- Parameters:
packet
- the packet writerindex
- the index to fill/write
-
sendSynchronization
protected void sendSynchronization() -
askSynchronization
public void askSynchronization()Asks for a synchronization (position) to happen during next entity tick. -
shouldRemove
protected boolean shouldRemove()
-