Class StructureLoaderAbstractImpl<L,V>

java.lang.Object
com.github.shynixn.structureblocklib.core.entity.StructureLoaderAbstractImpl<L,V>
All Implemented Interfaces:
com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>

public class StructureLoaderAbstractImpl<L,V> extends Object implements com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
  • Constructor Summary

    Constructors
    Constructor
    Description
    StructureLoaderAbstractImpl(com.github.shynixn.structureblocklib.api.service.ProxyService proxyService, com.github.shynixn.structureblocklib.api.service.StructureSerializationService serializationService, com.github.shynixn.structureblocklib.api.service.StructureWorldService worldService)
    Creates a new raw structure load instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    at(L location)
    Sets the target Location corner where the blocks start to get placed.
    float
    Gets the target integrity.
    Gets the target Location.
    com.github.shynixn.structureblocklib.api.enumeration.StructureMirror
    Gets the target mirror type.
    com.github.shynixn.structureblocklib.api.enumeration.StructureRotation
    Gets the target rotation type.
    long
    Gets the target seed.
    com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    includeEntities(boolean enabled)
    Should entities which may or may not be included in the saved file be included in the loaded structure.
    com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    integrity(float integrity)
    Sets the target integrity.
    boolean
    Should entities which may or may not be included in the saved file be included in the loaded structure.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    loadFromFile(@NotNull File source)
    Loads the structure blocks and entities from the given source and places the blocks at the defined position.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    Loads the structure blocks and entities from the given source and places the blocks at the defined position.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    loadFromPath(@NotNull Path source)
    Loads the structure blocks and entities from the given source and places the blocks at the defined position.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    loadFromSaver(@NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> source)
    Loads the structure blocks and entities from the given source and places the blocks at the defined position.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    loadFromString(@NotNull String source)
    Loads the structure blocks and entities from the given source and places the blocks at the defined position.
    @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>
    loadFromWorld(@NotNull String worldName, @NotNull String author, @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.
    com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    mirror(com.github.shynixn.structureblocklib.api.enumeration.StructureMirror mirror)
    Sets the target mirror type.
    com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    rotation(com.github.shynixn.structureblocklib.api.enumeration.StructureRotation rotation)
    Sets the target rotation type.
    com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
    seed(long seed)
    Sets the target seed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StructureLoaderAbstractImpl

      public StructureLoaderAbstractImpl(com.github.shynixn.structureblocklib.api.service.ProxyService proxyService, com.github.shynixn.structureblocklib.api.service.StructureSerializationService serializationService, com.github.shynixn.structureblocklib.api.service.StructureWorldService worldService)
      Creates a new raw structure load instance.
      Parameters:
      proxyService - dependency.
      serializationService - dependency.
      worldService - dependency.
  • Method Details

    • getLocation

      @Nullable public L getLocation()
      Gets the target Location.
      Specified by:
      getLocation in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      location.
    • isIncludeEntitiesEnabled

      public boolean isIncludeEntitiesEnabled()
      Should entities which may or may not be included in the saved file be included in the loaded structure. Default false.
      Specified by:
      isIncludeEntitiesEnabled in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      flag.
    • getMirrorType

      public com.github.shynixn.structureblocklib.api.enumeration.StructureMirror getMirrorType()
      Gets the target mirror type. Default StructureMirror.NONE.
      Specified by:
      getMirrorType in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      StructureMirror.
    • getRotationType

      public com.github.shynixn.structureblocklib.api.enumeration.StructureRotation getRotationType()
      Gets the target rotation type. Default StructureRotation.NONE.
      Specified by:
      getRotationType in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      StructureRotation.
    • getIntegrity

      public 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. smnaller 1.0 -> Blocks get randomly removed by loading depending on the given getSeed.
      Specified by:
      getIntegrity in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      integrity.
    • getSeed

      public 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.
      Specified by:
      getSeed in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Returns:
      seed.
    • at

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> at(@Nullable L location)
      Sets the target Location corner where the blocks start to get placed. Required parameter.
      Specified by:
      at in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      location - Location.
      Returns:
      This instance.
    • includeEntities

      public com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> includeEntities(boolean enabled)
      Should entities which may or may not be included in the saved file be included in the loaded structure. Default false.
      Specified by:
      includeEntities in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      enabled - Flag.
      Returns:
      This instance.
    • mirror

      public com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> mirror(com.github.shynixn.structureblocklib.api.enumeration.StructureMirror mirror)
      Sets the target mirror type. Default StructureMirror.NONE.
      Specified by:
      mirror in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      mirror - Mirror.
      Returns:
      This instance.
    • rotation

      public com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> rotation(com.github.shynixn.structureblocklib.api.enumeration.StructureRotation rotation)
      Sets the target rotation type. Default StructureRotation.NONE.
      Specified by:
      rotation in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      rotation - Rotation.
      Returns:
      This instance.
    • integrity

      public com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> 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. smaller 1.0 -> Blocks get randomly removed by loading depending on the given setSeed.
      Specified by:
      integrity in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      integrity - Integrity.
      Returns:
      This instance.
    • seed

      public com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V> 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.
      Specified by:
      seed in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      seed - Seed.
      Returns:
      This instance.
    • loadFromSaver

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void> loadFromSaver(@NotNull @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromSaver in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      source - Existing Structure in world defined by StructureSaverAbstract.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromWorld

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromWorld in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      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 public @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromString in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      source - Base64 encoded Structure binary.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromPath

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromPath in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      source - Existing Path.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromFile

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromFile in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      source - Existing File.
      Returns:
      NotNull instance of ProgressToken.
    • loadFromInputStream

      @NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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.

      Specified by:
      loadFromInputStream in interface com.github.shynixn.structureblocklib.api.entity.StructureLoaderAbstract<L,V>
      Parameters:
      source - Open binary inputStream. Does not close the inputStream.
      Returns:
      NotNull instance of ProgressToken.