Contents
Interface BiomeEditor
public interface BiomeEditor
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classRepresents a configuration object for creating and editing biome and world structure assets within a specific asset pack and group.static classRepresents the context for biome and world structure asset configuration and management.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]static final String[]static final String[]static final HytaleLogger -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T extends JsonAssetWithMap<String,M>, M extends AssetMap<String, T>>
voidcreateAssetFromTemplate(BiomeEditor.Context context, String template, Class<T> type, BuilderCodec<? extends T> defaultCodec, BiConsumer<org.bson.BsonDocument, BiomeEditor.Config> templateConsumer) Creates an asset in the specified context using either a provided template or a default codec value.static HandleProviderCreates a newHandleProviderinstance using the default codec provided byIWorldGenProviderfor theHandleProvider.IDidentifier.static CompletableFuture<BiomeEditor.Context> setupAssets(BiomeEditor.Config config) Sets up the necessary assets for a given biome editor configuration.static CompletableFuture<Void> setupViewport(BiomeEditor.Config config, Ref<EntityStore> ref) Sets up the viewport for the provided player reference and configuration.static CompletableFuture<Void> setupViewport(CompletableFuture<BiomeEditor.Context> future, Ref<EntityStore> ref) Sets up the viewport for the provided player reference and context future.
-
Field Details
-
LOGGER
-
BIOME_NAME_PATH
-
BIOMES_PATH
-
DEFAULT_BIOME_PATH
-
-
Method Details
-
setupAssets
Sets up the necessary assets for a given biome editor configuration. This includes creating a Biome, a WorldStructure asset, and an Instance, as well as exporting and reloading the created assets in the context of the provided asset pack group.- Parameters:
config- The configuration object containing details such as the asset group, pack, biome name, biome template, world structure template, and other related properties.- Returns:
- A CompletableFuture that resolves to a
Contextobject, which contains the configuration and asset pack.
-
setupViewport
static CompletableFuture<Void> setupViewport(@Nonnull BiomeEditor.Config config, @Nonnull Ref<EntityStore> ref) Sets up the viewport for the provided player reference and configuration.- Parameters:
config- The configuration object containing details such as the asset pack, group, biome name, templates for biome and world structure, and viewport bounds.ref- A reference to anEntityStoreinstance that represents the player's entity data. This reference must be valid during the setup process.- Returns:
- A
CompletableFuturethat resolves when the viewport setup is complete. The future completes exceptionally if any error occurs during the setup process, such as issues with asset configuration or invalid entity references.
-
setupViewport
static CompletableFuture<Void> setupViewport(@Nonnull CompletableFuture<BiomeEditor.Context> future, @Nonnull Ref<EntityStore> ref) Sets up the viewport for the provided player reference and context future. This involves creating a new world instance, teleporting the player to that instance, and linking asset management reload listeners to the viewport.- Parameters:
future- aCompletableFutureofBiomeEditor.Contextthat provides the necessary configuration details required for the viewport setup.ref- aRefto anEntityStorethat represents the player's entity data. This reference must remain valid during the setup process.- Returns:
- a
CompletableFuturethat completes when the viewport setup is finalized. It resolves exceptionally if any error occurs during the setup process, such as an invalid player reference or an issue creating the world instance.
-
createAssetFromTemplate
static <T extends JsonAssetWithMap<String,M>, M extends AssetMap<String, void createAssetFromTemplateT>> (@Nonnull BiomeEditor.Context context, @Nullable String template, @Nonnull Class<T> type, @Nonnull BuilderCodec<? extends T> defaultCodec, @Nonnull BiConsumer<org.bson.BsonDocument, BiomeEditor.Config> templateConsumer) throws IllegalStateException, IOException Creates an asset in the specified context using either a provided template or a default codec value. If the asset already exists in the target pack, it may be overridden based on its presence in the asset map.- Parameters:
context- TheContextcontaining the asset pack and configuration details. It provides the required information to locate and manage the assets.template- A template asset name used as a basis for creating the new asset. Ifnull, the default codec's generated value is used instead.type- The class type of the asset being created. This is used to resolve the asset registry and its associated store.defaultCodec- ABuilderCodecthat provides the default value for the asset if no template is specified.templateConsumer- A consumer that modifies the BSON document of the template asset with the template parameter values specific to the asset being created.- Throws:
IllegalStateException- If the specified template does not exist or if other asset creation preconditions fail.IOException- If an error occurs during I/O operations, such as reading the template or exporting the asset.
-
createWorldGenProvider
Creates a newHandleProviderinstance using the default codec provided byIWorldGenProviderfor theHandleProvider.IDidentifier. This method ensures that the default codec returns a validHandleProviderinstance and throws an exception if the default value type is unexpected.- Returns:
- a
HandleProviderinstance initialized with the default configuration provided by the codec forHandleProvider.ID. - Throws:
IllegalStateException- if the codec returns a default value that is not of typeHandleProvider.
-