Class StructureSaverAbstractImpl<L,V>
java.lang.Object
com.github.shynixn.structureblocklib.core.entity.StructureSaverAbstractImpl<L,V>
- All Implemented Interfaces:
com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V>
public class StructureSaverAbstractImpl<L,V>
extends Object
implements com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V>
Interface fluent API to save structures from the world into
different targets.
-
Constructor Summary
ConstructorsConstructorDescriptionStructureSaverAbstractImpl(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 save instance. -
Method Summary
Modifier and TypeMethodDescriptionSets the source Location corner where the blocks start to get saved.Sets the author.@Nullable StringGets the author.Gets the target Location.Gets the offset of the selection.@NotNull com.github.shynixn.structureblocklib.api.enumeration.StructureRestrictionGets the size restriction.@NotNull StringGets the name of the block type which is being used as a Structure_Void.includeEntities(boolean enabled) Should entities be included in the save file.booleanShould entities included in the saved file.Sets the source Vector offset where the blocks reach to get saved.restriction(@NotNull com.github.shynixn.structureblocklib.api.enumeration.StructureRestriction structureRestriction) Restricts the structure to a certain size if a larger area is selected with offset.@NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>saveToFile(@NotNull File target) Saves the blocks and entities from the world into into a structure.nbt file.@NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>saveToOutputStream(@NotNull OutputStream target) Saves the blocks and entities from the world into into a structure.nbt binary stream.@NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>saveToPath(@NotNull Path target) Saves the blocks and entities from the world into into a structure.nbt file.@NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<String>Saves the blocks and entities from the world into into a structure.nbt binary as Base64 encoded string.@NotNull com.github.shynixn.structureblocklib.api.entity.ProgressToken<Void>saveToWorld(@NotNull String worldName, @NotNull String author, @NotNull String name) Saves the blocks and entities from the world into into a structure.nbt file located in the world folder, author folder.sizeX(int x) Sets the offset in x coordinate.sizeY(int y) Sets the offset in y coordinate.sizeZ(int z) Sets the offset in z coordinate.structureVoidTypeName(@NotNull String name) Sets the name of the block type which is being used as a Structure_Void.
-
Constructor Details
-
StructureSaverAbstractImpl
public StructureSaverAbstractImpl(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 save instance.- Parameters:
proxyService- dependency.serializationService- dependency.worldService- dependency.
-
-
Method Details
-
getLocation
Gets the target Location. -
getOffset
Gets the offset of the selection. Has to be smaller or equal toStructureRestriction. -
getAuthor
Gets the author. The author is a optional meta data in the final structure file. -
isIncludeEntitiesEnabled
public boolean isIncludeEntitiesEnabled()Should entities included in the saved file. Default false. -
getRestriction
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.enumeration.StructureRestriction getRestriction()Gets the size restriction.Default StructureRestriction.SINGLE_32.
-
getStructureVoidTypeName
Gets the name of the block type which is being used as a Structure_Void.Default STRUCTURE_VOID in 1.10 - Latest, BARRIER_BLOCK in 1.9.
If the selected structure contains blocks with this typename. They are going to get ignored.
-
at
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> at(@Nullable L location) Sets the source Location corner where the blocks start to get saved. Required parameter. -
offSet
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> offSet(@Nullable V vector) Sets the source Vector offset where the blocks reach to get saved. Required parameter. -
sizeX
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> sizeX(int x) Sets the offset in x coordinate. -
sizeY
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> sizeY(int y) Sets the offset in y coordinate. -
sizeZ
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> sizeZ(int z) Sets the offset in z coordinate. -
author
public com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> author(@Nullable @Nullable String author) Sets the author. The author is a optional meta data in the final structure file. -
includeEntities
public com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> includeEntities(boolean enabled) Should entities be included in the save file. Default false. -
restriction
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> restriction(@NotNull @NotNull com.github.shynixn.structureblocklib.api.enumeration.StructureRestriction structureRestriction) Restricts the structure to a certain size if a larger area is selected with offset. Default StructureRestriction.SINGLE_32. -
structureVoidTypeName
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.StructureSaverAbstract<L,V> structureVoidTypeName(@NotNull @NotNull String name) Sets the name of the block type which is being used as a Structure_Void. Default STRUCTURE_VOID in 1.10 - Latest, BARRIER_BLOCK in 1.9. -
saveToWorld
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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. -
saveToString
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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. -
saveToPath
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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. -
saveToFile
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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. -
saveToOutputStream
@NotNull public @NotNull com.github.shynixn.structureblocklib.api.entity.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.
-