Class: ClipboardItem
A ClipboardItem is a handle to an object which represents a set of blocks in a contained bounding area (most likely copied from the world)
Constructors
new ClipboardItem()
private
new ClipboardItem():ClipboardItem
Returns
Properties
isEmpty
readonly
isEmpty:boolean
Remarks
Return whether there is any block content in the item
Throws
This property can throw when used.
Methods
clear()
clear():
void
Returns
void
Remarks
Clear the contents of the item
This function can't be called in read-only mode.
Throws
This function can throw errors.
getPredictedWriteAsCompoundBlockVolume()
getPredictedWriteAsCompoundBlockVolume(
location
,options
?):CompoundBlockVolume
Parameters
Parameter | Type | Description |
---|---|---|
location | Vector3 | A world location to which the ClipboardItem may potentially be written (nothing is actually written as part of this operation) |
options ? | ClipboardWriteOptions | An optional set of write parameters which govern how the ClipboardItem should be potentially applied to the world |
Returns
CompoundBlockVolume
A @minecraft/server.CompoundBlockVolume which represents the occupied block volumes within the ClipboardItem as they would be written to the world with the specified ClipboardWriteOptions
Remarks
Create a @minecraft/server.CompoundBlockVolume container which represents the occupied block volumes within the ClipboardItem. This function does not perform any write operations, and instead returns only a prediction of the volume area which would be affected as part of a write operation with a given set of write options.
This function can't be called in read-only mode.
Throws
This function can throw errors.
getPredictedWriteAsSelection()
getPredictedWriteAsSelection(
location
,options
?):Selection
Parameters
Parameter | Type | Description |
---|---|---|
location | Vector3 | A world location to which the ClipboardItem may potentially be written (nothing is actually written as part of this operation) |
options ? | ClipboardWriteOptions | An optional set of write parameters which govern how the ClipboardItem should be potentially applied to the world |
Returns
A Selection which represents the occupied block volumes within the ClipboardItem as they would be written to the world with the specified ClipboardWriteOptions
Remarks
Create a Selection container which represents the occupied block volumes within the ClipboardItem. This function does not perform any write operations, and instead returns only a prediction of the volume area which would be affected as part of a write operation with a given set of write options.
This function can't be called in read-only mode.
Throws
This function can throw errors.
getSize()
getSize():
Vector3
Returns
Vector3
Remarks
Get the bounding size of the ClipboardItem
This function can't be called in read-only mode.
Throws
This function can throw errors.
readFromSelection()
readFromSelection(
selection
):void
Parameters
Parameter | Type | Description |
---|---|---|
selection | Selection | A volume which represents the area to be copied |
Returns
void
Remarks
Copy the contents of the area represented by a Selection volume into the ClipboardItem
This function can't be called in read-only mode.
Throws
This function can throw errors.
readFromWorld()
readFromWorld(
from
,to
):void
Parameters
Parameter | Type | Description |
---|---|---|
from | Vector3 | The world location of one corner of a bounding volume |
to | Vector3 | The world location of the opposite corner of a bounding volume |
Returns
void
Remarks
Copy the contents of a rectangular volume into the Clipboard Item
This function can't be called in read-only mode.
Throws
This function can throw errors.
writeToWorld()
writeToWorld(
location
,options
?):boolean
Parameters
Parameter | Type | Description |
---|---|---|
location | Vector3 | The root point of the world location to which the ClipboardItem is written (this is modified by the various anchor, offset and rotation parameters of the ClipboardWriteOptions |
options ? | ClipboardWriteOptions | An optional set of write parameters which modify the properties of the ClipboardItem as it is applied to the world |
Returns
boolean
Success or Failure
Remarks
Apply the contents of a ClipboardItem to the world at a given location using a set of write options
This function can't be called in read-only mode.
Throws
This function can throw errors.