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, int 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 InteractionResultcheckInteractWithNameTag(GeyserItemStack itemStack)Checks to see if a nametag interaction would go through.protected com.nukkitx.protocol.bedrock.data.AttributeDatacom.nukkitx.protocol.bedrock.data.inventory.ItemDatagetBoots()com.nukkitx.protocol.bedrock.data.inventory.ItemDatacom.nukkitx.protocol.bedrock.data.inventory.ItemDatagetHand()com.nukkitx.protocol.bedrock.data.inventory.ItemDatacom.nukkitx.protocol.bedrock.data.inventory.ItemDatacom.nukkitx.protocol.bedrock.data.inventory.ItemDataprotected booleanhasShield(boolean offhand, ItemMapping shieldMapping)protected voidCalled on entity spawn.interact(com.github.steveice10.mc.protocol.data.game.entity.player.Hand hand)Simulates interacting with an entity.booleanisAlive()booleanA convenience variable for if the entity has reached the maximum frozen ticks and should be shakingprotected 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.nukkitx.math.vector.Vector3i>,?> entityMetadata)voidsetBoots(com.nukkitx.protocol.bedrock.data.inventory.ItemData boots)voidsetChestplate(com.nukkitx.protocol.bedrock.data.inventory.ItemData chestplate)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.voidsetHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData hand)voidsetHealth(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata)voidsetHelmet(com.nukkitx.protocol.bedrock.data.inventory.ItemData helmet)voidsetLeggings(com.nukkitx.protocol.bedrock.data.inventory.ItemData leggings)voidsetLivingEntityFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)voidsetMaxFrozenState(boolean isMaxFrozenState)A convenience variable for if the entity has reached the maximum frozen ticks and should be shakingvoidsetMaxHealth(float maxHealth)voidsetOffHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData offHand)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, getBoundingBoxHeight, getBoundingBoxWidth, getDefinition, getDirtyMetadata, getEntityId, getFlag, getGeyserId, getHeadYaw, getMaxAir, getMotion, getNametag, getPassengers, getPitch, getPosition, getSession, getUuid, getVehicle, getYaw, interactAt, isOnGround, isSilent, isValid, moveAbsolute, moveAbsolute, moveRelative, moveRelative, playEntityEvent, playEntityEvent, setAir, setAirSupply, setBoundingBoxHeight, setBoundingBoxWidth, setClientSideSilent, setDefinition, setDisplayName, setDisplayNameVisible, setEntityId, setFlag, setFlags, setFlagsDirty, setGravity, setHeadYaw, setInvisible, setMotion, setOnGround, setPassengers, setPitch, setPose, setPosition, setRiderSeatPosition, setSilent, setUuid, setValid, setVehicle, setYaw, spawnEntity, teleport, testInteraction, updateBedrockMetadata, updateHeadLookRotation, updateInteractiveTag, 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, int 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.nukkitx.math.vector.Vector3i>,?> entityMetadata) -
hasShield
-
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
-
isAlive
public boolean isAlive() -
interact
public InteractionResult interact(com.github.steveice10.mc.protocol.data.game.entity.player.Hand hand)Description copied from class:EntitySimulates interacting with an entity. The code here should mirror Java Edition code to the best of its ability, to ensure packet parity as well as functionality parity (such as sound effect responses). -
checkInteractWithNameTag
Checks to see if a nametag interaction would go through. -
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. -
getHelmet
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getHelmet() -
getChestplate
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getChestplate() -
getLeggings
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getLeggings() -
getBoots
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getBoots() -
getHand
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getHand() -
getOffHand
public com.nukkitx.protocol.bedrock.data.inventory.ItemData getOffHand() -
isMaxFrozenState
public boolean isMaxFrozenState()A convenience variable for if the entity has reached the maximum frozen ticks and should be shaking -
setHelmet
public void setHelmet(com.nukkitx.protocol.bedrock.data.inventory.ItemData helmet) -
setChestplate
public void setChestplate(com.nukkitx.protocol.bedrock.data.inventory.ItemData chestplate) -
setLeggings
public void setLeggings(com.nukkitx.protocol.bedrock.data.inventory.ItemData leggings) -
setBoots
public void setBoots(com.nukkitx.protocol.bedrock.data.inventory.ItemData boots) -
setHand
public void setHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData hand) -
setOffHand
public void setOffHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData offHand) -
setMaxHealth
public void setMaxHealth(float maxHealth) -
setMaxFrozenState
public void setMaxFrozenState(boolean isMaxFrozenState)A convenience variable for if the entity has reached the maximum frozen ticks and should be shaking
-