mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-13 14:58:35 +00:00
Implement biomes to filter blocks and use in Clipboard pasting (#1743)
- Fixes #1741
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -23,6 +23,7 @@ import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -805,6 +806,14 @@ public abstract class BlockVector3 {
|
||||
return orDefault.getFullBlock(this);
|
||||
}
|
||||
|
||||
public boolean setBiome(Extent orDefault, BiomeType type) {
|
||||
return orDefault.setBiome(this, type);
|
||||
}
|
||||
|
||||
public BiomeType getBiome(Extent orDefault) {
|
||||
return orDefault.getBiome(this);
|
||||
}
|
||||
|
||||
public CompoundTag getNbtData(Extent orDefault) {
|
||||
return orDefault.getFullBlock(getX(), getY(), getZ()).getNbtData();
|
||||
}
|
||||
|
Reference in New Issue
Block a user