Package org.geysermc.geyser.session
Class GeyserSession
java.lang.Object
org.geysermc.geyser.session.GeyserSession
- All Implemented Interfaces:
Connection
,GeyserConnection
,CommandSender
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGeyserSession(GeyserImpl geyser, com.nukkitx.protocol.bedrock.BedrockServerSession bedrockServerSession, io.netty.channel.EventLoop eventLoop)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTeleport(TeleportCache teleportCache)
com.nukkitx.protocol.bedrock.data.AttributeData
Adjusts speed if the player is crawling.void
authenticate(String username)
void
authenticate(String username, String password)
void
Present a form window to the user asking to log in with another web browservoid
close()
void
confirmTeleport(com.nukkitx.math.vector.Vector3d position)
void
connect()
Send all necessary packets to load Bedrock into the serverprotected void
Will be overwritten for GeyserConnect.void
disconnect(String reason)
void
executeInEventLoop(Runnable runnable)
Executes a task and prints a stack trace if an error occurs.double
The current attack speed of the player.int
Required to decode biomes correctly.it.unimi.dsi.fastutil.ints.Int2IntMap
Stores the map between Java and Bedrock biome network IDs.Stores the block mappings for this specific version.int
Stores 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.TcpSession
io.netty.channel.EventLoop
The loop where all packets and ticking is processed to prevent concurrency issues.com.github.steveice10.mc.protocol.data.game.entity.player.GameMode
Map<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.Vector3i
com.nukkitx.math.vector.Vector2i
long
The time of the last hit.com.nukkitx.math.vector.Vector3i
Stores the last position of the block the player interacted with.com.nukkitx.math.vector.Vector3f
Stores the position of the player the last time they interacted.long
Store the last time the player interacted.long
Used to send a movement packet every three seconds if the player hasn't moved.Stores the last text inputted into a sign.long
Used 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.int
int
The op permission level set by the serverfloat
Tracks 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.Pose
getPose()
Stores the Java pose that the server and/or Geyser believes the player currently has.com.github.steveice10.mc.protocol.MinecraftProtocol
int
int
Map<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.void
handleDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)
boolean
hasPermission(String permission)
Checks if the given session's player has a permissionboolean
Whether advanced tooltips will be added to the player's items.boolean
isCanFly()
If the current player can flyboolean
isClosed()
Accessed on the initial Java and Bedrock packet processing threadsboolean
boolean
boolean
Controls whether the daylight cycle gamerule has been sent to the client, so the sun/moon remain motionless.boolean
boolean
isFlying()
If the current player is flyingboolean
boolean
Whether simulated fog has been sent to the client or not.boolean
boolean
boolean
Deprecated.boolean
Caches current rain status.boolean
boolean
boolean
boolean
boolean
boolean
Saves if the client is steering left on a boat.boolean
Saves if the client is steering right on a boat.boolean
Whether the player is swimming in water.boolean
Caches current thunder status.boolean
Whether we're expecting statistics to be sent back to us.void
login()
name()
Gets the name of the connection.void
receiveDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)
Inject a packet as if it was received by the downstream serverboolean
receiveUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)
Inject a packet as if it was received by the upstream clientvoid
refreshEmotes(List<UUID> emotes)
void
registerPluginChannel(String channel)
Register a Plugin ChannelscheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit)
Schedules a task and prints a stack trace if an error occurs.void
Send an AdventureSettingsPacket to the client with the latest flagsvoid
sendDownstreamPacket(com.github.steveice10.packetlib.packet.Packet packet)
Send a packet to the remote server.void
sendForm(org.geysermc.cumulus.Form form)
void
sendForm(org.geysermc.cumulus.util.FormBuilder<?,?> formBuilder)
void
sendGameRule(String gameRule, Object value)
Send a gamerule value to the clientvoid
sendMessage(String message)
void
sendPluginMessage(String channel, byte[] data)
Send message on a Plugin Channel - https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channelvoid
sendUpstreamPacket(com.nukkitx.protocol.bedrock.BedrockPacket packet)
Queue a packet to be sent to player.void
sendUpstreamPacketImmediately(com.nukkitx.protocol.bedrock.BedrockPacket packet)
Send a packet immediately to the player.void
setAdvancedTooltips(boolean advancedTooltips)
Whether advanced tooltips will be added to the player's items.void
setAttackSpeed(double attackSpeed)
The current attack speed of the player.void
setAuthData(AuthData authData)
void
setAuthenticationData(AuthData authData)
void
setBiomeGlobalPalette(int biomeGlobalPalette)
Required to decode biomes correctly.void
setBlockMappings(BlockMappings blockMappings)
Stores the block mappings for this specific version.void
setBreakingBlock(int breakingBlock)
void
setBucketScheduledFuture(ScheduledFuture<?> bucketScheduledFuture)
Stores a future interaction to place a bucket.void
setCanFly(boolean canFly)
If the current player can flyvoid
setClientData(BedrockClientData clientData)
void
setClosingInventory(boolean closingInventory)
void
setCraftingGridFuture(ScheduledFuture<?> craftingGridFuture)
void
setCraftingRecipes(it.unimi.dsi.fastutil.ints.Int2ObjectMap<com.github.steveice10.mc.protocol.data.game.recipe.Recipe> craftingRecipes)
void
setDaylightCycle(boolean doCycle)
Changes the daylight cycle gamerule on the client This is used in the login screen along-side normal usagevoid
setDimension(String dimension)
The dimension of the player.void
setDroppingLecternBook(boolean droppingLecternBook)
void
setFlying(boolean flying)
void
setGameMode(com.github.steveice10.mc.protocol.data.game.entity.player.GameMode gameMode)
void
setInteracting(boolean interacting)
void
setInventoryTranslator(InventoryTranslator inventoryTranslator)
void
setItemMappings(ItemMappings itemMappings)
Stores the item translations for this specific version.void
setLastBlockPlacedId(String lastBlockPlacedId)
void
setLastBlockPlacePosition(com.nukkitx.math.vector.Vector3i lastBlockPlacePosition)
void
setLastChunkPosition(com.nukkitx.math.vector.Vector2i lastChunkPosition)
void
setLastHitTime(long lastHitTime)
The time of the last hit.void
setLastInteractionBlockPosition(com.nukkitx.math.vector.Vector3i lastInteractionBlockPosition)
Stores the last position of the block the player interacted with.void
setLastInteractionPlayerPosition(com.nukkitx.math.vector.Vector3f lastInteractionPlayerPosition)
Stores the position of the player the last time they interacted.void
setLastInteractionTime(long lastInteractionTime)
Store the last time the player interacted.void
setLastMovementTimestamp(long lastMovementTimestamp)
Used to send a movement packet every three seconds if the player hasn't moved.void
setLastSignMessage(String lastSignMessage)
Stores the last text inputted into a sign.void
setLastVehicleMoveTimestamp(long lastVehicleMoveTimestamp)
Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100msvoid
setMicrosoftAccount(boolean microsoftAccount)
Deprecated.void
setMouseoverEntity(Entity mouseoverEntity)
The entity that the client is currently looking at.void
setOpenInventory(Inventory openInventory)
void
setOpPermissionLevel(int opPermissionLevel)
The op permission level set by the servervoid
setOriginalSpeedAttribute(float originalSpeedAttribute)
Tracks the original speed attribute.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.void
setRaining(boolean raining)
Caches current rain status.void
setReducedDebugInfo(boolean value)
Update the cached value for the reduced debug info gamerule.void
setRemoteAddress(String remoteAddress)
void
setRemoteAuthType(AuthType remoteAuthType)
void
setRemotePort(int remotePort)
void
setRenderDistance(int renderDistance)
void
setRidingVehicleEntity(Entity ridingVehicleEntity)
void
setSneaking(boolean sneaking)
void
setSpawned(boolean spawned)
void
setSprinting(boolean sprinting)
void
setSteeringLeft(boolean steeringLeft)
Saves if the client is steering left on a boat.void
setSteeringRight(boolean steeringRight)
Saves if the client is steering right on a boat.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.void
setSwimming(boolean swimming)
void
setSwimmingInWater(boolean swimmingInWater)
Whether the player is swimming in water.void
setThunder(boolean thunder)
Caches current thunder status.void
setWaitingForStatistics(boolean waitingForStatistics)
Whether we're expecting statistics to be sent back to us.void
setWorldName(String worldName)
Keeps track of the world name for respawning.protected void
tick()
Called every 50 milliseconds - one Minecraft tick.void
unregisterPluginChannel(String channel)
Unregister a Plugin Channelvoid
updateStatistics(@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 theUUID
of 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, wait
Methods 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:Connection
Gets the name of the connection.- Specified by:
name
in interfaceCommandSender
- Specified by:
name
in interfaceConnection
- Returns:
- the name of the connection
-
uuid
Description copied from interface:Connection
Gets theUUID
of the connection.- Specified by:
uuid
in interfaceConnection
- Returns:
- the UUID of the connection
-
xuid
Description copied from interface:Connection
Gets the XUID of the connection.- Specified by:
xuid
in interfaceConnection
- Returns:
- the XUID of the connection
-
sendMessage
- Specified by:
sendMessage
in interfaceCommandSender
-
isConsole
public boolean isConsole()- Specified by:
isConsole
in interfaceCommandSender
- Returns:
- true if the specified sender is from the console.
-
getLocale
Description copied from interface:CommandSender
Returns the locale of the command sender. Defaults to the default locale atGeyserLocale.getDefaultLocale()
.- Specified by:
getLocale
in 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:
hasPermission
in 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.
-