package org.bukkit.structure; import java.util.List; import java.util.Random; import org.bukkit.Location; import org.bukkit.RegionAccessor; import org.bukkit.block.structure.Mirror; import org.bukkit.block.structure.StructureRotation; import org.bukkit.entity.Entity; import org.bukkit.persistence.PersistentDataHolder; import org.bukkit.util.BlockVector; import org.jetbrains.annotations.NotNull; /** * Represents a structure. *
* A structure is a mutable template of captured blocks and entities that can be * copied back into the world. The {@link StructureManager}, retrieved via * {@link org.bukkit.Server#getStructureManager()}, allows you to create new * structures, load existing structures, and save structures. *
* In order for a structure to be usable by structure blocks, it needs to be * null {@link StructureManager#registerStructure(org.bukkit.NamespacedKey, Structure) * registered} with the {@link StructureManager}, or located in the primary * world folder, a DataPack, or the server's own default resources, so that the * StructureManager can find it. */ public interface Structure extends PersistentDataHolder { /** * Gets the current size of the structure. *
* The size of the structure may not be fixed.
*
* @return A new vector that represents the size of the structure along each
* axis.
*/
@NotNull
BlockVector getSize();
/**
* Gets a list of available block palettes.
*
* @return a list of available variants of this structure.
*/
@NotNull
List
* Be careful as this will override the current data of the structure.
*
* Be aware that this method allows for creating structures larger than the
* 48x48x48 size that Minecraft's Structure blocks support. Any structures
* saved this way can not be loaded by using a structure block. Using the
* API however will still work.
*
* @param corner1 A corner of the structure.
* @param corner2 The corner opposite from corner1.
* @param includeEntities true if entities should be included in the saved
* structure.
*/
void fill(@NotNull Location corner1, @NotNull Location corner2, boolean includeEntities);
/**
* Fills the Structure from an area in a world, starting at the specified
* origin and extending in each axis according to the specified size vector.
*
* Be careful as this will override the current data of the structure.
*
* Be aware that this method allows for saving structures larger than the
* 48x48x48 size that Minecraft's Structure blocks support. Any structures
* saved this way can not be loaded by using a structure block. Using the
* API however will still work.
*
* @param origin The origin of the structure.
* @param size The size of the structure, must be at least 1x1x1.
* @param includeEntities true if entities should be included in the saved
* structure.
* @throws IllegalArgumentException Thrown if size is smaller than 1x1x1
*/
void fill(@NotNull Location origin, @NotNull BlockVector size, boolean includeEntities);
}