Package org.geysermc.geyser.level
Class WorldManager
java.lang.Object
org.geysermc.geyser.level.WorldManager
- Direct Known Subclasses:
GeyserWorldManager
Class that manages or retrieves various information
from the world. Everything in this class should be
safe to return null or an empty value in the event
that chunk caching or anything of the sort is disabled
on the standalone version of Geyser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Function<it.unimi.dsi.fastutil.ints.Int2ObjectMap<byte[]>,org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull BlockStateblockAt(GeyserSession session, int x, int y, int z) final @NonNull BlockStateblockAt(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector) String @Nullable []getBiomeIdentifiers(boolean withTags) Returns a list of biome identifiers available on the server.abstract intgetBlockAt(GeyserSession session, int x, int y, int z) Gets the Java block state at the specified locationfinal intgetBlockAt(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector) Gets the Java block state at the specified locationgetBlockAtAsync(GeyserSession session, int x, int y, int z) final CompletableFuture<Integer>getBlockAtAsync(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector) int[]getBlocksAt(GeyserSession session, org.geysermc.erosion.util.BlockPositionIterator iter) abstract org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameModegetDefaultGameMode(GeyserSession session) Get the default game mode of the serverabstract booleangetGameRuleBool(GeyserSession session, GameRule gameRule) Gets a gamerule value as a booleanabstract intgetGameRuleInt(GeyserSession session, GameRule gameRule) Get a gamerule value as an integer@NonNull CompletableFuture<@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents>getPickItemComponents(GeyserSession session, int x, int y, int z, boolean addExtraData) Used for pick block, so we don't need to cache more data than necessary.abstract booleanChecks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache.abstract booleanhasPermission(GeyserSession session, String permission) Checks if the given session's player has a permissionvoidsetDefaultGameMode(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode gameMode) Change the default game mode of the session's servervoidsetDifficulty(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.setting.Difficulty difficulty) Change the difficulty of the Java servervoidsetGameRule(GeyserSession session, String name, Object value) Updates a gamerule value on the Java servervoidsetPlayerGameMode(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode gameMode) Change the game mode of the given session
-
Field Details
-
RAW_TRANSFORMER
protected static final Function<it.unimi.dsi.fastutil.ints.Int2ObjectMap<byte[]>,org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents> RAW_TRANSFORMER
-
-
Constructor Details
-
WorldManager
public WorldManager()
-
-
Method Details
-
blockAt
public final @NonNull BlockState blockAt(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector) -
blockAt
-
getBlockAt
Gets the Java block state at the specified location- Parameters:
session- the sessionvector- the position- Returns:
- the block state at the specified location
-
getBlockAt
Gets the Java block state at the specified location- 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
public final CompletableFuture<Integer> getBlockAtAsync(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector) -
getBlockAtAsync
-
getBlocksAt
public int[] getBlocksAt(GeyserSession session, org.geysermc.erosion.util.BlockPositionIterator iter) -
hasOwnChunkCache
public abstract boolean hasOwnChunkCache()Checks 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.
- Returns:
- whether or not this world manager has access to more block data than the chunk cache
-
setGameRule
Updates a gamerule value on the Java server- Parameters:
session- The session of the user that requested the changename- The gamerule to changevalue- The new value for the gamerule
-
getGameRuleBool
Gets a gamerule value as a boolean- 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
Get a gamerule value as an integer- 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
-
setPlayerGameMode
public void setPlayerGameMode(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode gameMode) Change the game mode of the given session- Parameters:
session- The session of the player to change the game mode ofgameMode- The game mode to change the player to
-
getDefaultGameMode
public abstract org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode getDefaultGameMode(GeyserSession session) Get the default game mode of the server- Parameters:
session- the player requesting the default game mode- Returns:
- the default game mode of the server, or Survival if unknown.
-
setDefaultGameMode
public void setDefaultGameMode(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode gameMode) Change the default game mode of the session's server- Parameters:
session- the player making the changegameMode- the new default game mode
-
setDifficulty
public void setDifficulty(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.setting.Difficulty difficulty) Change the difficulty of the Java server- Parameters:
session- The session of the user that requested the changedifficulty- The difficulty to change to
-
hasPermission
Checks if the given session's player has a permission- 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
-
getBiomeIdentifiers
Returns a list of biome identifiers available on the server. -
getPickItemComponents
public @NonNull CompletableFuture<@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents> getPickItemComponents(GeyserSession session, int x, int y, int z, boolean addExtraData) Used for pick block, so we don't need to cache more data than necessary.- Returns:
- expected NBT for this item.
-