quick and dirty schematic biomes fix

This commit is contained in:
CreepyCre 2021-02-10 14:23:18 +01:00
parent 81a0f0cbd1
commit e5aa38c559
2 changed files with 10 additions and 3 deletions

View file

@ -59,9 +59,11 @@ public class RelativeBlockSample implements BlockView, ModifiableWorld {
} }
} }
} }
for (int x = 0; x < width; x++) { if (hasBiomes()) {
for (int z = 0; z < length; z++) { for (int x = 0; x < width; x++) {
this.biomeContainer.put(new BlockPos(x, 0, z), this.biomePalette.inverse().get(this.biomeData[x][z])); for (int z = 0; z < length; z++) {
this.biomeContainer.put(new BlockPos(x, 0, z), this.biomePalette.inverse().get(this.biomeData[x][z]));
}
} }
} }
for (CompoundTag blockEntityTag : schematic.getBlockEntities()) { for (CompoundTag blockEntityTag : schematic.getBlockEntities()) {
@ -152,4 +154,8 @@ public class RelativeBlockSample implements BlockView, ModifiableWorld {
public boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth) { public boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth) {
return this.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); return this.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
} }
public boolean hasBiomes() {
return biomeData.length != 0;
}
} }

View file

@ -55,6 +55,7 @@ public final class SchematicPlacer {
int width = schematic.getWidth(); int width = schematic.getWidth();
int length = schematic.getLength(); int length = schematic.getLength();
byte[] biomeDataArray = schematic.getBiomeData().array(); byte[] biomeDataArray = schematic.getBiomeData().array();
if (biomeDataArray.length == 0) return new int[0][0];
int[][] biomeData = new int[width][length]; int[][] biomeData = new int[width][length];
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
for (int z = 0; z < length; z++) { for (int z = 0; z < length; z++) {