Implement biomes to filter blocks and use in Clipboard pasting (#1743)

- Fixes #1741
This commit is contained in:
Jordan
2022-06-05 19:52:14 +01:00
committed by GitHub
parent 02eea35c3f
commit 8228b798e5
11 changed files with 110 additions and 7 deletions

View File

@ -227,8 +227,13 @@ public class BlockArrayClipboard implements Clipboard {
@Override
public BiomeType getBiome(BlockVector3 position) {
BlockVector3 v = position.subtract(offset);
return getParent().getBiomeType(v.getX(), v.getY(), v.getZ());
if (!region.contains(position)) {
return null;
}
int x = position.getBlockX() - offset.getX();
int y = position.getBlockY() - offset.getY();
int z = position.getBlockZ() - offset.getZ();
return getParent().getBiomeType(x, y, z);
}
@Override
@ -326,6 +331,7 @@ public class BlockArrayClipboard implements Clipboard {
@Override
public BiomeType getBiomeType(int x, int y, int z) {
x -= offset.getX();
y -= offset.getY();
z -= offset.getZ();
return getParent().getBiomeType(x, y, z);
}

View File

@ -386,7 +386,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable, Fl
int yy = pos.getY() + rely;
int zz = pos.getZ() + relz;
if (pasteBiomes) {
extent.setBiome(xx, yy, zz, Clipboard.this.getBiome(pos));
extent.setBiome(xx, yy, zz, pos.getBiome(this));
}
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
continue;