Package org.geysermc.geyser.session
Class GeyserSession
java.lang.Object
org.geysermc.geyser.session.GeyserSession
- All Implemented Interfaces:
Connection,GeyserConnection,CommandSender
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeyserSession(GeyserImpl geyser, com.nukkitx.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTeleport(TeleportCache teleportCache)com.nukkitx.protocol.bedrock.data.AttributeDataAdjusts speed if the player is crawling.voidauthenticate(String username)voidauthenticate(String username, String password)voidPresent a form window to the user asking to log in with another web browservoidclose()voidconfirmTeleport(com.nukkitx.math.vector.Vector3d position)voidconnect()Send all necessary packets to load Bedrock into the serverprotected voidWill be overwritten for GeyserConnect.voiddisconnect(String reason)voidexecuteInEventLoop(Runnable runnable)Executes a task and prints a stack trace if an error occurs.doubleThe current attack speed of the player.intRequired to decode biomes correctly.it.unimi.dsi.fastutil.ints.Int2IntMapStores the map between Java and Bedrock biome network IDs.Stores the block mappings for this specific version.intStores a future interaction to place a bucket.Stores session collisionit.unimi.dsi.fastutil.ints.Int2ObjectMap<com.github.steveice10.mc.protocol.data.game.recipe.Recipe>The dimension of the player.com.github.steveice10.packetlib.tcp.TcpSessionio.netty.channel.EventLoopThe loop where all packets and ticking is processed to prevent concurrency issues.com.github.steveice10.mc.protocol.data.game.entity.player.GameModeMap<com.nukkitx.math.vector.Vector3i,ItemFrameEntity>A map of Vector3i positions to Java entities.Stores the item translations for this specific version.com.nukkitx.math.vector.Vector3icom.nukkitx.math.vector.Vector2ilongThe time of the last hit.com.nukkitx.math.vector.Vector3iStores the last position of the block the player interacted with.com.nukkitx.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.Stores the last text inputted into a sign.longUsed to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100msSet<com.nukkitx.math.vector.Vector3i>Stores a list of all lectern locations and their block entity tags.Returns the locale of the command sender.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.MinecraftProtocolintintMap<com.nukkitx.math.vector.Vector3i,SkullPlayerEntity>Stores a map of all statistics sent from the server.it.unimi.dsi.fastutil.ints.Int2ObjectMap<it.unimi.dsi.fastutil.ints.IntList>Saves a list of all stonecutter recipes, for use in a stonecutter inventory.it.unimi.dsi.fastutil.longs.Long2ObjectMap<com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket>it.unimi.dsi.fastutil.ints.Int2ObjectMap<TeleportCache>The thread that will run every 50 milliseconds - one Minecraft tick.Keeps track of the world name for respawning.voidhandleDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)booleanhasPermission(String permission)Checks if the given session's player has a permissionbooleanWhether 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.booleanbooleanisFlying()If the current player is flyingbooleanbooleanWhether simulated fog has been sent to the client or not.booleanbooleanbooleanDeprecated.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.voidlogin()name()Gets the name of the connection.voidreceiveDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)Inject a packet as if it was received by the downstream serverbooleanreceiveUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Inject a packet as if it was received by the upstream clientvoidrefreshEmotes(List<UUID> emotes)voidregisterPluginChannel(String channel)Register a Plugin ChannelscheduleInEventLoop(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 flagsvoidsendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)Send a packet to the remote server.voidsendForm(org.geysermc.cumulus.Form form)voidsendForm(org.geysermc.cumulus.util.FormBuilder<?,?> formBuilder)voidsendGameRule(String gameRule, Object value)Send a gamerule value to the clientvoidsendMessage(String message)voidsendPluginMessage(String channel, byte[] data)Send message on a Plugin Channel - https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channelvoidsendUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Queue a packet to be sent to player.voidsendUpstreamPacketImmediately(com.nukkitx.protocol.bedrock.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.voidsetBlockMappings(BlockMappings blockMappings)Stores the block mappings for this specific version.voidsetBreakingBlock(int breakingBlock)voidsetBucketScheduledFuture(ScheduledFuture<?> bucketScheduledFuture)Stores a future interaction to place a bucket.voidsetCanFly(boolean canFly)If the current player can flyvoidsetClientData(BedrockClientData clientData)voidsetClosingInventory(boolean closingInventory)voidsetCraftingGridFuture(ScheduledFuture<?> craftingGridFuture)voidsetCraftingRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<com.github.steveice10.mc.protocol.data.game.recipe.Recipe> craftingRecipes)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.voidsetDroppingLecternBook(boolean droppingLecternBook)voidsetFlying(boolean flying)voidsetGameMode(com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode)voidsetInteracting(boolean interacting)voidsetInventoryTranslator(InventoryTranslator inventoryTranslator)voidsetItemMappings(ItemMappings itemMappings)Stores the item translations for this specific version.voidsetLastBlockPlacedId(String lastBlockPlacedId)voidsetLastBlockPlacePosition(com.nukkitx.math.vector.Vector3i lastBlockPlacePosition)voidsetLastChunkPosition(com.nukkitx.math.vector.Vector2i lastChunkPosition)voidsetLastHitTime(long lastHitTime)The time of the last hit.voidsetLastInteractionBlockPosition(com.nukkitx.math.vector.Vector3i lastInteractionBlockPosition)Stores the last position of the block the player interacted with.voidsetLastInteractionPlayerPosition(com.nukkitx.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.voidsetLastSignMessage(String lastSignMessage)Stores the last text inputted into a sign.voidsetLastVehicleMoveTimestamp(long lastVehicleMoveTimestamp)Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100msvoidsetMicrosoftAccount(boolean microsoftAccount)Deprecated.voidsetMouseoverEntity(Entity mouseoverEntity)The entity that the client is currently looking at.voidsetOpenInventory(Inventory openInventory)voidsetOpPermissionLevel(int opPermissionLevel)The op permission level set by the servervoidsetOriginalSpeedAttribute(float originalSpeedAttribute)Tracks the original speed attribute.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.voidsetRemoteAddress(String remoteAddress)voidsetRemoteAuthType(AuthType remoteAuthType)voidsetRemotePort(int remotePort)voidsetRenderDistance(int renderDistance)voidsetRidingVehicleEntity(Entity ridingVehicleEntity)voidsetSneaking(boolean sneaking)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<it.unimi.dsi.fastutil.ints.IntList> 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.voidsetWaitingForStatistics(boolean waitingForStatistics)Whether we're expecting statistics to be sent back to us.voidsetWorldName(String worldName)Keeps track of the world name for respawning.protected voidtick()Called every 50 milliseconds - one Minecraft tick.voidunregisterPluginChannel(String channel)Unregister a Plugin ChannelvoidupdateStatistics(@NonNull Map<com.github.steveice10.mc.protocol.data.game.statistic.Statistic,Integer> statistics)Used for updating statistic values since we only get changes from the serveruuid()Gets theUUIDof the connection.xuid()Gets the XUID of the connection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.geyser.command.CommandSender
sendMessage
-
Field Details
-
sentSpawnPacket
protected boolean sentSpawnPacket
-
-
Constructor Details
-
GeyserSession
public GeyserSession(GeyserImpl geyser, com.nukkitx.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 -
login
public void login() -
authenticate
-
authenticate
-
authenticateWithMicrosoftCode
public void authenticateWithMicrosoftCode()Present a form window to the user asking to log in with another web browser -
handleDownstreamPacket
public void handleDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet) -
disconnect
-
close
public void close() -
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
-
setSneaking
public void setSneaking(boolean sneaking) -
setSwimming
public void setSwimming(boolean swimming) -
setFlying
public void setFlying(boolean flying) -
adjustSpeed
public com.nukkitx.protocol.bedrock.data.AttributeData adjustSpeed()Adjusts speed if the player is crawling.- Returns:
- not null if attributes should be updated.
-
disableSrvResolving
protected void disableSrvResolving()Will be overwritten for GeyserConnect. -
name
Description copied from interface:ConnectionGets the name of the connection.- Specified by:
namein interfaceCommandSender- Specified by:
namein interfaceConnection- Returns:
- the name of the connection
-
uuid
Description copied from interface:ConnectionGets theUUIDof the connection.- Specified by:
uuidin interfaceConnection- Returns:
- the UUID of the connection
-
xuid
Description copied from interface:ConnectionGets the XUID of the connection.- Specified by:
xuidin interfaceConnection- Returns:
- the XUID of the connection
-
sendMessage
- Specified by:
sendMessagein interfaceCommandSender
-
isConsole
public boolean isConsole()- Specified by:
isConsolein interfaceCommandSender- Returns:
- true if the specified sender is from the console.
-
getLocale
Description copied from interface:CommandSenderReturns the locale of the command sender. Defaults to the default locale atGeyserLocale.getDefaultLocale().- Specified by:
getLocalein interfaceCommandSender- Returns:
- the locale of the command sender.
-
setRenderDistance
public void setRenderDistance(int renderDistance) -
getSocketAddress
-
sendForm
public void sendForm(org.geysermc.cumulus.Form form) -
sendForm
public void sendForm(org.geysermc.cumulus.util.FormBuilder<?,?> formBuilder) -
getNextItemNetId
public int getNextItemNetId()- Returns:
- the next Bedrock item network ID to use for a new item
-
addTeleport
-
confirmTeleport
public void confirmTeleport(com.nukkitx.math.vector.Vector3d position) -
sendUpstreamPacket
public void sendUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Queue a packet to be sent to player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
receiveUpstreamPacket
public boolean receiveUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)Inject a packet as if it was received by the upstream client- Parameters:
packet- the bedrock packet to be injected- Returns:
- true if handled
-
receiveDownstreamPacket
public void receiveDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)Inject a packet as if it was received by the downstream server- Parameters:
packet- the java packet to be injected
-
sendUpstreamPacketImmediately
public void sendUpstreamPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)Send a packet immediately to the player.- Parameters:
packet- the bedrock packet from the NukkitX protocol lib
-
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 interfaceCommandSender- 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 -
updateStatistics
public void updateStatistics(@NonNull @NonNull Map<com.github.steveice10.mc.protocol.data.game.statistic.Statistic,Integer> statistics)Used for updating statistic values since we only get changes from the server- Parameters:
statistics- Updated statistics values
-
refreshEmotes
-
sendPluginMessage
Send message on a Plugin Channel - https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel- Parameters:
channel- channel to send ondata- payload
-
registerPluginChannel
Register a Plugin Channel- Parameters:
channel- Channel to register
-
unregisterPluginChannel
Unregister a Plugin Channel- Parameters:
channel- Channel to unregister
-
getGeyser
-
getUpstream
-
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. -
getDownstream
public com.github.steveice10.packetlib.tcp.TcpSession getDownstream() -
getAuthData
-
getClientData
-
getRemoteAddress
-
getRemotePort
public int getRemotePort() -
getRemoteAuthType
-
isMicrosoftAccount
Deprecated. -
getPlayerEntity
-
getAdvancementsCache
-
getBookEditCache
-
getChunkCache
-
getEntityCache
-
getEffectCache
-
getFormCache
-
getLodestoneCache
-
getPistonCache
-
getPreferencesCache
-
getTagCache
-
getWorldCache
-
getTeleportMap
-
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. -
getSkullCache
-
getStoredMaps
public it.unimi.dsi.fastutil.longs.Long2ObjectMap<com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket> getStoredMaps() -
getBiomeGlobalPalette
public int getBiomeGlobalPalette()Required to decode biomes correctly. -
getBiomeTranslations
public it.unimi.dsi.fastutil.ints.Int2IntMap 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.getLecternDataAt(GeyserSession, int, int, int, boolean)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 com.nukkitx.math.vector.Vector2i getLastChunkPosition() -
getRenderDistance
public int getRenderDistance() -
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. -
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. -
getBreakingBlock
public int getBreakingBlock() -
getLastBlockPlacePosition
public com.nukkitx.math.vector.Vector3i getLastBlockPlacePosition() -
getLastBlockPlacedId
-
isInteracting
public boolean isInteracting() -
getLastInteractionBlockPosition
public com.nukkitx.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 com.nukkitx.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. -
getRidingVehicleEntity
-
getMouseoverEntity
The entity that the client is currently looking at. -
getCraftingRecipes
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<com.github.steveice10.mc.protocol.data.game.recipe.Recipe> getCraftingRecipes() -
getUnlockedRecipes
-
getLastRecipeNetId
-
getStonecutterRecipes
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<it.unimi.dsi.fastutil.ints.IntList> 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 -
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 https://github.com/GeyserMC/Geyser/issues/503 for context. -
getBucketScheduledFuture
Stores a future interaction to place a bucket. Will be cancelled if the client instead intended to interact with a block. -
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 -
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 -
isRaining
public boolean isRaining()Caches current rain status. -
isThunder
public boolean isThunder()Caches current thunder status. -
getLastSignMessage
Stores the last text inputted into a sign.Bedrock sends packets every time you update the sign, Java only wants the final packet. Until we determine that the user has finished editing, we save the sign's current status.
-
getStatistics
public Map<com.github.steveice10.mc.protocol.data.game.statistic.Statistic,Integer> 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. -
getProtocol
public com.github.steveice10.mc.protocol.MinecraftProtocol getProtocol() -
setAuthData
-
setClientData
-
setRemoteAddress
-
setRemotePort
public void setRemotePort(int remotePort) -
setRemoteAuthType
-
setMicrosoftAccount
Deprecated. -
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. -
setDroppingLecternBook
public void setDroppingLecternBook(boolean droppingLecternBook) -
setLastChunkPosition
public void setLastChunkPosition(com.nukkitx.math.vector.Vector2i lastChunkPosition) -
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. -
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. -
setBreakingBlock
public void setBreakingBlock(int breakingBlock) -
setLastBlockPlacePosition
public void setLastBlockPlacePosition(com.nukkitx.math.vector.Vector3i lastBlockPlacePosition) -
setLastBlockPlacedId
-
setInteracting
public void setInteracting(boolean interacting) -
setLastInteractionBlockPosition
public void setLastInteractionBlockPosition(com.nukkitx.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(com.nukkitx.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. -
setRidingVehicleEntity
-
setMouseoverEntity
The entity that the client is currently looking at. -
setCraftingRecipes
public void setCraftingRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<com.github.steveice10.mc.protocol.data.game.recipe.Recipe> craftingRecipes) -
setStonecutterRecipes
public void setStonecutterRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<it.unimi.dsi.fastutil.ints.IntList> 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 -
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 https://github.com/GeyserMC/Geyser/issues/503 for context. -
setBucketScheduledFuture
Stores a future interaction to place a bucket. Will be cancelled if the client instead intended to interact with a block. -
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 -
setRaining
public void setRaining(boolean raining)Caches current rain status. -
setThunder
public void setThunder(boolean thunder)Caches current thunder status. -
setLastSignMessage
Stores the last text inputted into a sign.Bedrock sends packets every time you update the sign, Java only wants the final packet. Until we determine that the user has finished editing, we save the sign's current 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.
-