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
body, boots, chestplate, equipment, hand, health, helmet, leggings, maxHealth, offhand, saddleFields 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 TypeMethodDescriptionfloatprotected 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.booleanorg.cloudburstmc.protocol.bedrock.data.AttributeDatavoidMap<GeyserAttributeType,org.cloudburstmc.protocol.bedrock.data.AttributeData> Used to fix some inconsistencies, especially in respawning.doubleJava-only attributefloatfloatUsed to calculate player jumping velocity for ground status calculation.org.cloudburstmc.math.vector.Vector3fThe client last tick end velocity, used for calculating player onGround.floatorg.cloudburstmc.math.vector.Vector2fUsed when emulating client-side vehiclesintUsed when emulating client-side vehiclesprotected booleanhasShield(boolean offhand) booleanbooleanbooleanbooleanUsed 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 3318protected voidsetGliding(boolean value) Set a boolean - whether the entity is glidingvoidsetHealth(float health) voidsetInsideScaffolding(boolean insideScaffolding) voidsetLastDeathPosition(@Nullable org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.GlobalPos pos) voidsetLastTickEndVelocity(org.cloudburstmc.math.vector.Vector3f lastTickEndVelocity) The client last tick end velocity, used for calculating player onGround.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 BedrockMovePlayer which receives the player's position with the offset pre-appliedvoidsetRiderSeatPosition(org.cloudburstmc.math.vector.Vector3f position) protected voidsetSneaking(boolean value) protected voidsetSpinAttack(boolean value) protected voidsetSprinting(boolean value) voidsetVehicleInput(org.cloudburstmc.math.vector.Vector2f vehicleInput) voidsetVehicleJumpStrength(int vehicleJumpStrength) 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 3370voidupdateOwnRotation(float yaw, float pitch, float headYaw) Special method used only when updating the session player's rotation.intMethods inherited from class org.geysermc.geyser.entity.type.player.PlayerEntity
despawnEntity, getBedPosition, getCachedScore, getDisplayName, getLeftParrot, getRightParrot, getTexturesProperty, getUsername, initializeMetadata, isListed, isScoreVisible, position, scoreVisibility, sendPlayer, setBedPosition, setBelowNameText, setCachedScore, setDimensionsFromPose, setDisplayName, setDisplayNameVisible, setLeftParrot, setListed, setNametag, setParrot, setRightParrot, setScoreVisible, setSkinVisibility, setTexturesProperty, setUsername, teamIdentifierMethods inherited from class org.geysermc.geyser.entity.type.LivingEntity
canUseSlot, checkInteractWithNameTag, getBody, getBoots, getChestplate, getEquipment, getHand, getHelmet, getLeggings, getOffhand, getSaddle, hasBodyArmor, interact, isAlive, isMaxFrozenState, isShaking, setBody, setBoots, setBoundingBoxWidth, setChestplate, setEquipment, setFreezing, setHand, setHealth, setHelmet, setLeggings, setLivingEntityFlags, setMaxFrozenState, setMaxHealth, setOffhand, setParticles, setSaddle, setScale, switchHands, updateArmor, updateBedrockAttributes, updateMainHand, updateNametag, updateOffHand, updateSaddled, useArmSwingAttackMethods inherited from class org.geysermc.geyser.entity.type.Entity
addAdditionalSpawnData, getBedrockRotation, getBoundingBoxHeight, getBoundingBoxWidth, getDefinition, getDirtyMetadata, getEntityId, getFlag, getGeyserId, getHeadYaw, getMaxAir, getMotion, getNametag, getPassengers, getPitch, getPosition, getPropertyManager, getSession, getUuid, getVehicle, getYaw, hasLeashesToDrop, interactAt, isOnGround, isSilent, isValid, javaId, moveAbsolute, moveRelative, playEntityEvent, playEntityEvent, setAir, setDefinition, setEntityId, setFlag, setFlagsDirty, setGravity, setHeadYaw, setInvisible, setMotion, setOnGround, setPassengers, setPitch, setSilent, setUuid, setValid, setVehicle, setYaw, standardDisplayName, teleport, testInteraction, updateBedrockEntityProperties, updateBedrockMetadata, updateHeadLookRotation, updateInteractiveTag, updateMountOffset, updateNametag, 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
-
updateOwnRotation
public void updateOwnRotation(float yaw, float pitch, float headYaw) Special method used only when updating the session player's rotation. For some reason, Mode#NORMAL ignored rotation. Yay.- Parameters:
yaw- the new yawpitch- the new pitchheadYaw- the head yaw
-
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 BedrockMovePlayer 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 -
setSprinting
protected void setSprinting(boolean value) - Overrides:
setSprintingin classEntity
-
setGliding
protected void setGliding(boolean value) Description copied from class:EntitySet a boolean - whether the entity is gliding- Overrides:
setGlidingin classEntity
-
setSneaking
protected void setSneaking(boolean value) - Overrides:
setSneakingin classEntity
-
setSpinAttack
protected void setSpinAttack(boolean value) - Overrides:
setSpinAttackin classLivingEntity
-
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 classLivingEntity
-
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
-
attributeOrDefault
-
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() -
setVehicleInput
public void setVehicleInput(org.cloudburstmc.math.vector.Vector2f vehicleInput) -
setVehicleJumpStrength
public void setVehicleJumpStrength(int vehicleJumpStrength) -
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.
-
getJumpVelocity
public float getJumpVelocity()Used to calculate player jumping velocity for ground status calculation. -
isOnClimbableBlock
public boolean isOnClimbableBlock() -
canStartGliding
public boolean canStartGliding() -
forceFlagUpdate
public void forceFlagUpdate() -
isGliding
public boolean isGliding() -
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. -
getVehicleInput
public org.cloudburstmc.math.vector.Vector2f getVehicleInput()Used when emulating client-side vehicles -
getVehicleJumpStrength
public int getVehicleJumpStrength()Used when emulating client-side vehicles -
isInsideScaffolding
public boolean isInsideScaffolding() -
setInsideScaffolding
public void setInsideScaffolding(boolean insideScaffolding) -
getLastTickEndVelocity
public org.cloudburstmc.math.vector.Vector3f getLastTickEndVelocity()The client last tick end velocity, used for calculating player onGround. -
setLastTickEndVelocity
public void setLastTickEndVelocity(org.cloudburstmc.math.vector.Vector3f lastTickEndVelocity) The client last tick end velocity, used for calculating player onGround. -
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
-