replace
Replace all the blocks of a certain type inside the specified region with a new block type
blocks.replace(
GRASS,
GRASS,
pos(0, 0, 0),
pos(0, 0, 0)
);
Parameters
- newblock: the new block type that replaces existing blocks
- oldblock: the block type that is replaced by the new block type
- from: the first corner of the cubic region
- to: the opposite corner of the cubic region
Example
Replace coal ore with shiny diamond ore around the player!
player.onTravelled(TravelMethod.Walk, () => {
blocks.replace(
DIAMOND_ORE,
COAL_ORE,
pos(-2, -2, -2),
pos(2, 2, 2)
);
});