Package net.hollowcube.polar
Interface PolarWorldAccess
public interface PolarWorldAccess
Provides access to user world data for a
Usage if world access is completely optional, dependent features will not add overhead to the format if unused.
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 -
Method Summary
Modifier and TypeMethodDescriptiondefault net.minestom.server.registry.DynamicRegistry.Key<net.minestom.server.world.biome.Biome> Called when a chunk is being loaded by aPolarLoaderto convert biome ids back to instances.default @NotNull StringgetBiomeName(int id) default voidloadChunkData(@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 voidloadHeightmaps(@NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps) default voidloadWorldData(@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 voidsaveChunkData(@NotNull net.minestom.server.instance.Chunk chunk, @NotNull net.minestom.server.network.NetworkBuffer userData) Called when a chunk is being saved.default voidsaveHeightmaps(@NotNull net.minestom.server.instance.Chunk chunk, int[][] heightmaps) default voidsaveWorldData(@NotNull net.minestom.server.instance.Instance instance, @NotNull net.minestom.server.network.NetworkBuffer userData) Called when an instance is being saved.
-
Field Details
-
DEFAULT
-
-
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 createduserData- 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 saveduserData- 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 createduserData- 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 saveduserData- 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 aPolarLoaderto 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
-