Allow copy/pasting biomes.

Copy takes a -b flag to copy biomes.
Paste takes a -b flag to paste biomes (if available).
This allows flexibility to create/load schematics with/without biomes
(when schematic biome support is added).

Also added a -m mask flag to paste to set a source mask, and a -e flag
to skip pasting entities if they are loaded.
This commit is contained in:
wizjany
2019-04-03 20:57:51 -04:00
committed by Matthew Miller
parent 26511bcc25
commit af1af43ac1
7 changed files with 214 additions and 11 deletions

View File

@ -161,6 +161,11 @@ public class BlockArrayClipboard implements Clipboard {
}
}
@Override
public boolean hasBiomes() {
return biomes != null;
}
@Override
public BiomeType getBiome(BlockVector2 position) {
if (biomes != null

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.extent.clipboard;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
@ -58,4 +59,15 @@ public interface Clipboard extends Extent {
*/
void setOrigin(BlockVector3 origin);
/**
* Returns true if the clipboard has biome data. This can be checked since {@link Extent#getBiome(BlockVector2)}
* strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes.OCEAN} instead of {@code null}
* if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting
* to ocean, instead of having biomes explicitly set.
*
* @return true if the clipboard has biome data set
*/
default boolean hasBiomes() {
return false;
}
}