Package org.geysermc.geyser.entity.type
Class LivingEntity
java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
- Direct Known Subclasses:
ArmorStandEntity,MobEntity,PlayerEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected com.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected com.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected floatprotected com.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected com.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected floatprotected com.nukkitx.protocol.bedrock.data.inventory.ItemData -
Constructor Summary
ConstructorsConstructorDescriptionLivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f motion, float yaw, float pitch, float headYaw) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.nukkitx.protocol.bedrock.data.AttributeDatacalculateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type)Calculates the complete attribute value to send to Bedrock.protected com.nukkitx.protocol.bedrock.data.AttributeDataprotected voidCalled on entity spawn.protected booleanIf true, the entity should be shaking on the client's end.com.nukkitx.math.vector.Vector3isetBedPosition(com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata<Optional<com.github.steveice10.mc.protocol.data.game.entity.metadata.Position>,?> entityMetadata)protected voidsetDimensions(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose)Set the height and width of the entity's bounding boxfloatsetFreezing(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata entityMetadata)Set a float from 0-1 - how strong the "frozen" overlay should be on screen.voidsetHealth(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata)voidsetLivingEntityFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)voidupdateArmor(GeyserSession session)protected voidupdateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, List<com.nukkitx.protocol.bedrock.data.AttributeData> newAttributes)Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attributevoidupdateBedrockAttributes(GeyserSession session, List<com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute> attributes)Attributes are properties of an entity that are generally more runtime-based instead of permanent properties.voidupdateMainHand(GeyserSession session)voidupdateOffHand(GeyserSession session)Methods inherited from class org.geysermc.geyser.entity.type.Entity
addAdditionalSpawnData, as, despawnEntity, getBedrockRotation, getFlag, getMaxAir, is, moveAbsolute, moveAbsolute, moveRelative, moveRelative, setAir, setAirSupply, setBoundingBoxHeight, setBoundingBoxWidth, setDisplayName, setDisplayNameVisible, setFlag, setFlags, setGravity, setInvisible, setPose, setRiderSeatPosition, spawnEntity, teleport, updateBedrockMetadata, updateHeadLookRotation, updateMountOffset, updatePassengerOffsets, updatePositionAndRotation, updateRotation
-
Field Details
-
helmet
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData helmet -
chestplate
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData chestplate -
leggings
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData leggings -
boots
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData boots -
hand
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData hand -
offHand
protected com.nukkitx.protocol.bedrock.data.inventory.ItemData offHand -
health
protected float health -
maxHealth
protected float maxHealth
-
-
Constructor Details
-
LivingEntity
public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f motion, float yaw, float pitch, float headYaw)
-
-
Method Details
-
initializeMetadata
protected void initializeMetadata()Description copied from class:EntityCalled on entity spawn. Used to populate the entity metadata and flags with default values.- Overrides:
initializeMetadatain classEntity
-
setLivingEntityFlags
public void setLivingEntityFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) -
setHealth
public void setHealth(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) -
setBedPosition
public com.nukkitx.math.vector.Vector3i setBedPosition(com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata<Optional<com.github.steveice10.mc.protocol.data.game.entity.metadata.Position>,?> entityMetadata) -
isShaking
protected boolean isShaking()Description copied from class:EntityIf true, the entity should be shaking on the client's end. -
setDimensions
protected void setDimensions(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose)Description copied from class:EntitySet the height and width of the entity's bounding box- Overrides:
setDimensionsin classEntity
-
setFreezing
public float setFreezing(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata entityMetadata)Description copied from class:EntitySet a float from 0-1 - how strong the "frozen" overlay should be on screen.- Overrides:
setFreezingin classEntity
-
createHealthAttribute
protected com.nukkitx.protocol.bedrock.data.AttributeData createHealthAttribute()- Returns:
- a Bedrock health attribute constructed from the data sent from the server
-
updateArmor
-
updateMainHand
-
updateOffHand
-
updateBedrockAttributes
public void updateBedrockAttributes(GeyserSession session, List<com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute> attributes)Attributes are properties of an entity that are generally more runtime-based instead of permanent properties. Movement speed, current attack damage with a weapon, current knockback resistance.- Parameters:
attributes- the Java list of attributes sent from the server
-
updateAttribute
protected void updateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, List<com.nukkitx.protocol.bedrock.data.AttributeData> newAttributes)Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute -
calculateAttribute
protected com.nukkitx.protocol.bedrock.data.AttributeData calculateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type)Calculates the complete attribute value to send to Bedrock. Will be overriden if attributes need to be cached.
-