From 45e0d37889c879b328f0275b5a1ae7f874d116a8 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 30 Mar 2020 10:27:03 +0100 Subject: [PATCH] Clipboards paste biomes --- .../com/sk89q/worldedit/extent/clipboard/Clipboard.java | 8 +++++--- .../worldedit/function/operation/ForwardExtentCopy.java | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java index bf266c2b0..bb416743c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java @@ -308,16 +308,18 @@ public interface Clipboard extends Extent, Iterable, 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()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index b9e9fb180..1d1dfd8da 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -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);