Package org.geysermc.geyser.session
Class GeyserSession
java.lang.Object
org.geysermc.geyser.session.GeyserSession
- All Implemented Interfaces:
org.geysermc.api.connection.Connection,org.geysermc.geyser.api.command.CommandSource,org.geysermc.geyser.api.connection.GeyserConnection,GeyserCommandSource
public class GeyserSession
extends Object
implements org.geysermc.geyser.api.connection.GeyserConnection, GeyserCommandSource
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeyserSession(GeyserImpl geyser, org.cloudburstmc.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop) -
Method Summary
Modifier and TypeMethodDescriptionvoidStarts ticking the amount of time that the Bedrock client has been swinging their arm, and disables blocking if blocking.voidaddCommandEnum(String name, String enums) @Nullable org.cloudburstmc.protocol.bedrock.data.AttributeDataAdjusts speed if the player is crawling.voidFor issue 2113 and combating arm ticking activating being delayed in BedrockAnimateTranslator.voidauthenticate(String username) voidvoidauthenticateWithMicrosoftCode(boolean offlineAccess) Present a form window to the user asking to log in with another web browservoidauthenticateWithRefreshToken(String refreshToken) @NonNull String@NonNull org.geysermc.geyser.api.bedrock.camera.CameraDatacamera()booleanvoidconfirmTeleport(org.cloudburstmc.math.vector.Vector3d position) voidconnect()Send all necessary packets to load Bedrock into the servervoiddisconnect(String reason) voidensureInEventLoop(Runnable runnable) Moves task to the session event loop if already not in it.@NonNull org.geysermc.geyser.api.entity.EntityDataentities()@NonNull CompletableFuture<@Nullable org.geysermc.geyser.api.entity.type.GeyserEntity>entityByJavaId(@org.checkerframework.checker.index.qual.NonNegative int javaId) voidexecuteInEventLoop(Runnable runnable) Executes a task and prints a stack trace if an error occurs.intCounts how many ticks have occurred since an arm animation started.doubleThe current attack speed of the player.intRequired to decode biomes correctly.int[]Stores the map between Java and Bedrock biome network IDs.longStores when the player started to break a block.Stores the block mappings for this specific version.intUsed for Floodgate skin uploadingit.unimi.dsi.fastutil.ints.Int2ObjectMap<TextDecoration>intStores session collisionit.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserRecipe>@Nullable org.cloudburstmc.protocol.bedrock.data.inventory.ItemDataStores the book that is currently being read.The dimension of the player.All dimensions that the client could possibly connect to.@MonotonicNonNull JavaDimension@NonNull AbstractGeyserboundPacketHandlerio.netty.channel.EventLoopThe loop where all packets and ticking is processed to prevent concurrency issues.floatfloatcom.github.steveice10.mc.protocol.data.game.entity.player.GameModeMap<org.cloudburstmc.math.vector.Vector3i,ItemFrameEntity> A map of Vector3i positions to Java entities.Stores the item translations for this specific version.Stores all Java recipes by recipe identifier, and matches them to all possible Bedrock recipe identifiers.A cache of IDs from ClientboundKeepAlivePackets that have been sent to the Bedrock client, but haven't been returned to the server.org.cloudburstmc.math.vector.Vector3iorg.cloudburstmc.math.vector.Vector2ilongThe time of the last hit.org.cloudburstmc.math.vector.Vector3iStores the last position of the block the player interacted with.org.cloudburstmc.math.vector.Vector3fStores the position of the player the last time they interacted.longStore the last time the player interacted.longUsed to send a movement packet every three seconds if the player hasn't moved.longUsed to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms@Nullable Set<org.cloudburstmc.math.vector.Vector3i>Stores a list of all lectern locations and their block entity tags.String[]As of Java 1.19.3, the client only uses these for commands.Used to return the player to their original rotation after using an item in BedrockInventoryTransactionTranslatorUsed to return players back to their vehicles if the server doesn't want them unmounting.The entity that the client is currently looking at.intintThe op permission level set by the serverfloatTracks the original speed attribute.A list of all players that have a player head on with a custom texture.com.github.steveice10.mc.protocol.data.game.entity.metadata.PosegetPose()Stores the Java pose that the server and/or Geyser believes the player currently has.com.github.steveice10.mc.protocol.MinecraftProtocolintit.unimi.dsi.fastutil.objects.Object2IntMap<com.github.steveice10.mc.protocol.data.game.statistic.Statistic>Stores a map of all statistics sent from the server.it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserStonecutterData>Saves a list of all stonecutter recipes, for use in a stonecutter inventory.it.unimi.dsi.fastutil.longs.Long2ObjectMap<org.cloudburstmc.protocol.bedrock.packet.ClientboundMapItemDataPacket>The thread that will run every 50 milliseconds - one Minecraft tick.floatKeeps track of the world name for respawning.booleanhasPermission(String permission) Checks if the given session's player has a permission@NonNull org.geysermc.api.util.InputModebooleanWhether advanced tooltips will be added to the player's items.booleanisCanFly()If the current player can flybooleanisClosed()Accessed on the initial Java and Bedrock packet processing threadsbooleanbooleanbooleanControls whether the daylight cycle gamerule has been sent to the client, so the sun/moon remain motionless.booleanbooleanWhether to work around 1.13's different behavior in villager trading menus.booleanStarting in 1.17, Java servers expect thecarriedItemparameter of the serverbound click container packet to be the current contents of the mouse after the transaction has been done.booleanbooleanisFlying()If the current player is flyingbooleanbooleanbooleanWhether simulated fog has been sent to the client or not.booleanisLinked()booleanbooleanbooleanWhether to emulate pre-1.20 smithing table behavior.booleanStores whether the player intended to place a bucket.booleanCaches current rain status.booleanbooleanbooleanbooleanbooleanbooleanSaves if the client is steering left on a boat.booleanSaves if the client is steering right on a boat.booleanWhether the player is swimming in water.booleanCaches current thunder status.booleanWhether we're expecting statistics to be sent back to us.@MonotonicNonNull StringjavaUuid()@NonNull Stringlocale()voidlockInputs(boolean camera, boolean movement) name()booleanIf successful, also begins connecting to the Java server.@NonNull org.geysermc.api.util.BedrockPlatformplatform()voidplaySoundEvent(org.cloudburstmc.protocol.bedrock.data.SoundEvent sound, org.cloudburstmc.math.vector.Vector3f position) voidrefreshEmotes(List<UUID> emotes) org.geysermc.geyser.api.network.RemoteServerremoteServer(org.geysermc.geyser.api.network.RemoteServer remoteServer) voidremoveCommandEnum(String name, String enums) voidvoidscheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit) Schedules a task and prints a stack trace if an error occurs.voidSend an AdventureSettingsPacket to the client with the latest flagsvoidSends a chat message to the Java server.voidsendCommand(String command) Sends a command to the Java server.voidsendDownstreamGamePacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server if in the game state.voidsendDownstreamLoginPacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server if in the login state.voidsendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server.voidsendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet, com.github.steveice10.mc.protocol.data.ProtocolState intendedState) Send a packet to the remote server if in the specified state.voidbooleansendForm(@NonNull org.geysermc.cumulus.form.Form form) booleansendForm(@NonNull org.geysermc.cumulus.form.util.FormBuilder<?, ?, ?> formBuilder) voidsendForm(org.geysermc.cumulus.Form<?> form) Deprecated.since Cumulus version 1.1, and will be removed when Cumulus 2.0 releases.voidsendForm(org.geysermc.cumulus.util.FormBuilder<?, ?> formBuilder) Deprecated.since Cumulus version 1.1, and will be removed when Cumulus 2.0 releases.voidsendGameRule(String gameRule, Object value) Send a gamerule value to the clientvoidSend a packet to the server to indicate client render distance, locale, skin parts, and hand preference.voidsendMessage(@NonNull String message) voidsendUpstreamPacket(org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) Queue a packet to be sent to player.voidsendUpstreamPacketImmediately(org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) Send a packet immediately to the player.voidsetAdvancedTooltips(boolean advancedTooltips) Whether advanced tooltips will be added to the player's items.voidsetAttackSpeed(double attackSpeed) The current attack speed of the player.voidsetAuthData(AuthData authData) voidsetAuthenticationData(AuthData authData) voidsetBiomeGlobalPalette(int biomeGlobalPalette) Required to decode biomes correctly.voidsetBiomeTranslations(int[] biomeTranslations) Stores the map between Java and Bedrock biome network IDs.voidsetBlockBreakStartTime(long blockBreakStartTime) Stores when the player started to break a block.voidsetBlockMappings(BlockMappings blockMappings) Stores the block mappings for this specific version.voidsetBreakingBlock(int breakingBlock) voidsetCanFly(boolean canFly) If the current player can flyvoidsetCertChainData(List<String> certChainData) Used for Floodgate skin uploadingvoidsetClientData(BedrockClientData clientData) voidsetClientRenderDistance(int clientRenderDistance) voidsetClosingInventory(boolean closingInventory) voidsetCraftingGridFuture(ScheduledFuture<?> craftingGridFuture) voidsetCraftingRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserRecipe> craftingRecipes) voidsetCurrentBook(@Nullable org.cloudburstmc.protocol.bedrock.data.inventory.ItemData currentBook) Stores the book that is currently being read.voidsetDaylightCycle(boolean doCycle) Changes the daylight cycle gamerule on the client This is used in the login screen along-side normal usagevoidsetDimension(String dimension) The dimension of the player.voidsetDimensionType(@MonotonicNonNull JavaDimension dimensionType) voidsetDroppingLecternBook(boolean droppingLecternBook) voidsetEmulatePost1_13Logic(boolean emulatePost1_13Logic) Whether to work around 1.13's different behavior in villager trading menus.voidsetEmulatePost1_16Logic(boolean emulatePost1_16Logic) Starting in 1.17, Java servers expect thecarriedItemparameter of the serverbound click container packet to be the current contents of the mouse after the transaction has been done.voidsetEmulatePost1_18Logic(boolean emulatePost1_18Logic) voidsetErosionHandler(@NonNull AbstractGeyserboundPacketHandler erosionHandler) voidsetFlying(boolean flying) voidsetFlySpeed(float flySpeed) voidsetGameMode(com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode) voidsetInstabuild(boolean instabuild) voidsetInteracting(boolean interacting) voidsetInventoryTranslator(InventoryTranslator inventoryTranslator) voidsetItemMappings(ItemMappings itemMappings) Stores the item translations for this specific version.voidsetJavaToBedrockRecipeIds(Map<String, List<String>> javaToBedrockRecipeIds) Stores all Java recipes by recipe identifier, and matches them to all possible Bedrock recipe identifiers.voidsetLastBlockPlacedId(String lastBlockPlacedId) voidsetLastBlockPlacePosition(org.cloudburstmc.math.vector.Vector3i lastBlockPlacePosition) voidsetLastChunkPosition(org.cloudburstmc.math.vector.Vector2i lastChunkPosition) voidsetLastHitTime(long lastHitTime) The time of the last hit.voidsetLastInteractionBlockPosition(org.cloudburstmc.math.vector.Vector3i lastInteractionBlockPosition) Stores the last position of the block the player interacted with.voidsetLastInteractionPlayerPosition(org.cloudburstmc.math.vector.Vector3f lastInteractionPlayerPosition) Stores the position of the player the last time they interacted.voidsetLastInteractionTime(long lastInteractionTime) Store the last time the player interacted.voidsetLastMovementTimestamp(long lastMovementTimestamp) Used to send a movement packet every three seconds if the player hasn't moved.voidsetLastVehicleMoveTimestamp(long lastVehicleMoveTimestamp) Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100msvoidAs of Java 1.19.3, the client only uses these for commands.voidsetLookBackScheduledFuture(ScheduledFuture<?> lookBackScheduledFuture) Used to return the player to their original rotation after using an item in BedrockInventoryTransactionTranslatorvoidsetMountVehicleScheduledFuture(ScheduledFuture<?> mountVehicleScheduledFuture) Used to return players back to their vehicles if the server doesn't want them unmounting.voidsetMouseoverEntity(Entity mouseoverEntity) The entity that the client is currently looking at.voidsetOldSmithingTable(boolean oldSmithingTable) Whether to emulate pre-1.20 smithing table behavior.voidsetOpenInventory(Inventory openInventory) voidsetOpPermissionLevel(int opPermissionLevel) The op permission level set by the servervoidsetOriginalSpeedAttribute(float originalSpeedAttribute) Tracks the original speed attribute.voidsetPlacedBucket(boolean placedBucket) Stores whether the player intended to place a bucket.voidsetPose(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose) Stores the Java pose that the server and/or Geyser believes the player currently has.voidsetRaining(boolean raining) Caches current rain status.voidsetReducedDebugInfo(boolean value) Update the cached value for the reduced debug info gamerule.voidsetServerRenderDistance(int renderDistance) voidsetSpawned(boolean spawned) voidsetSprinting(boolean sprinting) voidsetSteeringLeft(boolean steeringLeft) Saves if the client is steering left on a boat.voidsetSteeringRight(boolean steeringRight) Saves if the client is steering right on a boat.voidsetStonecutterRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserStonecutterData> stonecutterRecipes) Saves a list of all stonecutter recipes, for use in a stonecutter inventory.voidsetSwimming(boolean swimming) voidsetSwimmingInWater(boolean swimmingInWater) Whether the player is swimming in water.voidsetThunder(boolean thunder) Caches current thunder status.voidsetUnconfirmedTeleport(TeleportCache unconfirmedTeleport) voidsetWaitingForStatistics(boolean waitingForStatistics) Whether we're expecting statistics to be sent back to us.voidsetWalkSpeed(float walkSpeed) voidsetWorldName(String worldName) Keeps track of the world name for respawning.voidshakeCamera(float intensity, float duration, @NonNull org.geysermc.geyser.api.bedrock.camera.CameraShake type) voidshowEmote(@NonNull org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity emoter, @NonNull String emoteId) voidvoidvoidprotected voidtick()Called every 50 milliseconds - one Minecraft tick.booleantransfer(@NonNull String address, @org.checkerframework.common.value.qual.IntRange(from=0L, to=65535L) int port) @NonNull org.geysermc.api.util.UiProfilevoidupdateStatistics(@NonNull it.unimi.dsi.fastutil.objects.Object2IntMap<com.github.steveice10.mc.protocol.data.game.statistic.Statistic> statistics) Used for updating statistic values since we only get changes from the server@NonNull Stringversion()@NonNull Stringxuid()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.geyser.api.command.CommandSource
sendMessageMethods inherited from interface org.geysermc.geyser.command.GeyserCommandSource
sendMessage
-
Field Details
-
sentSpawnPacket
protected boolean sentSpawnPacket
-
-
Constructor Details
-
GeyserSession
public GeyserSession(GeyserImpl geyser, org.cloudburstmc.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop)
-
-
Method Details
-
connect
public void connect()Send all necessary packets to load Bedrock into the server -
authenticate
-
authenticateWithRefreshToken
-
authenticateWithMicrosoftCode
public void authenticateWithMicrosoftCode() -
authenticateWithMicrosoftCode
public void authenticateWithMicrosoftCode(boolean offlineAccess) Present a form window to the user asking to log in with another web browser -
onMicrosoftLoginComplete
If successful, also begins connecting to the Java server. -
disconnect
-
ensureInEventLoop
Moves task to the session event loop if already not in it. Otherwise, the task is automatically ran. -
executeInEventLoop
Executes a task and prints a stack trace if an error occurs. -
scheduleInEventLoop
Schedules a task and prints a stack trace if an error occurs. -
tick
protected void tick()Called every 50 milliseconds - one Minecraft tick. -
setAuthenticationData
-
startSneaking
public void startSneaking() -
stopSneaking
public void stopSneaking() -
setSwimming
public void setSwimming(boolean swimming) -
setFlying
public void setFlying(boolean flying) -
adjustSpeed
public @Nullable org.cloudburstmc.protocol.bedrock.data.AttributeData adjustSpeed()Adjusts speed if the player is crawling.- Returns:
- not null if attributes should be updated.
-
activateArmAnimationTicking
public void activateArmAnimationTicking()Starts ticking the amount of time that the Bedrock client has been swinging their arm, and disables blocking if blocking. -
armSwingPending
public void armSwingPending()For issue 2113 and combating arm ticking activating being delayed in BedrockAnimateTranslator. -
requestOffhandSwap
public void requestOffhandSwap() -
name
- Specified by:
namein interfaceorg.geysermc.geyser.api.command.CommandSource
-
sendMessage
- Specified by:
sendMessagein interfaceorg.geysermc.geyser.api.command.CommandSource
-
isConsole
public boolean isConsole()- Specified by:
isConsolein interfaceorg.geysermc.geyser.api.command.CommandSource
-
locale
Description copied from interface:GeyserCommandSource- Specified by:
localein interfaceorg.geysermc.geyser.api.command.CommandSource- Specified by:
localein interfaceGeyserCommandSource
-
sendChat
Sends a chat message to the Java server. -
sendCommand
Sends a command to the Java server. -
setServerRenderDistance
public void setServerRenderDistance(int renderDistance) -
getSocketAddress
-
sendForm
public boolean sendForm(@NonNull org.geysermc.cumulus.form.Form form) - Specified by:
sendFormin interfaceorg.geysermc.api.connection.Connection
-
sendForm
public boolean sendForm(@NonNull org.geysermc.cumulus.form.util.FormBuilder<?, ?, ?> formBuilder) - Specified by:
sendFormin interfaceorg.geysermc.api.connection.Connection
-
sendForm
Deprecated.since Cumulus version 1.1, and will be removed when Cumulus 2.0 releases. Please use the new forms instead. -
sendForm
Deprecated.since Cumulus version 1.1, and will be removed when Cumulus 2.0 releases. Please use the new forms instead. -
getNextItemNetId
public int getNextItemNetId()- Returns:
- the next Bedrock item network ID to use for a new item
-
confirmTeleport
public void confirmTeleport(org.cloudburstmc.math.vector.Vector3d position) -
sendUpstreamPacket
public void sendUpstreamPacket(org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) Queue a packet to be sent to player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
sendUpstreamPacketImmediately
public void sendUpstreamPacketImmediately(org.cloudburstmc.protocol.bedrock.packet.BedrockPacket packet) Send a packet immediately to the player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
sendDownstreamGamePacket
public void sendDownstreamGamePacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server if in the game state.- Parameters:
packet- the java edition packet from MCProtocolLib
-
sendDownstreamLoginPacket
public void sendDownstreamLoginPacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server if in the login state.- Parameters:
packet- the java edition packet from MCProtocolLib
-
sendDownstreamPacket
public void sendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet, com.github.steveice10.mc.protocol.data.ProtocolState intendedState) Send a packet to the remote server if in the specified state.- Parameters:
packet- the java edition packet from MCProtocolLibintendedState- the state the client should be in
-
sendDownstreamPacket
public void sendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet) Send a packet to the remote server.- Parameters:
packet- the java edition packet from MCProtocolLib
-
setReducedDebugInfo
public void setReducedDebugInfo(boolean value) Update the cached value for the reduced debug info gamerule. If enabled, also hides the player's coordinates.- Parameters:
value- The new value for reducedDebugInfo
-
setDaylightCycle
public void setDaylightCycle(boolean doCycle) Changes the daylight cycle gamerule on the client This is used in the login screen along-side normal usage- Parameters:
doCycle- If the cycle should continue
-
sendGameRule
Send a gamerule value to the client- Parameters:
gameRule- The gamerule to sendvalue- The value of the gamerule
-
hasPermission
Checks if the given session's player has a permission- Specified by:
hasPermissionin interfaceorg.geysermc.geyser.api.command.CommandSource- Parameters:
permission- The permission node to check- Returns:
- true if the player has the requested permission, false if not
-
sendAdventureSettings
public void sendAdventureSettings()Send an AdventureSettingsPacket to the client with the latest flags -
sendJavaClientSettings
public void sendJavaClientSettings()Send a packet to the server to indicate client render distance, locale, skin parts, and hand preference. -
updateStatistics
public void updateStatistics(@NonNull it.unimi.dsi.fastutil.objects.Object2IntMap<com.github.steveice10.mc.protocol.data.game.statistic.Statistic> statistics) Used for updating statistic values since we only get changes from the server- Parameters:
statistics- Updated statistics values
-
refreshEmotes
-
canUseCommandBlocks
public boolean canUseCommandBlocks() -
playSoundEvent
public void playSoundEvent(org.cloudburstmc.protocol.bedrock.data.SoundEvent sound, org.cloudburstmc.math.vector.Vector3f position) -
getEyeHeight
public float getEyeHeight() -
bedrockUsername
- Specified by:
bedrockUsernamein interfaceorg.geysermc.api.connection.Connection
-
javaUsername
- Specified by:
javaUsernamein interfaceorg.geysermc.api.connection.Connection
-
javaUuid
- Specified by:
javaUuidin interfaceorg.geysermc.api.connection.Connection
-
xuid
- Specified by:
xuidin interfaceorg.geysermc.api.connection.Connection
-
version
- Specified by:
versionin interfaceorg.geysermc.api.connection.Connection
-
platform
public @NonNull org.geysermc.api.util.BedrockPlatform platform()- Specified by:
platformin interfaceorg.geysermc.api.connection.Connection
-
languageCode
- Specified by:
languageCodein interfaceorg.geysermc.api.connection.Connection
-
uiProfile
public @NonNull org.geysermc.api.util.UiProfile uiProfile()- Specified by:
uiProfilein interfaceorg.geysermc.api.connection.Connection
-
inputMode
public @NonNull org.geysermc.api.util.InputMode inputMode()- Specified by:
inputModein interfaceorg.geysermc.api.connection.Connection
-
isLinked
public boolean isLinked()- Specified by:
isLinkedin interfaceorg.geysermc.api.connection.Connection
-
transfer
public boolean transfer(@NonNull String address, @org.checkerframework.common.value.qual.IntRange(from=0L, to=65535L) int port) - Specified by:
transferin interfaceorg.geysermc.api.connection.Connection
-
entityByJavaId
public @NonNull CompletableFuture<@Nullable org.geysermc.geyser.api.entity.type.GeyserEntity> entityByJavaId(@org.checkerframework.checker.index.qual.NonNegative int javaId) - Specified by:
entityByJavaIdin interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
showEmote
public void showEmote(@NonNull org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity emoter, @NonNull String emoteId) - Specified by:
showEmotein interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
lockInputs
public void lockInputs(boolean camera, boolean movement) -
camera
public @NonNull org.geysermc.geyser.api.bedrock.camera.CameraData camera()- Specified by:
camerain interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
entities
public @NonNull org.geysermc.geyser.api.entity.EntityData entities()- Specified by:
entitiesin interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
shakeCamera
public void shakeCamera(float intensity, float duration, @NonNull org.geysermc.geyser.api.bedrock.camera.CameraShake type) - Specified by:
shakeCamerain interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
stopCameraShake
public void stopCameraShake()- Specified by:
stopCameraShakein interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
sendFog
- Specified by:
sendFogin interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
removeFog
- Specified by:
removeFogin interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
fogEffects
- Specified by:
fogEffectsin interfaceorg.geysermc.geyser.api.connection.GeyserConnection
-
addCommandEnum
-
removeCommandEnum
-
getGeyser
-
getUpstream
-
getDownstream
-
getEventLoop
public io.netty.channel.EventLoop getEventLoop()The loop where all packets and ticking is processed to prevent concurrency issues. If this is manually called, ensure that any exceptions are properly handled. -
getAuthData
-
getClientData
-
getCertChainData
Used for Floodgate skin uploading -
getErosionHandler
-
remoteServer
public org.geysermc.geyser.api.network.RemoteServer remoteServer() -
getPlayerEntity
-
getAdvancementsCache
-
getBookEditCache
-
getChunkCache
-
getEntityCache
-
getEffectCache
-
getFormCache
-
getLodestoneCache
-
getPistonCache
-
getPreferencesCache
-
getSkullCache
-
getStructureBlockCache
-
getTagCache
-
getWorldCache
-
getUnconfirmedTeleport
-
getWorldBorder
-
isInWorldBorderWarningArea
public boolean isInWorldBorderWarningArea()Whether simulated fog has been sent to the client or not. -
getPlayerInventory
-
getOpenInventory
-
isClosingInventory
public boolean isClosingInventory() -
getInventoryTranslator
-
getCraftingGridFuture
-
getCollisionManager
Stores session collision -
getBlockMappings
Stores the block mappings for this specific version. -
getItemMappings
Stores the item translations for this specific version. -
getStoredMaps
public it.unimi.dsi.fastutil.longs.Long2ObjectMap<org.cloudburstmc.protocol.bedrock.packet.ClientboundMapItemDataPacket> getStoredMaps() -
getBiomeGlobalPalette
public int getBiomeGlobalPalette()Required to decode biomes correctly. -
getBiomeTranslations
public int[] getBiomeTranslations()Stores the map between Java and Bedrock biome network IDs. -
getItemFrameCache
A map of Vector3i positions to Java entities. Used for translating Bedrock block actions to Java entity actions. -
getLecternCache
Stores a list of all lectern locations and their block entity tags. SeeWorldManager.sendLecternData(GeyserSession, int, int, int)for more information. -
getPlayerWithCustomHeads
A list of all players that have a player head on with a custom texture. Our workaround for these players is to give them a custom skin and geometry to emulate wearing a custom skull. -
isDroppingLecternBook
public boolean isDroppingLecternBook() -
getLastChunkPosition
public org.cloudburstmc.math.vector.Vector2i getLastChunkPosition() -
getClientRenderDistance
public int getClientRenderDistance() -
getServerRenderDistance
public int getServerRenderDistance() -
isSentSpawnPacket
public boolean isSentSpawnPacket() -
isLoggedIn
public boolean isLoggedIn() -
isLoggingIn
public boolean isLoggingIn() -
isSpawned
public boolean isSpawned() -
isClosed
public boolean isClosed()Accessed on the initial Java and Bedrock packet processing threads -
getGameMode
public com.github.steveice10.mc.protocol.data.game.entity.player.GameMode getGameMode() -
getWorldName
Keeps track of the world name for respawning. -
getLevels
As of Java 1.19.3, the client only uses these for commands. -
isSneaking
public boolean isSneaking() -
getPose
public com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose getPose()Stores the Java pose that the server and/or Geyser believes the player currently has. -
isSprinting
public boolean isSprinting() -
isSwimmingInWater
public boolean isSwimmingInWater()Whether the player is swimming in water. Used to update speed when crawling. -
getOriginalSpeedAttribute
public float getOriginalSpeedAttribute()Tracks the original speed attribute.We need to do this in order to emulate speeds when sneaking under 1.5-blocks-tall areas if the player isn't sneaking, and when crawling.
-
getDimension
The dimension of the player. As all entities are in the same world, this can be safely applied to all other entities. -
getDimensionType
-
getDimensions
All dimensions that the client could possibly connect to. -
getChatTypes
-
getBreakingBlock
public int getBreakingBlock() -
getLastBlockPlacePosition
public org.cloudburstmc.math.vector.Vector3i getLastBlockPlacePosition() -
getLastBlockPlacedId
-
isInteracting
public boolean isInteracting() -
getLastInteractionBlockPosition
public org.cloudburstmc.math.vector.Vector3i getLastInteractionBlockPosition()Stores the last position of the block the player interacted with. This can either be a block that the client placed or an existing block the player interacted with (for example, a chest).
Initialized as (0, 0, 0) so it is always not-null. -
getLastInteractionPlayerPosition
public org.cloudburstmc.math.vector.Vector3f getLastInteractionPlayerPosition()Stores the position of the player the last time they interacted. Used to verify that the player did not move since their last interaction.
Initialized as (0, 0, 0) so it is always not-null. -
getMouseoverEntity
The entity that the client is currently looking at. -
getJavaToBedrockRecipeIds
Stores all Java recipes by recipe identifier, and matches them to all possible Bedrock recipe identifiers. They are not 1:1, since Bedrock can have multiple recipes for the same Java recipe. -
getCraftingRecipes
-
getLastRecipeNetId
-
getStonecutterRecipes
Saves a list of all stonecutter recipes, for use in a stonecutter inventory. The key is the Java ID of the item; the values are all the possible outputs' Java IDs sorted by their string identifier -
isEmulatePost1_13Logic
public boolean isEmulatePost1_13Logic()Whether to work around 1.13's different behavior in villager trading menus. -
isEmulatePost1_16Logic
public boolean isEmulatePost1_16Logic()Starting in 1.17, Java servers expect thecarriedItemparameter of the serverbound click container packet to be the current contents of the mouse after the transaction has been done. 1.16 expects the clicked slot contents before any transaction is done. With the current ViaVersion structure, if we do not send what 1.16 expects and send multiple click container packets, then successive transactions will be rejected. -
isEmulatePost1_18Logic
public boolean isEmulatePost1_18Logic() -
isOldSmithingTable
public boolean isOldSmithingTable()Whether to emulate pre-1.20 smithing table behavior. Adapts ViaVersion's furnace UI to one Bedrock can use. SeeOldSmithingTableTranslator. -
getAttackSpeed
public double getAttackSpeed()The current attack speed of the player. Used for sending proper cooldown timings. Setting a default fixes cooldowns not showing up on a fresh world. -
getLastHitTime
public long getLastHitTime()The time of the last hit. Used to gauge how long the cooldown is taking. This is a session variable in order to prevent more scheduled threads than necessary. -
isSteeringLeft
public boolean isSteeringLeft()Saves if the client is steering left on a boat. -
isSteeringRight
public boolean isSteeringRight()Saves if the client is steering right on a boat. -
getLastInteractionTime
public long getLastInteractionTime()Store the last time the player interacted. Used to fix a right-click spam bug. See this for context. -
getBlockBreakStartTime
public long getBlockBreakStartTime()Stores when the player started to break a block. Used to allow correct break time for custom blocks. -
isPlacedBucket
public boolean isPlacedBucket()Stores whether the player intended to place a bucket. -
getLastMovementTimestamp
public long getLastMovementTimestamp()Used to send a movement packet every three seconds if the player hasn't moved. Prevents timeouts when AFK in certain instances. -
getLastVehicleMoveTimestamp
public long getLastVehicleMoveTimestamp()Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms -
getArmAnimationTicks
public int getArmAnimationTicks()Counts how many ticks have occurred since an arm animation started. -1 means there is no active arm swing; -2 means an arm swing will start in a tick. -
isDaylightCycle
public boolean isDaylightCycle()Controls whether the daylight cycle gamerule has been sent to the client, so the sun/moon remain motionless. -
isReducedDebugInfo
public boolean isReducedDebugInfo() -
getOpPermissionLevel
public int getOpPermissionLevel()The op permission level set by the server -
isCanFly
public boolean isCanFly()If the current player can fly -
isFlying
public boolean isFlying()If the current player is flying -
isInstabuild
public boolean isInstabuild() -
getFlySpeed
public float getFlySpeed() -
getWalkSpeed
public float getWalkSpeed() -
isRaining
public boolean isRaining()Caches current rain status. -
isThunder
public boolean isThunder()Caches current thunder status. -
getStatistics
public it.unimi.dsi.fastutil.objects.Object2IntMap<com.github.steveice10.mc.protocol.data.game.statistic.Statistic> getStatistics()Stores a map of all statistics sent from the server. The server only sends new statistics back to us, so in order to show all statistics we need to cache existing ones. -
isWaitingForStatistics
public boolean isWaitingForStatistics()Whether we're expecting statistics to be sent back to us. -
getEmotes
-
isAdvancedTooltips
public boolean isAdvancedTooltips()Whether advanced tooltips will be added to the player's items. -
getTickThread
The thread that will run every 50 milliseconds - one Minecraft tick. -
getLookBackScheduledFuture
Used to return the player to their original rotation after using an item in BedrockInventoryTransactionTranslator -
getMountVehicleScheduledFuture
Used to return players back to their vehicles if the server doesn't want them unmounting. -
getKeepAliveCache
A cache of IDs from ClientboundKeepAlivePackets that have been sent to the Bedrock client, but haven't been returned to the server. Only used ifGeyserConfiguration.isForwardPlayerPing()is enabled. -
getCurrentBook
public @Nullable org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getCurrentBook()Stores the book that is currently being read. Used inJavaOpenBookTranslator -
getCameraData
-
getEntityData
-
getProtocol
public com.github.steveice10.mc.protocol.MinecraftProtocol getProtocol() -
setAuthData
-
setClientData
-
setCertChainData
Used for Floodgate skin uploading -
setErosionHandler
-
remoteServer
- Returns:
this.
-
setUnconfirmedTeleport
-
setOpenInventory
-
setClosingInventory
public void setClosingInventory(boolean closingInventory) -
setInventoryTranslator
-
setCraftingGridFuture
-
setBlockMappings
Stores the block mappings for this specific version. -
setItemMappings
Stores the item translations for this specific version. -
setBiomeGlobalPalette
public void setBiomeGlobalPalette(int biomeGlobalPalette) Required to decode biomes correctly. -
setBiomeTranslations
public void setBiomeTranslations(int[] biomeTranslations) Stores the map between Java and Bedrock biome network IDs. -
setDroppingLecternBook
public void setDroppingLecternBook(boolean droppingLecternBook) -
setLastChunkPosition
public void setLastChunkPosition(org.cloudburstmc.math.vector.Vector2i lastChunkPosition) -
setClientRenderDistance
public void setClientRenderDistance(int clientRenderDistance) -
setSpawned
public void setSpawned(boolean spawned) -
setGameMode
public void setGameMode(com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode) -
setWorldName
Keeps track of the world name for respawning. -
setLevels
As of Java 1.19.3, the client only uses these for commands. -
setPose
public void setPose(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose) Stores the Java pose that the server and/or Geyser believes the player currently has. -
setSprinting
public void setSprinting(boolean sprinting) -
setSwimmingInWater
public void setSwimmingInWater(boolean swimmingInWater) Whether the player is swimming in water. Used to update speed when crawling. -
setOriginalSpeedAttribute
public void setOriginalSpeedAttribute(float originalSpeedAttribute) Tracks the original speed attribute.We need to do this in order to emulate speeds when sneaking under 1.5-blocks-tall areas if the player isn't sneaking, and when crawling.
-
setDimension
The dimension of the player. As all entities are in the same world, this can be safely applied to all other entities. -
setDimensionType
-
setBreakingBlock
public void setBreakingBlock(int breakingBlock) -
setLastBlockPlacePosition
public void setLastBlockPlacePosition(org.cloudburstmc.math.vector.Vector3i lastBlockPlacePosition) -
setLastBlockPlacedId
-
setInteracting
public void setInteracting(boolean interacting) -
setLastInteractionBlockPosition
public void setLastInteractionBlockPosition(org.cloudburstmc.math.vector.Vector3i lastInteractionBlockPosition) Stores the last position of the block the player interacted with. This can either be a block that the client placed or an existing block the player interacted with (for example, a chest).
Initialized as (0, 0, 0) so it is always not-null. -
setLastInteractionPlayerPosition
public void setLastInteractionPlayerPosition(org.cloudburstmc.math.vector.Vector3f lastInteractionPlayerPosition) Stores the position of the player the last time they interacted. Used to verify that the player did not move since their last interaction.
Initialized as (0, 0, 0) so it is always not-null. -
setMouseoverEntity
The entity that the client is currently looking at. -
setJavaToBedrockRecipeIds
Stores all Java recipes by recipe identifier, and matches them to all possible Bedrock recipe identifiers. They are not 1:1, since Bedrock can have multiple recipes for the same Java recipe. -
setCraftingRecipes
public void setCraftingRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserRecipe> craftingRecipes) -
setStonecutterRecipes
public void setStonecutterRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserStonecutterData> stonecutterRecipes) Saves a list of all stonecutter recipes, for use in a stonecutter inventory. The key is the Java ID of the item; the values are all the possible outputs' Java IDs sorted by their string identifier -
setEmulatePost1_13Logic
public void setEmulatePost1_13Logic(boolean emulatePost1_13Logic) Whether to work around 1.13's different behavior in villager trading menus. -
setEmulatePost1_16Logic
public void setEmulatePost1_16Logic(boolean emulatePost1_16Logic) Starting in 1.17, Java servers expect thecarriedItemparameter of the serverbound click container packet to be the current contents of the mouse after the transaction has been done. 1.16 expects the clicked slot contents before any transaction is done. With the current ViaVersion structure, if we do not send what 1.16 expects and send multiple click container packets, then successive transactions will be rejected. -
setEmulatePost1_18Logic
public void setEmulatePost1_18Logic(boolean emulatePost1_18Logic) -
setOldSmithingTable
public void setOldSmithingTable(boolean oldSmithingTable) Whether to emulate pre-1.20 smithing table behavior. Adapts ViaVersion's furnace UI to one Bedrock can use. SeeOldSmithingTableTranslator. -
setAttackSpeed
public void setAttackSpeed(double attackSpeed) The current attack speed of the player. Used for sending proper cooldown timings. Setting a default fixes cooldowns not showing up on a fresh world. -
setLastHitTime
public void setLastHitTime(long lastHitTime) The time of the last hit. Used to gauge how long the cooldown is taking. This is a session variable in order to prevent more scheduled threads than necessary. -
setSteeringLeft
public void setSteeringLeft(boolean steeringLeft) Saves if the client is steering left on a boat. -
setSteeringRight
public void setSteeringRight(boolean steeringRight) Saves if the client is steering right on a boat. -
setLastInteractionTime
public void setLastInteractionTime(long lastInteractionTime) Store the last time the player interacted. Used to fix a right-click spam bug. See this for context. -
setBlockBreakStartTime
public void setBlockBreakStartTime(long blockBreakStartTime) Stores when the player started to break a block. Used to allow correct break time for custom blocks. -
setPlacedBucket
public void setPlacedBucket(boolean placedBucket) Stores whether the player intended to place a bucket. -
setLastMovementTimestamp
public void setLastMovementTimestamp(long lastMovementTimestamp) Used to send a movement packet every three seconds if the player hasn't moved. Prevents timeouts when AFK in certain instances. -
setLastVehicleMoveTimestamp
public void setLastVehicleMoveTimestamp(long lastVehicleMoveTimestamp) Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms -
setOpPermissionLevel
public void setOpPermissionLevel(int opPermissionLevel) The op permission level set by the server -
setCanFly
public void setCanFly(boolean canFly) If the current player can fly -
setInstabuild
public void setInstabuild(boolean instabuild) -
setFlySpeed
public void setFlySpeed(float flySpeed) -
setWalkSpeed
public void setWalkSpeed(float walkSpeed) -
setRaining
public void setRaining(boolean raining) Caches current rain status. -
setThunder
public void setThunder(boolean thunder) Caches current thunder status. -
setWaitingForStatistics
public void setWaitingForStatistics(boolean waitingForStatistics) Whether we're expecting statistics to be sent back to us. -
setAdvancedTooltips
public void setAdvancedTooltips(boolean advancedTooltips) Whether advanced tooltips will be added to the player's items. -
setLookBackScheduledFuture
Used to return the player to their original rotation after using an item in BedrockInventoryTransactionTranslator -
setMountVehicleScheduledFuture
Used to return players back to their vehicles if the server doesn't want them unmounting. -
setCurrentBook
public void setCurrentBook(@Nullable org.cloudburstmc.protocol.bedrock.data.inventory.ItemData currentBook) Stores the book that is currently being read. Used inJavaOpenBookTranslator
-