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 Summary
Modifier and TypeMethodDescriptionSets the target Location corner where the blocks start to get placed.floatGets the target integrity.Gets the target Location.Gets the target mirror type.Gets the target rotation type.longgetSeed()Gets the target seed.includeBlocks(boolean enabled) Should blocks which may or may not be included in the saved file be included in the loaded structure.includeEntities(boolean enabled) Should entities which may or may not be included in the saved file be included in the loaded structure.integrity(float integrity) Sets the target integrity.booleanShould blocks which may or may not be included in the saved file be included in the loaded structure.booleanShould entities which may or may not be included in the saved file be included in the loaded structure.@NotNull 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 ProgressToken<Void>loadFromInputStream(@NotNull InputStream source) Loads the structure blocks and entities from the given source and places the blocks at the defined position.@NotNull 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 ProgressToken<Void>loadFromSaver(@NotNull StructureSaverAbstract<L, V> source) Loads the structure blocks and entities from the given source and places the blocks at the defined position.@NotNull 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 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.mirror(StructureMirror mirror) Sets the target mirror type.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.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.rotation(StructureRotation rotation) Sets the target rotation type.seed(long seed) Sets the target seed.
-
Method Details
-
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 givengetSeed.- Returns:
- integrity.
-
getSeed
long getSeed()Gets the target seed. Default 0L. The seed is used to randomly remove blocks if the integritygetIntegrityis less than 1.0.- Returns:
- seed.
-
at
Sets the target Location corner where the blocks start to get placed. Required parameter.- Parameters:
location- Location.- Returns:
- This instance.
-
includeEntities
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
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
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 givensetSeed.- Parameters:
integrity- Integrity.- Returns:
- This instance.
-
seed
Sets the target seed. Default 0L. The seed is used to randomly remove blocks if the integritysetIntegrityis less than 1.0.- Parameters:
seed- Seed.- Returns:
- This instance.
-
onProcessBlock
@NotNull @NotNull StructureLoaderAbstract<L,V, onProcessBlockB, E, W> (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, onProcessEntityB, E, W> (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 byStructureSaverAbstract.- 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
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
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
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
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.
-