Interface BiomeEditor


public interface BiomeEditor
  • Field Details

    • LOGGER

      static final HytaleLogger LOGGER
    • BIOME_NAME_PATH

      static final String[] BIOME_NAME_PATH
    • BIOMES_PATH

      static final String[] BIOMES_PATH
    • DEFAULT_BIOME_PATH

      static final String[] DEFAULT_BIOME_PATH
  • Method Details

    • setupAssets

      static CompletableFuture<BiomeEditor.Context> setupAssets(@Nonnull BiomeEditor.Config config)
      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 Context object, 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 an EntityStore instance that represents the player's entity data. This reference must be valid during the setup process.
      Returns:
      A CompletableFuture that 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 - a CompletableFuture of BiomeEditor.Context that provides the necessary configuration details required for the viewport setup.
      ref - a Ref to an EntityStore that represents the player's entity data. This reference must remain valid during the setup process.
      Returns:
      a CompletableFuture that 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,T>> void createAssetFromTemplate(@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 - The Context containing 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. If null, 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 - A BuilderCodec that 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

      static HandleProvider createWorldGenProvider()
      Creates a new HandleProvider instance using the default codec provided by IWorldGenProvider for the HandleProvider.ID identifier. This method ensures that the default codec returns a valid HandleProvider instance and throws an exception if the default value type is unexpected.
      Returns:
      a HandleProvider instance initialized with the default configuration provided by the codec for HandleProvider.ID.
      Throws:
      IllegalStateException - if the codec returns a default value that is not of type HandleProvider.