Class SessionPlayerEntity
java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
org.geysermc.geyser.entity.type.player.AvatarEntity
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,Tickable
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.AvatarEntity
BASE_ABILITY_LAYER, bedPosition, SNEAKING_POSE_HEIGHT, usernameFields inherited from class org.geysermc.geyser.entity.type.LivingEntity
attributeScale, dirtyHeadYaw, dirtyPitch, dirtyYaw, equipment, health, maxHealthFields inherited from class org.geysermc.geyser.entity.type.Entity
customName, customNameVisible, definition, dirtyMetadata, entityId, flags, geyserId, headYaw, motion, nametag, offset, onGround, passengers, pitch, position, propertyManager, session, silent, uuid, valid, vehicle, yaw -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatThis will ONLY include attributes that have a Bedrock equivalent!!! seeLivingEntity.updateAttribute(Attribute, List)protected 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.org.cloudburstmc.math.vector.Vector2fThe client claimed interact rotation, intended for touch (pocket) user.doubledoubleJava-only attributesfloatfloatfloatUsed to calculate player jumping velocity for ground status calculation.org.cloudburstmc.math.vector.Vector3fThe client last tick end velocity, used for calculating player onGround.floatdoubledoubleorg.cloudburstmc.math.vector.Vector2fUsed when emulating client-side vehiclesintUsed when emulating client-side vehiclesprotected booleanhasShield(boolean offhand) protected voidCalled on entity spawn.booleanIf the player is colliding on the vertical axis or not according to the client.booleanbooleanbooleanbooleanUsed in PlayerInputTranslator for movement checks.voidmoveRelativeRaw(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) protected voidsetAttributeScale(float scale) voidsetBedrockInteractRotation(org.cloudburstmc.math.vector.Vector2f bedrockInteractRotation) The client claimed interact rotation, intended for touch (pocket) user.booleansetBoundingBoxHeight(float height) protected voidvoidsetCollidingVertically(boolean collidingVertically) If the player is colliding on the vertical axis or not according to the client.voidsetFlags(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) voidsetInsideScaffolding(boolean insideScaffolding) voidsetJavaYaw(float javaYaw) 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.voidsetLivingEntityFlags(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) voidsetPitch(float pitch) 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) voidsetPositionFromBedrockPos(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) voidsetVehicle(Entity entity) voidsetVehicleInput(org.cloudburstmc.math.vector.Vector2f vehicleInput) voidsetVehicleJumpStrength(int vehicleJumpStrength) voidsetYaw(float yaw) x = Yaw, y = Pitch, z = HeadYaw Java: Y = Yaw, X = Pitchvoidprotected 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.Methods inherited from class org.geysermc.geyser.entity.type.player.PlayerEntity
despawnEntity, getDesiredPose, getLeftParrot, getRightParrot, isListed, moveAbsoluteRaw, sendPlayer, setLeftParrot, setListed, setNametag, setParrot, setRightParrot, setUsername, teamIdentifierMethods inherited from class org.geysermc.geyser.entity.type.player.AvatarEntity
bedrockPosition, getBedPosition, getDisplayName, getSkinId, getTextures, getUsername, scoreVisibility, setBedPosition, setBelowNameText, setCustomName, setCustomNameVisible, setDimensionsFromPose, setSkin, setSkin, setSkin, setSkinVisibility, setTextures, shouldLerpMethods inherited from class org.geysermc.geyser.entity.type.LivingEntity
canUseSlot, checkInteractWithNameTag, getEquipment, getItemInSlot, getLerpPosition, getLerpSteps, getMainHandItem, getOffHandItem, hasBodyArmor, interact, isAlive, isDirtyHeadYaw, isDirtyPitch, isDirtyYaw, isEquippableInSlot, isHolding, isMaxFrozenState, isShaking, moveAbsolute, moveRelative, setBody, setBoots, setBoundingBoxWidth, setChestplate, setDirtyHeadYaw, setDirtyPitch, setDirtyYaw, setEquipment, setFreezing, setHand, setHealth, setHelmet, setLeggings, setLerpPosition, setLerpSteps, setMaxFrozenState, setMaxHealth, setOffhand, setParticles, setSaddle, setScale, setSpinAttack, switchHands, tick, updateArmor, updateBedrockAttributes, updateMainHand, updateNametag, updateOffHand, updateSaddled, useArmSwingAttackMethods inherited from class org.geysermc.geyser.entity.type.Entity
addAdditionalSpawnData, bedrockRotation, doesJumpDismount, getBoundingBoxHeight, getBoundingBoxWidth, getDefinition, getDirtyMetadata, getEntityId, getFlag, getHeadYaw, getMaxAir, getMotion, getNametag, getOffset, getPassengers, getPitch, getPosition, getPropertyManager, getSession, getVehicle, getYaw, geyserId, hasLeashesToDrop, interactAt, isCustomNameVisible, isOnGround, isSilent, isValid, javaId, moveAbsolute, playEntityEvent, playEntityEvent, position, setAir, setDefinition, setEntityId, setFlag, setFlagsDirty, setGliding, setGravity, setHeadYaw, setInvisible, setMotion, setNameEntityData, setNametagAlwaysShow, setOffset, setOnGround, setPassengers, setSilent, setSprinting, setValid, standardDisplayName, teleport, testInteraction, updateBedrockEntityProperties, updateBedrockMetadata, updateHeadLookRotation, updateInteractiveTag, updateMountOffset, updateNametag, updatePassengerOffsets, updatePositionAndRotation, updatePropertiesBatched, updateRotation, uuid, uuidMethods 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, updatePropertiesBatched, updatePropertiesBatched, updatePropertyMethods inherited from interface org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity
position
-
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
-
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 classPlayerEntity
-
setClientSideSilent
protected void setClientSideSilent()- Overrides:
setClientSideSilentin classEntity
-
spawnEntity
public void spawnEntity()- Overrides:
spawnEntityin classAvatarEntity
-
setYaw
public void setYaw(float yaw) Description copied from class:Entityx = Yaw, y = Pitch, z = HeadYaw Java: Y = Yaw, X = Pitch -
moveRelativeRaw
public void moveRelativeRaw(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) - Overrides:
moveRelativeRawin classPlayerEntity
-
setPosition
public void setPosition(org.cloudburstmc.math.vector.Vector3f position) - Overrides:
setPositionin classEntity
-
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
-
setPositionFromBedrockPos
public void setPositionFromBedrockPos(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 -
setSneaking
protected void setSneaking(boolean value) - Overrides:
setSneakingin classEntity
-
setAttributeScale
protected void setAttributeScale(float scale) - Overrides:
setAttributeScalein 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.- Overrides:
setPosein classAvatarEntity
-
setPitch
public void setPitch(float pitch) - Overrides:
setPitchin classAvatarEntity
-
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
This will ONLY include attributes that have a Bedrock equivalent!!! seeLivingEntity.updateAttribute(Attribute, List) -
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
-
setLivingEntityFlags
public void setLivingEntityFlags(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata) - Overrides:
setLivingEntityFlagsin classLivingEntity
-
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) -
setVehicle
- Overrides:
setVehiclein classEntity
-
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 attributes -
getMiningEfficiency
public double getMiningEfficiency() -
getBlockBreakSpeed
public double getBlockBreakSpeed() -
getSubmergedMiningSpeed
public double getSubmergedMiningSpeed() -
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. -
getBedrockInteractRotation
public org.cloudburstmc.math.vector.Vector2f getBedrockInteractRotation()The client claimed interact rotation, intended for touch (pocket) user. -
setBedrockInteractRotation
public void setBedrockInteractRotation(org.cloudburstmc.math.vector.Vector2f bedrockInteractRotation) The client claimed interact rotation, intended for touch (pocket) user. -
getJavaYaw
public float getJavaYaw() -
setJavaYaw
public void setJavaYaw(float javaYaw) -
isCollidingVertically
public boolean isCollidingVertically()If the player is colliding on the vertical axis or not according to the client. -
setCollidingVertically
public void setCollidingVertically(boolean collidingVertically) If the player is colliding on the vertical axis or not according to the client.
-