Package org.geysermc.geyser.level
Class GeyserWorldManager
java.lang.Object
org.geysermc.geyser.level.WorldManager
org.geysermc.geyser.level.GeyserWorldManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetBlockAt(GeyserSession session, int x, int y, int z)Gets the Java block state at the specified locationgetBlockAtAsync(GeyserSession session, int x, int y, int z)int[]getBlocksAt(GeyserSession session, org.geysermc.erosion.util.BlockPositionIterator iter)com.github.steveice10.mc.protocol.data.game.entity.player.GameModegetDefaultGameMode(GeyserSession session)Get the default game mode of the serverbooleangetGameRuleBool(GeyserSession session, GameRule gameRule)Gets a gamerule value as a booleanintgetGameRuleInt(GeyserSession session, GameRule gameRule)Get a gamerule value as an integer@NonNull CompletableFuture<@Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag>getPickItemNbt(GeyserSession session, int x, int y, int z, boolean addNbtData)Used for pick block, so we don't need to cache more data than necessary.booleanChecks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.booleanhasPermission(GeyserSession session, String permission)Checks if the given session's player has a permissionvoidsendLecternData(GeyserSession session, int x, int y, int z)Sigh.voidsendLecternData(GeyserSession session, int x, int z, List<com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo> blockEntityInfos)WorldManager.sendLecternData(GeyserSession, int, int, int)but batched for chunks.voidsetGameRule(GeyserSession session, String name, Object value)Updates a gamerule value on the Java serverbooleanshouldExpectLecternHandled(GeyserSession session)Methods inherited from class org.geysermc.geyser.level.WorldManager
getBiomeIdentifiers, getBlockAt, getBlockAtAsync, setDefaultGameMode, setDifficulty, setPlayerGameMode
-
Constructor Details
-
GeyserWorldManager
public GeyserWorldManager()
-
-
Method Details
-
getBlockAt
Description copied from class:WorldManagerGets the Java block state at the specified location- Specified by:
getBlockAtin classWorldManager- Parameters:
session- the sessionx- the x coordinate to get the block aty- the y coordinate to get the block atz- the z coordinate to get the block at- Returns:
- the block state at the specified location
-
getBlockAtAsync
- Overrides:
getBlockAtAsyncin classWorldManager
-
getBlocksAt
public int[] getBlocksAt(GeyserSession session, org.geysermc.erosion.util.BlockPositionIterator iter)- Overrides:
getBlocksAtin classWorldManager
-
hasOwnChunkCache
public boolean hasOwnChunkCache()Description copied from class:WorldManagerChecks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.Some world managers (e.g. Spigot) can provide access to block data outside of the chunk cache, and even with chunk caching disabled. This method provides a means to check if this manager has this capability.
- Specified by:
hasOwnChunkCachein classWorldManager- Returns:
- whether or not this world manager has access to more block data than the chunk cache
-
sendLecternData
public void sendLecternData(GeyserSession session, int x, int z, List<com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo> blockEntityInfos)Description copied from class:WorldManagerWorldManager.sendLecternData(GeyserSession, int, int, int)but batched for chunks.- Specified by:
sendLecternDatain classWorldManagerx- chunk xz- chunk zblockEntityInfos- a list of coordinates (chunk local) to grab lecterns from.
-
sendLecternData
Description copied from class:WorldManagerSigh.
So, on Java Edition, the lectern is an inventory. Java opens it and gets the contents of the book there. On Bedrock, the lectern contents are part of the block entity tag. Therefore, Bedrock expects to have the contents of the lectern ready and present in the world. If the contents are not there, it takes at least two clicks for the lectern to update the tag and then present itself.
We solve this problem by querying all loaded lecterns, where possible, and sending their information in a block entity tag.Note that the lectern data may be sent asynchronously.
- Specified by:
sendLecternDatain classWorldManager- Parameters:
session- the session of the playerx- the x coordinate of the lecterny- the y coordinate of the lecternz- the z coordinate of the lectern
-
shouldExpectLecternHandled
- Specified by:
shouldExpectLecternHandledin classWorldManager- Returns:
- whether we should expect lectern data to update, or if we have to fall back on a workaround.
-
setGameRule
Description copied from class:WorldManagerUpdates a gamerule value on the Java server- Overrides:
setGameRulein classWorldManager- Parameters:
session- The session of the user that requested the changename- The gamerule to changevalue- The new value for the gamerule
-
getGameRuleBool
Description copied from class:WorldManagerGets a gamerule value as a boolean- Specified by:
getGameRuleBoolin classWorldManager- Parameters:
session- The session of the user that requested the valuegameRule- The gamerule to fetch the value of- Returns:
- The boolean representation of the value
-
getGameRuleInt
Description copied from class:WorldManagerGet a gamerule value as an integer- Specified by:
getGameRuleIntin classWorldManager- Parameters:
session- The session of the user that requested the valuegameRule- The gamerule to fetch the value of- Returns:
- The integer representation of the value
-
getDefaultGameMode
public com.github.steveice10.mc.protocol.data.game.entity.player.GameMode getDefaultGameMode(GeyserSession session)Description copied from class:WorldManagerGet the default game mode of the server- Specified by:
getDefaultGameModein classWorldManager- Parameters:
session- the player requesting the default game mode- Returns:
- the default game mode of the server, or Survival if unknown.
-
hasPermission
Description copied from class:WorldManagerChecks if the given session's player has a permission- Specified by:
hasPermissionin classWorldManager- Parameters:
session- The session of the player to check the permission ofpermission- The permission node to check- Returns:
- True if the player has the requested permission, false if not
-
getPickItemNbt
public @NonNull CompletableFuture<@Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag> getPickItemNbt(GeyserSession session, int x, int y, int z, boolean addNbtData)Description copied from class:WorldManagerUsed for pick block, so we don't need to cache more data than necessary.- Overrides:
getPickItemNbtin classWorldManager- Returns:
- expected NBT for this item.
-