Class SessionPlayerEntity
java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
org.geysermc.geyser.entity.type.player.PlayerEntity
org.geysermc.geyser.entity.type.player.SessionPlayerEntity
- All Implemented Interfaces:
org.geysermc.geyser.api.entity.type.GeyserEntity,org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity
The entity class specifically for a
GeyserSession's player.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<GeyserAttributeType,org.cloudburstmc.protocol.bedrock.data.AttributeData> Used to fix some inconsistencies, especially in respawning.Fields inherited from class org.geysermc.geyser.entity.type.player.PlayerEntity
BASE_ABILITY_LAYER, SNEAKING_POSE_HEIGHTFields inherited from class org.geysermc.geyser.entity.type.LivingEntity
boots, chestplate, hand, health, helmet, leggings, maxHealth, offhandFields 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
Constructors -
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.org.cloudburstmc.protocol.bedrock.data.AttributeDataMap<GeyserAttributeType,org.cloudburstmc.protocol.bedrock.data.AttributeData> Used to fix some inconsistencies, especially in respawning.doubleJava-only attributefloatfloatprotected booleanhasShield(boolean offhand) booleanUsed in PlayerInputTranslator for movement checks.booleanDetermines if our position is currently out-of-sync with the Java server due to our workaround for the void floorvoidmoveAbsolute(org.cloudburstmc.math.vector.Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) voidmoveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) voidresetAir()voidvoidvoidsetAbsorptionHearts(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) protected voidsetAirSupply(int amount) booleansetBoundingBoxHeight(float height) protected voidvoidsetFlags(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) Sending any updated flags (sprinting, onFire, etc.) to the client while in spectator is not needed Also "fixes" issue 3318voidsetHealth(float health) voidsetLastDeathPosition(@Nullable org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos pos) voidsetPose(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose pose) Usually used for bounding box and not animation.voidsetPosition(org.cloudburstmc.math.vector.Vector3f position) voidsetPositionManual(org.cloudburstmc.math.vector.Vector3f position) Set the player's position without applying an offset or moving the bounding box This is used in BedrockMovePlayerTranslator which receives the player's position with the offset pre-appliedvoidsetRiderSeatPosition(org.cloudburstmc.math.vector.Vector3f position) voidsetVoidPositionDesynched(boolean voidPositionDesynched) Determines if our position is currently out-of-sync with the Java server due to our workaround for the void floorvoidvoidteleportVoidFloorFix(boolean up) This method handles teleporting the player below or above the Bedrock void floor.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 attributevoidSince 1.19.40, the client must be re-informed of its bounding box on respawn See issue 3370intMethods inherited from class org.geysermc.geyser.entity.type.player.PlayerEntity
despawnEntity, getBedPosition, getLeftParrot, getRightParrot, getTexturesProperty, getUsername, initializeMetadata, position, sendPlayer, setBedPosition, setBelowNameText, setDimensions, setDisplayName, setDisplayNameVisible, setLeftParrot, setParrot, setRightParrot, setSkinVisibility, setTexturesProperty, setUsername, updateDisplayName, updateRotationMethods inherited from class org.geysermc.geyser.entity.type.LivingEntity
checkInteractWithNameTag, getBoots, getChestplate, getHand, getHelmet, getLeggings, getOffhand, interact, isAlive, isMaxFrozenState, isShaking, setBoots, setChestplate, setFreezing, setHand, setHealth, setHelmet, setLeggings, setLivingEntityFlags, setMaxFrozenState, setMaxHealth, setOffhand, setParticles, setScale, switchHands, updateArmor, updateBedrockAttributes, updateMainHand, updateOffHand, useArmSwingAttackMethods inherited from class org.geysermc.geyser.entity.type.Entity
addAdditionalSpawnData, as, getBedrockRotation, getBoundingBoxHeight, getBoundingBoxWidth, getDefinition, getDirtyMetadata, getEntityId, getFlag, getGeyserId, getHeadYaw, getMaxAir, getMotion, getNametag, getPassengers, getPitch, getPosition, getPropertyManager, getSession, getUuid, getVehicle, getYaw, interactAt, isOnGround, isSilent, isValid, javaId, moveAbsolute, moveRelative, playEntityEvent, playEntityEvent, setAir, setBoundingBoxWidth, setDefinition, setEntityId, setFlag, setFlagsDirty, setGravity, setHeadYaw, setInvisible, setMotion, setOnGround, setPassengers, setPitch, setSilent, setUuid, setValid, setVehicle, setYaw, teleport, testInteraction, updateBedrockEntityProperties, updateBedrockMetadata, updateHeadLookRotation, updateInteractiveTag, updateMountOffset, updatePassengerOffsets, updatePositionAndRotation, 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
javaId
-
Field Details
-
attributes
protected final Map<GeyserAttributeType,org.cloudburstmc.protocol.bedrock.data.AttributeData> attributesUsed to fix some inconsistencies, especially in respawning.
-
-
Constructor Details
-
SessionPlayerEntity
-
-
Method Details
-
setClientSideSilent
protected void setClientSideSilent()- Overrides:
setClientSideSilentin classEntity
-
spawnEntity
public void spawnEntity()- Overrides:
spawnEntityin classPlayerEntity
-
moveRelative
public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) - Overrides:
moveRelativein classPlayerEntity
-
moveAbsolute
public void moveAbsolute(org.cloudburstmc.math.vector.Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) - Overrides:
moveAbsolutein classPlayerEntity
-
setPosition
public void setPosition(org.cloudburstmc.math.vector.Vector3f position) - Overrides:
setPositionin classPlayerEntity
-
setPositionManual
public void setPositionManual(org.cloudburstmc.math.vector.Vector3f position) Set the player's position without applying an offset or moving the bounding box This is used in BedrockMovePlayerTranslator which receives the player's position with the offset pre-applied- Parameters:
position- the new position of the Bedrock player
-
setFlags
public void setFlags(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) Sending any updated flags (sprinting, onFire, etc.) to the client while in spectator is not needed Also "fixes" issue 3318 -
updateBoundingBox
public void updateBoundingBox()Since 1.19.40, the client must be re-informed of its bounding box on respawn See issue 3370 -
setBoundingBoxHeight
public boolean setBoundingBoxHeight(float height) - Overrides:
setBoundingBoxHeightin classEntity
-
setPose
public void setPose(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose pose) Description copied from class:EntityUsually used for bounding box and not animation. -
getMaxHealth
public float getMaxHealth() -
getHealth
public float getHealth() -
setHealth
public void setHealth(float health) -
setAirSupply
protected void setAirSupply(int amount) - Overrides:
setAirSupplyin classEntity
-
setRiderSeatPosition
public void setRiderSeatPosition(org.cloudburstmc.math.vector.Vector3f position) - Overrides:
setRiderSeatPositionin classEntity
-
createHealthAttribute
public org.cloudburstmc.protocol.bedrock.data.AttributeData createHealthAttribute()- Overrides:
createHealthAttributein classLivingEntity- Returns:
- a Bedrock health attribute constructed from the data sent from the server
-
hasShield
protected boolean hasShield(boolean offhand) - Overrides:
hasShieldin classLivingEntity
-
updateAttribute
protected void updateAttribute(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, List<org.cloudburstmc.protocol.bedrock.data.AttributeData> newAttributes) Description copied from class:LivingEntityTakes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute- Overrides:
updateAttributein classLivingEntity
-
calculateAttribute
protected org.cloudburstmc.protocol.bedrock.data.AttributeData calculateAttribute(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type) Description copied from class:LivingEntityCalculates the complete attribute value to send to Bedrock. Will be overriden if attributes need to be cached.- Overrides:
calculateAttributein classLivingEntity
-
setLastDeathPosition
public void setLastDeathPosition(@Nullable org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos pos) -
getTabListUuid
- Overrides:
getTabListUuidin classPlayerEntity- Returns:
- the UUID that should be used when dealing with Bedrock's tab list.
-
setAbsorptionHearts
public void setAbsorptionHearts(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata) - Overrides:
setAbsorptionHeartsin classPlayerEntity
-
resetMetadata
public void resetMetadata()- Overrides:
resetMetadatain classPlayerEntity
-
resetAttributes
public void resetAttributes() -
resetAir
public void resetAir() -
voidFloorPosition
public int voidFloorPosition() -
teleportVoidFloorFix
public void teleportVoidFloorFix(boolean up) This method handles teleporting the player below or above the Bedrock void floor. The Java server should never see this desync as we adjust the position that we send to it- Parameters:
up- in which direction to teleport - true to resync our position, or false to be teleported below the void floor.
-
getAttributes
public Map<GeyserAttributeType,org.cloudburstmc.protocol.bedrock.data.AttributeData> getAttributes()Used to fix some inconsistencies, especially in respawning. -
getBlockInteractionRange
public double getBlockInteractionRange()Java-only attribute -
isRidingInFront
public boolean isRidingInFront()Used in PlayerInputTranslator for movement checks. -
isVoidPositionDesynched
public boolean isVoidPositionDesynched()Determines if our position is currently out-of-sync with the Java server due to our workaround for the void floorMust be reset when dying, switching worlds, or being teleported out of the void
-
setVoidPositionDesynched
public void setVoidPositionDesynched(boolean voidPositionDesynched) Determines if our position is currently out-of-sync with the Java server due to our workaround for the void floorMust be reset when dying, switching worlds, or being teleported out of the void
-