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 Details

    • sentSpawnPacket

      protected boolean sentSpawnPacket
  • Constructor Details

    • GeyserSession

      public GeyserSession(GeyserImpl geyser, org.cloudburstmc.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop tickEventLoop)
  • Method Details

    • connect

      public void connect()
      Send all necessary packets to load Bedrock into the server
    • authenticate

      public void authenticate(String username)
    • authenticateWithAuthChain

      public void authenticateWithAuthChain(String authChain)
    • 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

      public boolean onMicrosoftLoginComplete(PendingMicrosoftAuthentication.AuthenticationTask task)
      If successful, also begins connecting to the Java server.
    • disconnect

      public void disconnect(String reason)
    • disconnect

      public void disconnect(net.kyori.adventure.text.Component reason)
    • forciblyCloseUpstream

      public void forciblyCloseUpstream()
      Forcibly closes the upstream session
    • ensureInEventLoop

      public void ensureInEventLoop(Runnable runnable)
      Moves task to the session event loop if already not in it. Otherwise, the task is automatically ran.
    • executeInEventLoop

      public void executeInEventLoop(Runnable runnable)
      Executes a task and prints a stack trace if an error occurs.
    • scheduleInEventLoop

      public ScheduledFuture<?> scheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit)
      Schedules a task and prints a stack trace if an error occurs.

      The task will not run if the session is closed.

    • updateTickingState

      public void updateTickingState(float tickRate, boolean frozen)
    • tick

      protected void tick()
      Called every Minecraft tick.
    • startSneaking

      public void startSneaking(boolean updateMetaData)
    • stopSneaking

      public void stopSneaking(boolean updateMetaData)
    • setSpinAttack

      public void setSpinAttack(boolean spinAttack)
    • setGliding

      public void setGliding(boolean gliding)
    • setSwimming

      public void setSwimming(boolean swimming)
    • setCrawling

      public void setCrawling(boolean crawling)
    • setNoClip

      public void setNoClip(boolean noClip)
    • setFlying

      public void setFlying(boolean flying)
    • setGameMode

      public void setGameMode(org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode newGamemode)
    • setClientData

      public void setClientData(BedrockClientData data)
    • useItem

      public void useItem(org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand hand)
      Same as useItem but always default to useTouchRotation false.
    • useItem

      public void useItem(org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand hand, boolean useTouchRotation)
      Convenience method to reduce amount of duplicate code. Sends ServerboundUseItemPacket.
    • releaseItem

      public void releaseItem()
    • activateArmAnimationTicking

      public void activateArmAnimationTicking()
      Starts ticking the amount of time that the Bedrock client has been swinging their arm, and disables blocking if blocking.
    • isHandsBusy

      public boolean isHandsBusy()
      You can't break blocks, attack entities, or use items while driving in a boat
    • requestOffhandSwap

      public void requestOffhandSwap()
    • name

      public String name()
      Specified by:
      name in interface org.geysermc.geyser.api.command.CommandSource
    • sendMessage

      public void sendMessage(@NonNull String message)
      Specified by:
      sendMessage in interface org.geysermc.geyser.api.command.CommandSource
    • isConsole

      public boolean isConsole()
      Specified by:
      isConsole in interface org.geysermc.geyser.api.command.CommandSource
    • playerUuid

      public UUID playerUuid()
      Specified by:
      playerUuid in interface org.geysermc.geyser.api.command.CommandSource
    • connection

      public GeyserSession connection()
      Specified by:
      connection in interface org.geysermc.geyser.api.command.CommandSource
      Specified by:
      connection in interface GeyserCommandSource
    • locale

      public String locale()
      Description copied from interface: GeyserCommandSource
      Specified by:
      locale in interface org.geysermc.geyser.api.command.CommandSource
      Specified by:
      locale in interface GeyserCommandSource
    • hasPermission

      public boolean hasPermission(String permission)
      Specified by:
      hasPermission in interface org.geysermc.geyser.api.command.CommandSource
    • sendChat

      public void sendChat(String message)
      Sends a chat message to the Java server.
    • sendCommandPacket

      public void sendCommandPacket(String command)
      Sends a command to the Java server.
    • sendCommand

      public void sendCommand(String command)
      Runs the command through platform specific command registries if applicable else, it sends the command to the server.
      Specified by:
      sendCommand in interface org.geysermc.geyser.api.connection.GeyserConnection
    • joinAddress

      public @NonNull String joinAddress()
      Specified by:
      joinAddress in interface org.geysermc.geyser.api.connection.GeyserConnection
    • joinPort

      public @org.checkerframework.checker.index.qual.Positive int joinPort()
      Specified by:
      joinPort in interface org.geysermc.geyser.api.connection.GeyserConnection
    • sendSkin

      public void sendSkin(@NonNull UUID player, @NonNull org.geysermc.geyser.api.skin.SkinData skinData)
      Specified by:
      sendSkin in interface org.geysermc.geyser.api.connection.GeyserConnection
    • openPauseScreenAdditions

      public void openPauseScreenAdditions()
      Specified by:
      openPauseScreenAdditions in interface org.geysermc.geyser.api.connection.GeyserConnection
    • openQuickActions

      public void openQuickActions()
      Specified by:
      openQuickActions in interface org.geysermc.geyser.api.connection.GeyserConnection
    • setClientRenderDistance

      public void setClientRenderDistance(int clientRenderDistance)
    • setServerRenderDistance

      public void setServerRenderDistance(int renderDistance)
    • getSocketAddress

      public InetSocketAddress getSocketAddress()
    • sendForm

      public boolean sendForm(@NonNull org.geysermc.cumulus.form.Form form)
      Specified by:
      sendForm in interface org.geysermc.api.connection.Connection
    • sendDialogForm

      public void sendDialogForm(@NonNull org.geysermc.cumulus.form.Form form)
      Sends a form without first closing any open dialog. This should only be used by Dialogs.
    • acceptCodeOfConduct

      public void acceptCodeOfConduct()
    • prepareForConfigurationForm

      public void prepareForConfigurationForm()
    • getPlayerInventory

      public @NonNull PlayerInventory getPlayerInventory()
    • getOpenInventory

      public @Nullable Inventory getOpenInventory()
    • sendForm

      public boolean sendForm(@NonNull org.geysermc.cumulus.form.util.FormBuilder<?,?,?> formBuilder)
      Specified by:
      sendForm in interface org.geysermc.api.connection.Connection
    • sendForm

      @Deprecated public void sendForm(org.geysermc.cumulus.Form<?> form)
      Deprecated.
      since Cumulus version 1.1, and will be removed when Cumulus 2.0 releases. Please use the new forms instead.
    • sendForm

      @Deprecated public void sendForm(org.geysermc.cumulus.util.FormBuilder<?,?> formBuilder)
      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.Vector3f 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 Cloudburst 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 Cloudburst protocol lib
    • sendDownstreamGamePacket

      public void sendDownstreamGamePacket(org.geysermc.mcprotocollib.network.packet.Packet packet)
      Send a packet to the remote server if in the game state.
      Parameters:
      packet - the java edition packet from MCProtocolLib
    • sendDownstreamConfigurationPacket

      public void sendDownstreamConfigurationPacket(org.geysermc.mcprotocollib.network.packet.Packet packet)
    • sendDownstreamLoginPacket

      public void sendDownstreamLoginPacket(org.geysermc.mcprotocollib.network.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(org.geysermc.mcprotocollib.network.packet.Packet packet, org.geysermc.mcprotocollib.protocol.data.ProtocolState intendedState)
      Send a packet to the remote server if in the specified state.
      Parameters:
      packet - the java edition packet from MCProtocolLib
      intendedState - the state the client should be in
    • sendDownstreamPacket

      public void sendDownstreamPacket(org.geysermc.mcprotocollib.network.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 login and configuration screens along-side normal usage
      Parameters:
      doCycle - If the cycle should continue
    • sendGameRule

      public void sendGameRule(String gameRule, Object value)
      Send a gamerule value to the client
      Parameters:
      gameRule - The gamerule to send
      value - The value of the gamerule
    • 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<org.geysermc.mcprotocollib.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

      public void refreshEmotes(List<UUID> emotes)
    • 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()
    • updateRain

      public void updateRain(float strength)
      Sends a packet to update rain strength. Stops rain if strength is 0.
      Parameters:
      strength - value between 0 and 1
    • updateThunder

      public void updateThunder(float strength)
      Sends a packet to update thunderstorm strength. Stops thunderstorm if strength is 0.
      Parameters:
      strength - value between 0 and 1
    • isRaining

      public boolean isRaining()
    • isThunder

      public boolean isThunder()
    • bedrockUsername

      public @NonNull String bedrockUsername()
      Specified by:
      bedrockUsername in interface org.geysermc.api.connection.Connection
    • javaUsername

      public @MonotonicNonNull String javaUsername()
      Specified by:
      javaUsername in interface org.geysermc.api.connection.Connection
    • javaUuid

      public UUID javaUuid()
      Specified by:
      javaUuid in interface org.geysermc.api.connection.Connection
    • xuid

      public @NonNull String xuid()
      Specified by:
      xuid in interface org.geysermc.api.connection.Connection
    • version

      public @NonNull String version()
      Specified by:
      version in interface org.geysermc.api.connection.Connection
    • platform

      public @NonNull org.geysermc.api.util.BedrockPlatform platform()
      Specified by:
      platform in interface org.geysermc.api.connection.Connection
    • languageCode

      public @NonNull String languageCode()
      Specified by:
      languageCode in interface org.geysermc.api.connection.Connection
    • uiProfile

      public @NonNull org.geysermc.api.util.UiProfile uiProfile()
      Specified by:
      uiProfile in interface org.geysermc.api.connection.Connection
    • inputMode

      public @NonNull org.geysermc.api.util.InputMode inputMode()
      Specified by:
      inputMode in interface org.geysermc.api.connection.Connection
    • isLinked

      public boolean isLinked()
      Specified by:
      isLinked in interface org.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:
      transfer in interface org.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:
      entityByJavaId in interface org.geysermc.geyser.api.connection.GeyserConnection
    • showEmote

      public void showEmote(@NonNull org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity emoter, @NonNull String emoteId)
      Specified by:
      showEmote in interface org.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:
      camera in interface org.geysermc.geyser.api.connection.GeyserConnection
    • entities

      public @NonNull org.geysermc.geyser.api.entity.EntityData entities()
      Specified by:
      entities in interface org.geysermc.geyser.api.connection.GeyserConnection
    • shakeCamera

      public void shakeCamera(float intensity, float duration, @NonNull org.geysermc.geyser.api.bedrock.camera.CameraShake type)
      Specified by:
      shakeCamera in interface org.geysermc.geyser.api.connection.GeyserConnection
    • stopCameraShake

      public void stopCameraShake()
      Specified by:
      stopCameraShake in interface org.geysermc.geyser.api.connection.GeyserConnection
    • sendFog

      public void sendFog(String... fogNameSpaces)
      Specified by:
      sendFog in interface org.geysermc.geyser.api.connection.GeyserConnection
    • removeFog

      public void removeFog(String... fogNameSpaces)
      Specified by:
      removeFog in interface org.geysermc.geyser.api.connection.GeyserConnection
    • fogEffects

      public @NonNull Set<String> fogEffects()
      Specified by:
      fogEffects in interface org.geysermc.geyser.api.connection.GeyserConnection
    • ping

      public int ping()
      Specified by:
      ping in interface org.geysermc.geyser.api.connection.GeyserConnection
    • protocolVersion

      public int protocolVersion()
      Specified by:
      protocolVersion in interface org.geysermc.geyser.api.connection.GeyserConnection
    • hasFormOpen

      public boolean hasFormOpen()
      Specified by:
      hasFormOpen in interface org.geysermc.geyser.api.connection.GeyserConnection
    • closeForm

      public void closeForm()
      Specified by:
      closeForm in interface org.geysermc.geyser.api.connection.GeyserConnection
    • addCommandEnum

      public void addCommandEnum(String name, String enums)
    • removeCommandEnum

      public void removeCommandEnum(String name, String enums)
    • getDebugInfo

      public String getDebugInfo()
    • getGeyser

      public GeyserImpl getGeyser()
    • getUpstream

      public UpstreamSession getUpstream()
    • getDownstream

      public DownstreamSession getDownstream()
    • getTickEventLoop

      public io.netty.channel.EventLoop getTickEventLoop()
      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

      public AuthData getAuthData()
    • getClientData

      public BedrockClientData getClientData()
    • getCertChainData

      public List<String> getCertChainData()
      Used for Floodgate skin uploading
    • getErosionHandler

      public @NonNull AbstractGeyserboundPacketHandler getErosionHandler()
    • remoteServer

      public org.geysermc.geyser.api.network.RemoteServer remoteServer()
    • getPlayerEntity

      public SessionPlayerEntity getPlayerEntity()
    • getAdvancementsCache

      public AdvancementsCache getAdvancementsCache()
    • getBookEditCache

      public BookEditCache getBookEditCache()
    • getBundleCache

      public BundleCache getBundleCache()
    • getChunkCache

      public ChunkCache getChunkCache()
    • getEntityCache

      public EntityCache getEntityCache()
    • getEffectCache

      public EntityEffectCache getEffectCache()
    • getFormCache

      public FormCache getFormCache()
    • getInputCache

      public InputCache getInputCache()
    • getLodestoneCache

      public LodestoneCache getLodestoneCache()
    • getPistonCache

      public PistonCache getPistonCache()
    • getPreferencesCache

      public PreferencesCache getPreferencesCache()
    • getRegistryCache

      public RegistryCache getRegistryCache()
    • getSkullCache

      public SkullCache getSkullCache()
    • getStructureBlockCache

      public StructureBlockCache getStructureBlockCache()
    • getTagCache

      public TagCache getTagCache()
    • getWaypointCache

      public WaypointCache getWaypointCache()
    • getWorldCache

      public WorldCache getWorldCache()
    • getBlockBreakHandler

      public BlockBreakHandler getBlockBreakHandler()
      Handles block breaking and break animation progress caching.
    • getUnconfirmedTeleport

      public TeleportCache getUnconfirmedTeleport()
    • getWorldBorder

      public WorldBorder getWorldBorder()
    • isInWorldBorderWarningArea

      public boolean isInWorldBorderWarningArea()
      Whether simulated fog has been sent to the client or not.
    • getPlayerInventoryHolder

      public InventoryHolder<PlayerInventory> getPlayerInventoryHolder()
      Stores the player inventory and player inventory translator
    • getInventoryHolder

      public @Nullable InventoryHolder<? extends Inventory> getInventoryHolder()
      Stores the current open Bedrock inventory, including the correct translator. Prefer using InventoryUtils.getInventory(GeyserSession, int), as this method can e.g. return a InventoryHolder<LecternContainer> due to the workaround in LecternContainer.isBookInPlayerInventory() workaround.
    • getDialogManager

      public DialogManager getDialogManager()
    • getServerLinks

      public List<org.geysermc.mcprotocollib.protocol.data.game.ServerLink> getServerLinks()
      A list of links sent to us by the server in the server links packet.
    • getKnownCommands

      public List<String> getKnownCommands()
      A list of commands known to the client. These are all the commands that have been sent to us by the server.
    • getRestrictedCommands

      public List<String> getRestrictedCommands()
      A list of "restricted" commands known to the client. These are all the commands that have been sent to us by the server, and require some sort of elevated permissions.
    • isClosingInventory

      public boolean isClosingInventory()
      Whether the client is currently closing an inventory. Used to open new inventories while another one is currently open.
    • getPendingOrCurrentBedrockInventoryId

      public int getPendingOrCurrentBedrockInventoryId()
      Stores the bedrock inventory id of the pending inventory, or -1 if no inventory is pending. This id is only set when the block that should be opened exists.
    • getContainerOutputFuture

      public ScheduledFuture<?> getContainerOutputFuture()
    • getCollisionManager

      public CollisionManager getCollisionManager()
      Stores session collision
    • getBlockMappings

      public BlockMappings getBlockMappings()
      Stores the block mappings for this specific version.
    • getItemMappings

      public ItemMappings getItemMappings()
      Stores the item translations for this specific version.
    • getItemFrameCache

      public Map<org.cloudburstmc.math.vector.Vector3i,ItemFrameEntity> getItemFrameCache()
      A map of Vector3i positions to Java entities. Used for translating Bedrock block actions to Java entity actions.
    • getPlayerWithCustomHeads

      public Map<UUID,org.geysermc.mcprotocollib.protocol.data.game.entity.player.ResolvableProfile> getPlayerWithCustomHeads()
      A map of all players (and their heads) that are wearing a player head 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 org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode getGameMode()
    • getWorldName

      public net.kyori.adventure.key.Key getWorldName()
      Keeps track of the world name for respawning.
    • getLevels

      public String[] getLevels()
      As of Java 1.19.3, the client only uses these for commands.
    • isSneaking

      public boolean isSneaking()
    • isShouldSendSneak

      public boolean isShouldSendSneak()
      Used to send a shift state for a tick to dismount from entitites
    • getPose

      public org.geysermc.mcprotocollib.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()
      This is used to keep track of player sprinting and should only change by START_SPRINT and STOP_SPRINT sent by the player, not from flag update.
    • getBedrockOverworldDimension

      public BedrockDimension getBedrockOverworldDimension()
      The overworld dimension which Bedrock Edition uses.
    • getDimensionType

      public @MonotonicNonNull JavaDimension getDimensionType()
      The dimension of the player. As all entities are in the same world, this can be safely applied to all other entities.
    • getBedrockDimension

      public BedrockDimension getBedrockDimension()
      Which dimension Bedrock understands themselves to be in. This should only be set after the ChangeDimensionPacket is sent, or right before the StartGamePacket is sent.
    • getLastBlockPlacePosition

      public org.cloudburstmc.math.vector.Vector3i getLastBlockPlacePosition()
    • getLastBlockPlaced

      public BlockItem getLastBlockPlaced()
    • 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

      public Entity getMouseoverEntity()
      The entity that the client is currently looking at.
    • getJavaToBedrockRecipeIds

      public it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<String>> getJavaToBedrockRecipeIds()
      Stores all Java recipes by ID, and matches them to all possible Bedrock recipe identifiers.
    • getCraftingRecipes

      public it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserRecipe> getCraftingRecipes()
    • getLastCreatedRecipe

      public it.unimi.dsi.fastutil.Pair<org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.CraftingRecipeData,GeyserRecipe> getLastCreatedRecipe()
    • getLastRecipeNetId

      public AtomicInteger getLastRecipeNetId()
    • getStonecutterRecipes

      public it.unimi.dsi.fastutil.ints.Int2ObjectMap<GeyserStonecutterData> getStonecutterRecipes()
      Saves a list of all stonecutter recipes, for use in a stonecutter inventory. The key is the Bedrock recipe net ID; the values are their respective output and button ID.
    • getSmithingRecipes

      public List<GeyserSmithingRecipe> getSmithingRecipes()
    • 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 the carriedItem parameter 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. See OldSmithingTableTranslator.
    • isUsingExperimentalMinecartLogic

      public boolean isUsingExperimentalMinecartLogic()
      Whether to use the minecart_improvements experiment
    • 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.
    • isPlacedBucket

      public boolean isPlacedBucket()
      Stores whether the player intended to place a bucket.
    • getArmAnimationTicks

      public int getArmAnimationTicks()
      Counts how many ticks have occurred since an arm animation started. -1 means there is no active arm swing
    • getLastAirHitTick

      public int getLastAirHitTick()
      The tick in which the player last hit air. Used to ensure we dont send two sing packets for one hit.
    • getAttachedFireworkRockets

      public List<Long> getAttachedFireworkRockets()
      Keep track of fireworks rockets that are attached to the player. Used to keep track of attached fireworks rocket and improve fireworks rocket boosting parity.
    • 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
    • isNoClip

      public boolean isNoClip()
      If the current player should be able to noclip through blocks, this is used for void floor workaround and not spectator.
    • isInstabuild

      public boolean isInstabuild()
    • getFlySpeed

      public float getFlySpeed()
    • getWalkSpeed

      public float getWalkSpeed()
    • getRainStrength

      public float getRainStrength()
      Caches current rain strength. Value between 0 and 1.
    • getThunderStrength

      public float getThunderStrength()
      Caches current thunder strength. Value between 0 and 1.
    • getStatistics

      public it.unimi.dsi.fastutil.objects.Object2IntMap<org.geysermc.mcprotocollib.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

      public Set<UUID> getEmotes()
    • isAdvancedTooltips

      public boolean isAdvancedTooltips()
      Whether advanced tooltips will be added to the player's items.
    • getTickThread

      public ScheduledFuture<?> getTickThread()
      The thread that will run every game tick.
    • getTicks

      public int getTicks()
      The number of ticks that have elapsed since the start of this session
    • getClientTicks

      public long getClientTicks()
      The number of ticks that have elapsed since the start of this session according to the client.
    • getWorldTicks

      public long getWorldTicks()
      The world time in ticks according to the server

      Note: The TickingStatePacket is currently ignored.

    • getMountVehicleScheduledFuture

      public ScheduledFuture<?> getMountVehicleScheduledFuture()
      Used to return players back to their vehicles if the server doesn't want them unmounting.
    • getKeepAliveCache

      public Queue<Long> 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 if GeyserConfiguration.isForwardPlayerPing() is enabled.
    • getCurrentBook

      public @Nullable org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getCurrentBook()
      Stores the book that is currently being read. Used in JavaOpenBookTranslator
    • getCookies

      public Map<String,byte[]> getCookies()
      Stores cookies sent by the Java server.
    • getCameraData

      public GeyserCameraData getCameraData()
    • getEntityData

      public GeyserEntityData getEntityData()
    • getNanosecondsPerTick

      public int getNanosecondsPerTick()
    • getMillisecondsPerTick

      public float getMillisecondsPerTick()
    • isTickingFrozen

      public boolean isTickingFrozen()
    • getStepTicks

      public int getStepTicks()
      The amount of ticks requested by the server that the game should proceed with, even if the game tick loop is frozen.
    • isAllowVibrantVisuals

      public boolean isAllowVibrantVisuals()
    • hasAcceptedCodeOfConduct

      public boolean hasAcceptedCodeOfConduct()
    • setAuthData

      public void setAuthData(AuthData authData)
    • setCertChainData

      public void setCertChainData(List<String> certChainData)
      Used for Floodgate skin uploading
    • setErosionHandler

      public void setErosionHandler(@NonNull AbstractGeyserboundPacketHandler erosionHandler)
    • remoteServer

      public GeyserSession remoteServer(org.geysermc.geyser.api.network.RemoteServer remoteServer)
      Returns:
      this.
    • setBlockBreakHandler

      public void setBlockBreakHandler(BlockBreakHandler blockBreakHandler)
      Handles block breaking and break animation progress caching.
    • setUnconfirmedTeleport

      public void setUnconfirmedTeleport(TeleportCache unconfirmedTeleport)
    • setInventoryHolder

      public void setInventoryHolder(@Nullable InventoryHolder<? extends Inventory> inventoryHolder)
      Stores the current open Bedrock inventory, including the correct translator. Prefer using InventoryUtils.getInventory(GeyserSession, int), as this method can e.g. return a InventoryHolder<LecternContainer> due to the workaround in LecternContainer.isBookInPlayerInventory() workaround.
    • setServerLinks

      public void setServerLinks(List<org.geysermc.mcprotocollib.protocol.data.game.ServerLink> serverLinks)
      A list of links sent to us by the server in the server links packet.
    • setKnownCommands

      public void setKnownCommands(List<String> knownCommands)
      A list of commands known to the client. These are all the commands that have been sent to us by the server.
    • setRestrictedCommands

      public void setRestrictedCommands(List<String> restrictedCommands)
      A list of "restricted" commands known to the client. These are all the commands that have been sent to us by the server, and require some sort of elevated permissions.
    • setClosingInventory

      public void setClosingInventory(boolean closingInventory)
      Whether the client is currently closing an inventory. Used to open new inventories while another one is currently open.
    • setPendingOrCurrentBedrockInventoryId

      public void setPendingOrCurrentBedrockInventoryId(int pendingOrCurrentBedrockInventoryId)
      Stores the bedrock inventory id of the pending inventory, or -1 if no inventory is pending. This id is only set when the block that should be opened exists.
    • setContainerOutputFuture

      public void setContainerOutputFuture(ScheduledFuture<?> containerOutputFuture)
    • setBlockMappings

      public void setBlockMappings(BlockMappings blockMappings)
      Stores the block mappings for this specific version.
    • setItemMappings

      public void setItemMappings(ItemMappings itemMappings)
      Stores the item translations for this specific version.
    • setDroppingLecternBook

      public void setDroppingLecternBook(boolean droppingLecternBook)
    • setLastChunkPosition

      public void setLastChunkPosition(org.cloudburstmc.math.vector.Vector2i lastChunkPosition)
    • setSpawned

      public void setSpawned(boolean spawned)
    • setWorldName

      public void setWorldName(net.kyori.adventure.key.Key worldName)
      Keeps track of the world name for respawning.
    • setLevels

      public void setLevels(String[] levels)
      As of Java 1.19.3, the client only uses these for commands.
    • setShouldSendSneak

      public void setShouldSendSneak(boolean shouldSendSneak)
      Used to send a shift state for a tick to dismount from entitites
    • setPose

      public void setPose(org.geysermc.mcprotocollib.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)
      This is used to keep track of player sprinting and should only change by START_SPRINT and STOP_SPRINT sent by the player, not from flag update.
    • setDimensionType

      public void setDimensionType(@MonotonicNonNull JavaDimension dimensionType)
      The dimension of the player. As all entities are in the same world, this can be safely applied to all other entities.
    • setBedrockDimension

      public void setBedrockDimension(BedrockDimension bedrockDimension)
      Which dimension Bedrock understands themselves to be in. This should only be set after the ChangeDimensionPacket is sent, or right before the StartGamePacket is sent.
    • setLastBlockPlacePosition

      public void setLastBlockPlacePosition(org.cloudburstmc.math.vector.Vector3i lastBlockPlacePosition)
    • setLastBlockPlaced

      public void setLastBlockPlaced(BlockItem lastBlockPlaced)
    • 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

      public void setMouseoverEntity(Entity mouseoverEntity)
      The entity that the client is currently looking at.
    • setLastCreatedRecipe

      public void setLastCreatedRecipe(it.unimi.dsi.fastutil.Pair<org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.CraftingRecipeData,GeyserRecipe> lastCreatedRecipe)
    • 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 Bedrock recipe net ID; the values are their respective output and button ID.
    • 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 the carriedItem parameter 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. See OldSmithingTableTranslator.
    • setUsingExperimentalMinecartLogic

      public void setUsingExperimentalMinecartLogic(boolean isUsingExperimentalMinecartLogic)
      Whether to use the minecart_improvements experiment
    • 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.
    • setPlacedBucket

      public void setPlacedBucket(boolean placedBucket)
      Stores whether the player intended to place a bucket.
    • setLastAirHitTick

      public void setLastAirHitTick(int lastAirHitTick)
      The tick in which the player last hit air. Used to ensure we dont send two sing packets for one hit.
    • 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)
    • 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.
    • setClientTicks

      public void setClientTicks(long clientTicks)
      The number of ticks that have elapsed since the start of this session according to the client.
    • setWorldTicks

      public void setWorldTicks(long worldTicks)
      The world time in ticks according to the server

      Note: The TickingStatePacket is currently ignored.

    • setMountVehicleScheduledFuture

      public void setMountVehicleScheduledFuture(ScheduledFuture<?> mountVehicleScheduledFuture)
      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 in JavaOpenBookTranslator
    • setCookies

      public void setCookies(Map<String,byte[]> cookies)
      Stores cookies sent by the Java server.
    • setStepTicks

      public void setStepTicks(int stepTicks)
      The amount of ticks requested by the server that the game should proceed with, even if the game tick loop is frozen.
    • setAllowVibrantVisuals

      public void setAllowVibrantVisuals(boolean allowVibrantVisuals)