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,AvatarEntity,MobEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot,GeyserItemStack> protected floatprotected floatFields inherited from class org.geysermc.geyser.entity.type.Entity
definition, dirtyMetadata, displayName, 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 booleancanUseSlot(org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot slot) protected final InteractionResultcheckInteractWithNameTag(GeyserItemStack itemStack) Checks to see if a nametag interaction would go through.protected org.cloudburstmc.protocol.bedrock.data.AttributeDataEnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot,GeyserItemStack> getItemInSlot(org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot slot) protected booleanprotected 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()booleanbooleanA 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(GeyserItemStack stack) voidsetBoots(GeyserItemStack stack) booleansetBoundingBoxHeight(float height) voidsetBoundingBoxWidth(float width) voidsetChestplate(GeyserItemStack stack) protected voidsetDimensionsFromPose(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose pose) Set the height and width of the entity's bounding boxvoidsetEquipment(EnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot, GeyserItemStack> equipment) floatsetFreezing(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(GeyserItemStack stack) voidsetHealth(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) voidsetHelmet(GeyserItemStack stack) voidsetLeggings(GeyserItemStack 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(GeyserItemStack stack) voidsetParticles(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata<List<org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle>> entityMetadata) voidsetSaddle(GeyserItemStack stack) protected voidsetScale(float scale) protected voidsetSpinAttack(boolean value) voidvoidprotected 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.voidvoidupdateNametag(@Nullable Team team) voidprotected 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, hasLeashesToDrop, 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, updatePropertiesBatched, updateRotationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.geyser.api.entity.type.GeyserEntity
updateProperty
-
Field Details
-
equipment
protected EnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot,GeyserItemStack> equipment -
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
-
getItemInSlot
public GeyserItemStack getItemInSlot(org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot slot) -
getMainHandItem
-
getOffHandItem
-
isHolding
-
setHelmet
-
setChestplate
-
setLeggings
-
setBoots
-
setBody
-
setSaddle
-
setHand
-
setOffhand
-
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
public void updateArmor() -
updateMainHand
public void updateMainHand() -
updateOffHand
public void 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 -
hasBodyArmor
protected boolean hasBodyArmor() -
canUseSlot
protected boolean canUseSlot(org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot slot) -
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. -
getEquipment
public EnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot,GeyserItemStack> getEquipment() -
isMaxFrozenState
public boolean isMaxFrozenState()A convenience variable for if the entity has reached the maximum frozen ticks and should be shaking -
setEquipment
public void setEquipment(EnumMap<org.geysermc.mcprotocollib.protocol.data.game.entity.EquipmentSlot, GeyserItemStack> equipment) -
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
-