Interface StructureTemplate
- All Superinterfaces:
Keyed, Registerable<StructureTemplate>, Wrapper
@NullMarked
@AsOf("3.4.0")
public interface StructureTemplate
extends Wrapper, Keyed, Registerable<StructureTemplate>
A structure template: the NBT file a jigsaw piece or a template feature stamps into the world.
- Since:
- 3.4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionkey()The identifier of the template.static StructureTemplateNames the template stored under the given identifier in theminecraftnamespace.static StructureTemplateof(ResourceKey key) Names a template Minecraft already knows about, from a data pack or the world'sgeneratedfolder.static StructureTemplateof(ResourceKey key, URL nbtResource) Creates a template loaded from an NBT resource, such as one inside a plugin jar obtained withClass.getResource(String).static StructureTemplateof(ResourceKey key, Path nbtFile) Creates a template loaded from an NBT file on disk, such as one saved with a structure block.register()Loads this template's source file into the server's template manager under its key.source()The NBT file this template is loaded from when registered.Methods inherited from interface Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
key
The identifier of the template. -
source
-
register
Loads this template's source file into the server's template manager under its key.Call this once the server exists.
onLoador later and before any structure that places the template generates.- Specified by:
registerin interfaceRegisterable<StructureTemplate>- Returns:
- this template
- Throws:
IllegalStateException- if this template has no source file, or no server is running yetUncheckedIOException- if the source file cannot be read as a structure template- Since:
- 3.4.0
-
of
Names a template Minecraft already knows about, from a data pack or the world'sgeneratedfolder.- Parameters:
key- the identifier of the template- Returns:
- a handle onto that template
- Since:
- 3.4.0
-
of
Creates a template loaded from an NBT file on disk, such as one saved with a structure block.- Parameters:
key- the identifier to register the template undernbtFile- the gzip-compressed.nbtfile- Returns:
- a template that can be
registered - Since:
- 3.4.0
-
of
Creates a template loaded from an NBT resource, such as one inside a plugin jar obtained withClass.getResource(String).- Parameters:
key- the identifier to register the template undernbtResource- the gzip-compressed.nbtresource- Returns:
- a template that can be
registered - Since:
- 3.4.0
-
minecraft
Names the template stored under the given identifier in theminecraftnamespace.- Parameters:
path- the path of the template- Returns:
- a handle onto that template
- Since:
- 3.4.0
-