Interface StructureLoaderAbstract<L,V,B,E,W>


public interface StructureLoaderAbstract<L,V,B,E,W>
Interface fluent API to load structures from sources into the world
  • Method Details

    • getLocation

      @Nullable L getLocation()
      Gets the target Location.
      Returns:
      location.
    • isIncludeEntitiesEnabled

      boolean isIncludeEntitiesEnabled()
      Should entities which may or may not be included in the saved file be included in the loaded structure. Default false.
      Returns:
      flag.
    • isIncludeBlocksEnabled

      boolean isIncludeBlocksEnabled()
      Should blocks which may or may not be included in the saved file be included in the loaded structure. Default true.
      Returns:
      flag.
    • getMirrorType

      StructureMirror getMirrorType()
      Gets the target mirror type. Default StructureMirror.NONE.
      Returns:
      StructureMirror.
    • getRotationType

      StructureRotation getRotationType()
      Gets the target rotation type. Default StructureRotation.NONE.
      Returns:
      StructureRotation.
    • getIntegrity

      float getIntegrity()
      Gets the target integrity. Default 1.0. 1.0 Every block which is present in the structure file is placed in the world. 1.0 Blocks get randomly removed by loading depending on the given getSeed.
      Returns:
      integrity.
    • getSeed

      long getSeed()
      Gets the target seed. Default 0L. The seed is used to randomly remove blocks if the integrity getIntegrity is less than 1.0.
      Returns:
      seed.
    • at

      @NotNull @NotNull StructureLoaderAbstract<L,V,B,E,W> at(@Nullable L location)
      Sets the target Location corner where the blocks start to get placed. Required parameter.
      Parameters:
      location - Location.
      Returns:
      This instance.
    • includeEntities

      StructureLoaderAbstract<L,V,B,E,W> includeEntities(boolean enabled)
      Should entities which may or may not be included in the saved file be included in the loaded structure. Default false.
      Parameters:
      enabled - Flag.
      Returns:
      This instance.
    • includeBlocks

      StructureLoaderAbstract<L,V,B,E,W> includeBlocks(boolean enabled)
      Should blocks which may or may not be included in the saved file be included in the loaded structure. Default true.
      Parameters:
      enabled - Flag.
      Returns:
      This instance.
    • mirror

      Sets the target mirror type. Default StructureMirror.NONE.
      Parameters:
      mirror - Mirror.
      Returns:
      This instance.
    • rotation

      Sets the target rotation type. Default StructureRotation.NONE.
      Parameters:
      rotation - Rotation.
      Returns:
      This instance.
    • integrity

      StructureLoaderAbstract<L,V,B,E,W> integrity(float integrity)
      Sets the target integrity. Default 1.0. 1.0 Every block which is present in the structure file is placed in the world. 1.0 Blocks get randomly removed by loading depending on the given setSeed.
      Parameters:
      integrity - Integrity.
      Returns:
      This instance.
    • seed

      StructureLoaderAbstract<L,V,B,E,W> seed(long seed)
      Sets the target seed. Default 0L. The seed is used to randomly remove blocks if the integrity setIntegrity is less than 1.0.
      Parameters:
      seed - Seed.
      Returns:
      This instance.
    • onProcessBlock

      @NotNull @NotNull StructureLoaderAbstract<L,V,B,E,W> onProcessBlock(Function<StructurePlacePart<B,W>,Boolean> onStructurePlace)
      Attaches a new function to the structure processor which is called for each block being placed in the world. If true, the block is getting placed in the world. If false, the block is not getting placed. Multiple processor can be attached to a single structure load (e.g. executed in the order they are added). If one processor returns false, subsequent processor are no longer being called.
      Parameters:
      onStructurePlace - A function being called for each block being placed.
      Returns:
      This instance.
    • onProcessEntity

      @NotNull @NotNull StructureLoaderAbstract<L,V,B,E,W> onProcessEntity(Function<StructureEntity<E,L>,Boolean> onStructurePlace)
      Attaches a new function to the structure processor which is called for each entity being placed in the world. If true, the entity is getting placed in the world. If false, the entity is not getting placed. Multiple processor can be attached to a single structure load (e.g. executed in the order they are added). If one processor returns false, subsequent processor are no longer being called.
      Parameters:
      onStructurePlace - A function being called for each entity being placed.
      Returns:
      This instance.
    • loadFromSaver

      @NotNull @NotNull ProgressToken<Void> loadFromSaver(@NotNull @NotNull StructureSaverAbstract<L,V> source)
      Loads the structure blocks and entities from the given source and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      source - Existing Structure in world defined by StructureSaverAbstract.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromWorld

      @NotNull @NotNull ProgressToken<Void> loadFromWorld(@NotNull @NotNull String worldName, @NotNull @NotNull String author, @NotNull @NotNull String name)
      Loads the structure blocks and entities from the structure storage inside each world folder of Minecraft and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      worldName - World where the structure file is stored.
      author - Name of the structure author.
      name - Name of the stored structure.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromString

      @NotNull @NotNull ProgressToken<Void> loadFromString(@NotNull @NotNull String source)
      Loads the structure blocks and entities from the given source and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      source - Base64 encoded Structure binary.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromPath

      @NotNull @NotNull ProgressToken<Void> loadFromPath(@NotNull @NotNull Path source)
      Loads the structure blocks and entities from the given source and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      source - Existing Path.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromFile

      @NotNull @NotNull ProgressToken<Void> loadFromFile(@NotNull @NotNull File source)
      Loads the structure blocks and entities from the given source and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      source - Existing File.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromInputStream

      @NotNull @NotNull ProgressToken<Void> loadFromInputStream(@NotNull @NotNull InputStream source)
      Loads the structure blocks and entities from the given source and places the blocks at the defined position.

      This call does not block and finishes in the future. Use ProgressToken ()} for cancellation or callbacks.

      Parameters:
      source - Open binary inputStream. Does not close the inputStream.
      Returns:
      NotNull instance of ProgressToken.