Interface StructureSaverAbstract<L,V>


public interface StructureSaverAbstract<L,V>
Interface fluent API to save structures from the world into different targets.
  • Method Details

    • getLocation

      @Nullable L getLocation()
      Gets the source Location.
      Returns:
      location.
    • getOffset

      @Nullable V getOffset()
      Gets the offset of the selection. Has to be smaller or equal to StructureRestriction.
      Returns:
      offset.
    • getAuthor

      @Nullable @Nullable String getAuthor()
      Gets the author. The author is a optional meta data in the final structure file.
      Returns:
      author.
    • isIncludeEntitiesEnabled

      boolean isIncludeEntitiesEnabled()
      Should entities included in the saved file. Default false.
      Returns:
      flag.
    • getRestriction

      @NotNull @NotNull StructureRestriction getRestriction()
      Gets the size restriction.

      Default StructureRestriction.SINGLE_32.

      Returns:
      restriction.
    • getStructureVoidTypeName

      @NotNull @Deprecated @NotNull String getStructureVoidTypeName()
      Deprecated.
      This internal value is no longer exposed since 1.18.2.
    • at

      @NotNull @NotNull StructureSaverAbstract<L,V> at(@Nullable L location)
      Sets the source Location corner where the blocks start to get saved. Required parameter.
      Parameters:
      location - Location.
      Returns:
      This instance.
    • offSet

      @NotNull @NotNull StructureSaverAbstract<L,V> offSet(@Nullable V vector)
      Sets the source Vector offset where the blocks reach to get saved. Required parameter.
      Parameters:
      vector - Vector.
      Returns:
      This instance.
    • sizeX

      @NotNull @NotNull StructureSaverAbstract<L,V> sizeX(int x)
      Sets the offset in x coordinate.
      Parameters:
      x - offset.
      Returns:
      This instance.
    • sizeY

      @NotNull @NotNull StructureSaverAbstract<L,V> sizeY(int y)
      Sets the offset in y coordinate.
      Parameters:
      y - offset.
      Returns:
      This instance.
    • sizeZ

      @NotNull @NotNull StructureSaverAbstract<L,V> sizeZ(int z)
      Sets the offset in z coordinate.
      Parameters:
      z - offset.
      Returns:
      This instance.
    • author

      StructureSaverAbstract<L,V> author(@Nullable @Nullable String author)
      Sets the author. The author is a optional meta data in the final structure file.
      Parameters:
      author - name.
      Returns:
      This instance.
    • includeEntities

      StructureSaverAbstract<L,V> includeEntities(boolean enabled)
      Should entities be included in the save file. Default false.
      Parameters:
      enabled - Flag.
      Returns:
      This instance.
    • restriction

      @NotNull @NotNull StructureSaverAbstract<L,V> restriction(@NotNull @NotNull StructureRestriction structureRestriction)
      Restricts the structure to a certain size if a larger area is selected with offset. Default StructureRestriction.SINGLE_32.
      Parameters:
      structureRestriction - Restriction.
      Returns:
      This instance.
    • structureVoidTypeName

      @NotNull @Deprecated @NotNull StructureSaverAbstract<L,V> structureVoidTypeName(String name)
      Deprecated.
      This value is no longer used since 1.18.2.
    • saveToWorld

      @NotNull @NotNull ProgressToken<Void> saveToWorld(@NotNull @NotNull String worldName, @NotNull @NotNull String author, @NotNull @NotNull String name)
      Saves the blocks and entities from the world into into a structure.nbt file located in the world folder, author folder. Overrides existing files. This allows to use the structure in Vanilla Structure Blocks.

      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 - Author of the structure.
      name - Name of the stored structure.
      Returns:
      Instance of ProgressToken.
    • saveToString

      @NotNull @NotNull ProgressToken<String> saveToString()
      Saves the blocks and entities from the world into into a structure.nbt binary as Base64 encoded string.

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

      Returns:
      Instance of ProgressToken with Base64EncodedString result.
    • saveToPath

      @NotNull @NotNull ProgressToken<Void> saveToPath(@NotNull @NotNull Path target)
      Saves the blocks and entities from the world into into a structure.nbt file.

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

      Parameters:
      target - Non existing or existing file. Overrides existing files.
      Returns:
      Instance of ProgressToken.
    • saveToFile

      @NotNull @NotNull ProgressToken<Void> saveToFile(@NotNull @NotNull File target)
      Saves the blocks and entities from the world into into a structure.nbt file.

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

      Parameters:
      target - Non existing or existing file. Overrides existing files.
      Returns:
      Instance of ProgressToken.
    • saveToOutputStream

      @NotNull @NotNull ProgressToken<Void> saveToOutputStream(@NotNull @NotNull OutputStream target)
      Saves the blocks and entities from the world into into a structure.nbt binary stream.

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

      Parameters:
      target - Open binary outputStream. Does not close the outputStream.
      Returns:
      Instance of ProgressToken.