Clipboards paste biomes

This commit is contained in:
dordsor21 2020-03-30 10:27:03 +01:00
parent 8597ab1ce8
commit 45e0d37889
2 changed files with 10 additions and 5 deletions

View File

@ -308,16 +308,18 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
final int rely = to.getBlockY() - origin.getBlockY();
final int relz = to.getBlockZ() - origin.getBlockZ();
pasteBiomes &= Clipboard.this.hasBiomes();
MutableBlockVector2 mpos2d = new MutableBlockVector2();
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
for (BlockVector3 pos : this) {
BaseBlock block = pos.getFullBlock(this);
int xx = pos.getX() + relx;
int zz = pos.getZ() + relz;
if (hasBiomes()) {
if (pasteBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
if (hasBiomes() && pos.getBlockY() == 0) {
if (pasteBiomes && (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ())) {
mpos2d.setComponents(xx, zz);
extent.setBiome(mpos2d, Clipboard.this.getBiome(pos.toBlockVector2()));
extent.setBiome(mpos2d, Clipboard.this.getBiome(BlockVector2.at(pos.getX(), pos.getZ())));
}
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.function.operation;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.boydti.fawe.object.extent.BlockTranslateExtent;
import com.boydti.fawe.object.extent.PositionTransformExtent;
import com.boydti.fawe.object.function.block.BiomeCopy;
@ -31,7 +32,9 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.metadata.EntityProperties;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.FastSchematicReader;
import com.sk89q.worldedit.function.CombinedRegionFunction;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.RegionMaskTestFunction;
@ -319,7 +322,7 @@ public class ForwardExtentCopy implements Operation {
new MaskTraverser(sourceMask).reset(transExt);
copy = new RegionMaskingFilter(source, sourceMask, copy);
}
if (copyingBiomes && source.isWorld() || (source instanceof Clipboard && ((Clipboard) source).hasBiomes())) {
if (copyingBiomes && (source.isWorld() || region instanceof FlatRegion)) {
copy = CombinedRegionFunction.combine(copy, new BiomeCopy(source, finalDest));
}
blockCopy = new BackwardsExtentBlockCopy(region, from, transform, copy);
@ -373,7 +376,7 @@ public class ForwardExtentCopy implements Operation {
if (maskFunc != null) copy = new RegionMaskTestFunction(sourceMask, copy, maskFunc);
else copy = new RegionMaskingFilter(source, sourceMask, copy);
}
if (copyingBiomes && source.isWorld() || (source instanceof Clipboard && ((Clipboard) source).hasBiomes())) {
if (copyingBiomes && (source.isWorld() || region instanceof FlatRegion)) {
copy = CombinedRegionFunction.combine(copy, new BiomeCopy(source, finalDest));
}
blockCopy = new RegionVisitor(region, copy);