From 07a5ef5ab485e1f27a3d1ac8108b4269ab8e46f7 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 14 Sep 2020 20:16:46 +0100 Subject: [PATCH] Fix incorrect x/y/z stuff; Fixes #616 Fixes #614 --- .../java/com/sk89q/worldedit/EditSession.java | 2 +- .../worldedit/extent/clipboard/Clipboard.java | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index e1fe896d0..9f61672a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2939,7 +2939,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) { environment.setCurrentBlock(x, y, z); double scaledX = (x - zero.getX()) / unit.getX(); - double scaledY = (x - zero.getY()) / unit.getX(); + double scaledY = (y - zero.getY()) / unit.getY(); double scaledZ = (z - zero.getZ()) / unit.getZ(); try { 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 949c52f8d..3e7b6d93a 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 @@ -311,18 +311,13 @@ public interface Clipboard extends Extent, Iterable, Closeable { pasteBiomes &= Clipboard.this.hasBiomes(); - MutableBlockVector3 blockVector3 = new MutableBlockVector3(); - blockVector3.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); for (BlockVector3 pos : this) { BaseBlock block = pos.getFullBlock(this); int xx = pos.getX() + relx; - int yy = pos.getZ() + relz; - int zz = pos.getY() + rely; - if (hasBiomes() && pos.getBlockY() == 0) { - if (pasteBiomes && (xx != blockVector3.getBlockX() || zz != blockVector3.getBlockZ())) { - blockVector3.setComponents(xx, yy, zz); - extent.setBiome(blockVector3, Clipboard.this.getBiome(BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()))); - } + int yy = pos.getY() + rely; + int zz = pos.getZ() + relz; + if (pasteBiomes) { + extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()))); } if (!pasteAir && block.getBlockType().getMaterial().isAir()) { continue; @@ -330,7 +325,7 @@ public interface Clipboard extends Extent, Iterable, Closeable { if (pos.getY() < 0) { throw new RuntimeException("Y-Position cannot be less than 0!"); } - extent.setBlock(xx, pos.getY() + rely, zz, block); + extent.setBlock(xx, yy, zz, block); } // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) final int entityOffsetX = to.getBlockX() - origin.getBlockX();