Package org.geysermc.geyser.entity.type
Class LivingEntity
java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
- All Implemented Interfaces:
org.geysermc.geyser.api.entity.type.GeyserEntity
- Direct Known Subclasses:
ArmorStandEntity,MobEntity,PlayerEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected floatprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected floatprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataFields inherited from class org.geysermc.geyser.entity.type.Entity
definition, dirtyMetadata, entityId, flags, geyserId, headYaw, motion, nametag, onGround, passengers, pitch, position, propertyManager, session, silent, uuid, valid, vehicle, yaw -
Constructor Summary
ConstructorsConstructorDescriptionLivingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, org.cloudburstmc.math.vector.Vector3f position, org.cloudburstmc.math.vector.Vector3f motion, float yaw, float pitch, float headYaw) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.cloudburstmc.protocol.bedrock.data.AttributeDatacalculateAttribute(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type) Calculates the complete attribute value to send to Bedrock.protected final InteractionResultcheckInteractWithNameTag(GeyserItemStack itemStack) Checks to see if a nametag interaction would go through.protected org.cloudburstmc.protocol.bedrock.data.AttributeDataorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDatagetBody()org.cloudburstmc.protocol.bedrock.data.inventory.ItemDatagetBoots()org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDatagetHand()org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDataorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDataorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDataprotected booleanhasShield(boolean offhand) protected voidCalled on entity spawn.interact(org.geysermc.mcprotocollib.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.voidmoveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) @Nullable org.cloudburstmc.math.vector.Vector3isetBedPosition(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata<Optional<org.cloudburstmc.math.vector.Vector3i>, ?> entityMetadata) voidsetBody(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) voidsetBoots(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) booleansetBoundingBoxHeight(float height) voidsetBoundingBoxWidth(float width) voidsetChestplate(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) protected voidsetDimensionsFromPose(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose pose) Set the height and width of the entity's bounding boxfloatsetFreezing(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata entityMetadata) Set a float from 0-1 - how strong the "frozen" overlay should be on screen.voidsetHand(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) voidsetHealth(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) voidsetHelmet(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) voidsetLeggings(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) voidsetLivingEntityFlags(org.geysermc.mcprotocollib.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(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) voidsetParticles(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata<List<org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle>> entityMetadata) voidsetSaddle(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) protected voidsetScale(float scale) protected voidsetSpinAttack(boolean value) voidvoidupdateArmor(GeyserSession session) protected voidupdateAttribute(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, List<org.cloudburstmc.protocol.bedrock.data.AttributeData> newAttributes) Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attributevoidupdateBedrockAttributes(GeyserSession session, List<org.geysermc.mcprotocollib.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) voidupdateNametag(@Nullable Team team) voidupdateOffHand(GeyserSession session) protected voidupdateSaddled(boolean saddled) booleanCalled when a SWING_ARM animation packet is receivedMethods inherited from class org.geysermc.geyser.entity.type.Entity
addAdditionalSpawnData, despawnEntity, getBedrockRotation, getBoundingBoxHeight, getBoundingBoxWidth, getDefinition, getDirtyMetadata, getDisplayName, getEntityId, getFlag, getGeyserId, getHeadYaw, getMaxAir, getMotion, getNametag, getPassengers, getPitch, getPosition, getPropertyManager, getSession, getUuid, getVehicle, getYaw, interactAt, isOnGround, isSilent, isValid, javaId, moveAbsolute, moveAbsolute, moveRelative, playEntityEvent, playEntityEvent, scoreVisibility, setAir, setAirSupply, setClientSideSilent, setDefinition, setDisplayName, setDisplayNameVisible, setEntityId, setFlag, setFlags, setFlagsDirty, setGliding, setGravity, setHeadYaw, setInvisible, setMotion, setNametag, setOnGround, setPassengers, setPitch, setPose, setPosition, setRiderSeatPosition, setSilent, setSneaking, setSprinting, setUuid, setValid, setVehicle, setYaw, spawnEntity, standardDisplayName, teamIdentifier, teleport, testInteraction, updateBedrockEntityProperties, updateBedrockMetadata, updateHeadLookRotation, updateInteractiveTag, updateMountOffset, updateNametag, updatePassengerOffsets, updatePositionAndRotation, updateRotation
-
Field Details
-
helmet
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData helmet -
chestplate
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData chestplate -
leggings
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData leggings -
boots
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData boots -
body
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData body -
saddle
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData saddle -
hand
protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData hand -
offhand
protected org.cloudburstmc.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, org.cloudburstmc.math.vector.Vector3f position, org.cloudburstmc.math.vector.Vector3f motion, float yaw, float pitch, float headYaw)
-
-
Method Details
-
setHelmet
public void setHelmet(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setChestplate
public void setChestplate(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setLeggings
public void setLeggings(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setBoots
public void setBoots(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setBody
public void setBody(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setSaddle
public void setSaddle(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setHand
public void setHand(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
setOffhand
public void setOffhand(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack) -
updateSaddled
protected void updateSaddled(boolean saddled) -
switchHands
public void switchHands() -
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
-
updateNametag
- Overrides:
updateNametagin classEntity
-
setLivingEntityFlags
public void setLivingEntityFlags(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) -
setSpinAttack
protected void setSpinAttack(boolean value) -
setHealth
public void setHealth(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) -
setParticles
public void setParticles(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata<List<org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle>> entityMetadata) -
setBedPosition
public @Nullable org.cloudburstmc.math.vector.Vector3i setBedPosition(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata<Optional<org.cloudburstmc.math.vector.Vector3i>, ?> entityMetadata) -
hasShield
protected boolean hasShield(boolean offhand) -
isShaking
protected boolean isShaking()Description copied from class:EntityIf true, the entity should be shaking on the client's end. -
setDimensionsFromPose
protected void setDimensionsFromPose(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose pose) Description copied from class:EntitySet the height and width of the entity's bounding box- Overrides:
setDimensionsFromPosein classEntity
-
setFreezing
public float setFreezing(org.geysermc.mcprotocollib.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
-
setScale
protected void setScale(float scale) -
createHealthAttribute
protected org.cloudburstmc.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(org.geysermc.mcprotocollib.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). -
moveRelative
public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) - Overrides:
moveRelativein classEntity
-
setBoundingBoxHeight
public boolean setBoundingBoxHeight(float height) - Overrides:
setBoundingBoxHeightin classEntity
-
setBoundingBoxWidth
public void setBoundingBoxWidth(float width) - Overrides:
setBoundingBoxWidthin classEntity
-
checkInteractWithNameTag
Checks to see if a nametag interaction would go through. -
updateArmor
-
updateMainHand
-
updateOffHand
-
useArmSwingAttack
public boolean useArmSwingAttack()Called when a SWING_ARM animation packet is received- Returns:
- true if an ATTACK_START event should be used instead
-
updateBedrockAttributes
public void updateBedrockAttributes(GeyserSession session, List<org.geysermc.mcprotocollib.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(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, List<org.cloudburstmc.protocol.bedrock.data.AttributeData> newAttributes) Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute -
calculateAttribute
protected org.cloudburstmc.protocol.bedrock.data.AttributeData calculateAttribute(org.geysermc.mcprotocollib.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 org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getHelmet() -
getChestplate
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getChestplate() -
getLeggings
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getLeggings() -
getBoots
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getBoots() -
getBody
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getBody() -
getSaddle
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getSaddle() -
getHand
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getHand() -
getOffhand
public org.cloudburstmc.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 -
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
-