Interface WorldEditApi<C>
- Type Parameters:
C
- the WorldEdit clipboard type for the specific version being used
This interface provides a unified abstraction layer for WorldEdit operations that may vary between different WorldEdit and Minecraft versions. It handles clipboard operations, schematic loading, and structure pasting with support for transformations and positioning.
The generic type C
represents the WorldEdit clipboard type, which varies between
WorldEdit versions (e.g., Clipboard
in newer versions vs CuboidClipboard
in older versions).
-
Method Summary
Modifier and TypeMethodDescriptiongetClipboardByFile
(@NotNull World world, @NotNull File file) Loads a schematic file into a WorldEdit clipboard object.boolean
pasteByFile
(@NotNull File file, @NotNull Location location, int rotation) Loads and pastes a schematic file directly to the specified location.boolean
pasteClipboard
(@NotNull World world, C clipboard, @NotNull Vector origin, int rotation, int xOffset, int yOffset, int zOffset, boolean flipX, boolean flipZ) Pastes a WorldEdit clipboard into the specified world with transformations.
-
Method Details
-
pasteClipboard
boolean pasteClipboard(@NotNull @NotNull World world, @NotNull C clipboard, @NotNull @NotNull Vector origin, int rotation, int xOffset, int yOffset, int zOffset, boolean flipX, boolean flipZ) Pastes a WorldEdit clipboard into the specified world with transformations.This method places the contents of a WorldEdit clipboard at the specified origin point with optional rotation, translation, and mirroring transformations applied. The paste operation respects WorldEdit's standard behavior for block placement and entity handling.
The rotation is applied counterclockwise around the Y-axis, and offsets are applied after rotation. Flipping operations are applied in the clipboard's local coordinate system before rotation and translation.
- Parameters:
world
- theWorld
to paste the clipboard intoclipboard
- the WorldEdit clipboard object containing the blocks to pasteorigin
- theVector
position where the clipboard should be pastedrotation
- the degree rotation to apply counterclockwise around the Y-axisxOffset
- the X-axis offset to apply after rotationyOffset
- the Y-axis offset to apply after rotationzOffset
- the Z-axis offset to apply after rotationflipX
- whether to flip the clipboard along the X-axis before rotationflipZ
- whether to flip the clipboard along the Z-axis before rotation- Returns:
true
if the paste operation completed without WorldEdit errors,false
if WorldEdit encountered issues during pasting
-
pasteByFile
boolean pasteByFile(@NotNull @NotNull File file, @NotNull @NotNull Location location, int rotation) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException Loads and pastes a schematic file directly to the specified location.This convenience method loads a schematic file from disk and immediately pastes it at the specified location with the given rotation. This is useful for one-time paste operations where clipboard management is not needed.
The rotation is applied counterclockwise around the Y-axis at the paste location.
- Parameters:
file
- the schematicFile
to load and pastelocation
- theLocation
where the schematic should be pastedrotation
- the degree rotation to apply counterclockwise around the Y-axis- Returns:
true
if the paste operation completed without WorldEdit errors,false
if WorldEdit encountered issues during loading or pasting- Throws:
NoSuchMethodException
- if the required WorldEdit methods are not availableInvocationTargetException
- if WorldEdit method invocation failsIllegalAccessException
- if WorldEdit method access is deniedInstantiationException
- if WorldEdit object instantiation fails
-
getClipboardByFile
Loads a schematic file into a WorldEdit clipboard object.This method loads a schematic file from disk and creates a WorldEdit clipboard object that can be used for multiple paste operations or clipboard manipulation. The returned clipboard contains all block data, entity data, and metadata from the original schematic.
The world parameter is required for some WorldEdit versions to properly initialize the clipboard with the correct world context.
-