Add biome storage to BlockArrayClipboard.

Dieser Commit ist enthalten in:
wizjany 2019-03-30 00:42:28 -04:00
Ursprung 4e66b9a336
Commit a80420d14b
2 geänderte Dateien mit 16 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -51,6 +51,7 @@ public class BlockArrayClipboard implements Clipboard {
private final Region region;
private BlockVector3 origin;
private final BaseBlock[][][] blocks;
private BiomeType[][] biomes = null;
private final List<ClipboardEntity> entities = new ArrayList<>();
/**
@ -162,11 +163,25 @@ public class BlockArrayClipboard implements Clipboard {
@Override
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;
}
@Override
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;
}

Datei anzeigen

@ -93,7 +93,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
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;
Region region;
Map<String, Tag> schematic = schematicTag.getValue();