Class WorldManager

java.lang.Object
org.geysermc.geyser.level.WorldManager
Direct Known Subclasses:
GeyserWorldManager

public abstract class WorldManager extends Object
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.
  • Constructor Details

    • WorldManager

      public WorldManager()
  • Method Details

    • blockAt

      public final @NonNull BlockState blockAt(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector)
    • blockAt

      public @NonNull BlockState blockAt(GeyserSession session, int x, int y, int z)
    • getBlockAt

      public final int getBlockAt(GeyserSession session, org.cloudburstmc.math.vector.Vector3i vector)
      Gets the Java block state at the specified location
      Parameters:
      session - the session
      vector - the position
      Returns:
      the block state at the specified location
    • getBlockAt

      public abstract int getBlockAt(GeyserSession session, int x, int y, int z)
      Gets the Java block state at the specified location
      Parameters:
      session - the session
      x - the x coordinate to get the block at
      y - the y coordinate to get the block at
      z - 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

      public CompletableFuture<Integer> getBlockAtAsync(GeyserSession session, int x, int y, int z)
    • 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
    • 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 change
      gameMode - 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 change
      difficulty - The difficulty to change to
    • getBiomeIdentifiers

      public String @Nullable [] getBiomeIdentifiers(boolean withTags)
      Returns a list of biome identifiers available on the server.
    • getDecoratedPotData

      public void getDecoratedPotData(GeyserSession session, org.cloudburstmc.math.vector.Vector3i pos, Consumer<List<String>> apply)
      Retrieves decorated pot sherds from the server. Used to ensure the data is not erased on animation sent through the BlockEntityDataPacket.