clone Filtered

Clone, make a copy of a cubic region from one location into a another location. But, only clone if the blocks in the region match a certain block type.

blocks.cloneFiltered(
    pos(0, 0, 0),
    pos(0, 0, 0),
    pos(0, 0, 0),
    GRASS,
    CloneMode.Normal
);

Parameters

  • begin: the first corner of the cubic region
  • end: the opposite corner of the cubic region
  • destination: the first corner of the destination region
  • block: the block type to look for when cloning
  • mode: how to handle the cloned region:
    • normal: the cloned region is not changed; if the destination region overlaps it, then the clone operation does nothing
    • force: the cloned region is overwritten by the destination region if the two regions overlap
    • move: the cloned region is replaced with air after the clone operation

The clone command in the Minecraft wiki describes how cloning works.

Example

This code moves gold ore that is under the player to a region above the player. This makes the ore easier to see and mine.

player.onTravelled(TravelMethod.Walk, () => {
    blocks.cloneFiltered(
        pos(-2, -3, -2),
        pos(2, 0, 2),
        pos(-2, 3, -2),
        GOLD_ORE,
        CloneMode.Move
    );
});

See Also

||blocks:clone||