mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Add biome storage to BlockArrayClipboard.
This commit is contained in:
parent
4e66b9a336
commit
a80420d14b
@ -51,6 +51,7 @@ public class BlockArrayClipboard implements Clipboard {
|
|||||||
private final Region region;
|
private final Region region;
|
||||||
private BlockVector3 origin;
|
private BlockVector3 origin;
|
||||||
private final BaseBlock[][][] blocks;
|
private final BaseBlock[][][] blocks;
|
||||||
|
private BiomeType[][] biomes = null;
|
||||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,11 +163,25 @@ public class BlockArrayClipboard implements Clipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector2 position) {
|
public BiomeType getBiome(BlockVector2 position) {
|
||||||
|
if (biomes != null
|
||||||
|
&& position.containedWithin(getMinimumPoint().toBlockVector2(), getMaximumPoint().toBlockVector2())) {
|
||||||
|
BlockVector2 v = position.subtract(region.getMinimumPoint().toBlockVector2());
|
||||||
|
return biomes[v.getBlockX()][v.getBlockZ()];
|
||||||
|
}
|
||||||
|
|
||||||
return BiomeTypes.OCEAN;
|
return BiomeTypes.OCEAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||||
|
if (position.containedWithin(getMinimumPoint().toBlockVector2(), getMaximumPoint().toBlockVector2())) {
|
||||||
|
BlockVector2 v = position.subtract(region.getMinimumPoint().toBlockVector2());
|
||||||
|
if (biomes == null) {
|
||||||
|
biomes = new BiomeType[region.getWidth()][region.getLength()];
|
||||||
|
}
|
||||||
|
biomes[v.getBlockX()][v.getBlockZ()] = biome;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
throw new IOException("This schematic version is currently not supported");
|
throw new IOException("This schematic version is currently not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Clipboard readVersion1(CompoundTag schematicTag) throws IOException {
|
private BlockArrayClipboard readVersion1(CompoundTag schematicTag) throws IOException {
|
||||||
BlockVector3 origin;
|
BlockVector3 origin;
|
||||||
Region region;
|
Region region;
|
||||||
Map<String, Tag> schematic = schematicTag.getValue();
|
Map<String, Tag> schematic = schematicTag.getValue();
|
||||||
|
Loading…
Reference in New Issue
Block a user