Interface PolarWorldAccess


public interface PolarWorldAccess
Provides access to user world data for a PolarLoader to get and set user specific world data such as objects, as well as provides some relevant callbacks.

Usage if world access is completely optional, dependent features will not add overhead to the format if unused.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PolarWorldAccess
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minestom.server.registry.DynamicRegistry.Key<net.minestom.server.world.biome.Biome>
    getBiome(@NotNull String name)
    Called when a chunk is being loaded by a PolarLoader to convert biome ids back to instances.
    default @NotNull String
    getBiomeName(int id)
     
    default void
    loadChunkData(@NotNull net.minestom.server.instance.Chunk chunk, @Nullable net.minestom.server.network.NetworkBuffer userData)
    Called when a chunk is created, just before it is added to the world.
    default void
    loadHeightmaps(@NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps)
     
    default void
    loadWorldData(@NotNull net.minestom.server.instance.Instance instance, @Nullable net.minestom.server.network.NetworkBuffer userData)
    Called when an instance is created from this chunk loader.
    default void
    saveChunkData(@NotNull net.minestom.server.instance.Chunk chunk, @NotNull net.minestom.server.network.NetworkBuffer userData)
    Called when a chunk is being saved.
    default void
    saveHeightmaps(@NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps)
     
    default void
    saveWorldData(@NotNull net.minestom.server.instance.Instance instance, @NotNull net.minestom.server.network.NetworkBuffer userData)
    Called when an instance is being saved.
  • Field Details

  • Method Details

    • loadWorldData

      default void loadWorldData(@NotNull @NotNull net.minestom.server.instance.Instance instance, @Nullable @Nullable net.minestom.server.network.NetworkBuffer userData)
      Called when an instance is created from this chunk loader.

      Can be used to initialize the world based on saved user data in the world.
      Parameters:
      instance - The Minestom instance being created
      userData - The saved user data, or null if none is present.
    • saveWorldData

      default void saveWorldData(@NotNull @NotNull net.minestom.server.instance.Instance instance, @NotNull @NotNull net.minestom.server.network.NetworkBuffer userData)
      Called when an instance is being saved.

      Can be used to save user data in the world by writing it to the buffer.
      Parameters:
      instance - The Minestom instance being saved
      userData - A buffer to write user data to save
    • loadChunkData

      default void loadChunkData(@NotNull @NotNull net.minestom.server.instance.Chunk chunk, @Nullable @Nullable net.minestom.server.network.NetworkBuffer userData)
      Called when a chunk is created, just before it is added to the world.

      Can be used to initialize the chunk based on saved user data in the world.
      Parameters:
      chunk - The Minestom chunk being created
      userData - The saved user data, or null if none is present
    • saveChunkData

      default void saveChunkData(@NotNull @NotNull net.minestom.server.instance.Chunk chunk, @NotNull @NotNull net.minestom.server.network.NetworkBuffer userData)
      Called when a chunk is being saved.

      Can be used to save user data in the chunk by writing it to the buffer.
      Parameters:
      chunk - The Minestom chunk being saved
      userData - A buffer to write user data to save
    • loadHeightmaps

      @Experimental default void loadHeightmaps(@NotNull @NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps)
    • saveHeightmaps

      @Experimental default void saveHeightmaps(@NotNull @NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps)
    • getBiome

      @NotNull default net.minestom.server.registry.DynamicRegistry.Key<net.minestom.server.world.biome.Biome> getBiome(@NotNull @NotNull String name)
      Called when a chunk is being loaded by a PolarLoader to convert biome ids back to instances.

      It is valid to change the behavior as long as a biome is returned in all cases (i.e. have a default).

      Biomes are cached by the loader per loader instance, so there will only be a single call per loader, even over many chunks.
      Parameters:
      name - The namespace ID of the biome, eg minecraft:plains
      Returns:
      The biome instance
    • getBiomeName

      @NotNull default @NotNull String getBiomeName(int id)