Handle chunks with no biome data

This commit is contained in:
Mike Primm 2018-09-05 19:48:14 -05:00
parent 4afef4503a
commit 09ccad6eca
5 changed files with 30 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.chunk.NibbleArray;
import scala.actors.threadpool.Arrays;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@ -154,7 +155,11 @@ public class ChunkSnapshot
}
/* Get biome data */
if (nbt.hasKey("Biomes")) {
this.biome = nbt.getByteArray("Biomes");
byte[] b = nbt.getByteArray("Biomes");
if (b.length < COLUMNS_PER_CHUNK) {
b = Arrays.copyOf(b, COLUMNS_PER_CHUNK);
}
this.biome = b;
}
else {
this.biome = new byte[COLUMNS_PER_CHUNK];

View File

@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.chunk.NibbleArray;
import scala.actors.threadpool.Arrays;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@ -154,7 +155,11 @@ public class ChunkSnapshot
}
/* Get biome data */
if (nbt.hasKey("Biomes")) {
this.biome = nbt.getByteArray("Biomes");
byte[] b = nbt.getByteArray("Biomes");
if (b.length < COLUMNS_PER_CHUNK) {
b = Arrays.copyOf(b, COLUMNS_PER_CHUNK);
}
this.biome = b;
}
else {
this.biome = new byte[COLUMNS_PER_CHUNK];

View File

@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.chunk.NibbleArray;
import scala.actors.threadpool.Arrays;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@ -154,7 +155,11 @@ public class ChunkSnapshot
}
/* Get biome data */
if (nbt.hasKey("Biomes")) {
this.biome = nbt.getByteArray("Biomes");
byte[] b = nbt.getByteArray("Biomes");
if (b.length < COLUMNS_PER_CHUNK) {
b = Arrays.copyOf(b, COLUMNS_PER_CHUNK);
}
this.biome = b;
}
else {
this.biome = new byte[COLUMNS_PER_CHUNK];

View File

@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import scala.actors.threadpool.Arrays;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@ -156,7 +157,11 @@ public class ChunkSnapshot
}
/* Get biome data */
if (nbt.hasKey("Biomes")) {
this.biome = nbt.getByteArray("Biomes");
byte[] b = nbt.getByteArray("Biomes");
if (b.length < COLUMNS_PER_CHUNK) {
b = Arrays.copyOf(b, COLUMNS_PER_CHUNK);
}
this.biome = b;
}
else {
this.biome = new byte[COLUMNS_PER_CHUNK];

View File

@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.chunk.NibbleArray;
import scala.actors.threadpool.Arrays;
/**
* Represents a static, thread-safe snapshot of chunk of blocks
@ -154,7 +155,11 @@ public class ChunkSnapshot
}
/* Get biome data */
if (nbt.hasKey("Biomes")) {
this.biome = nbt.getByteArray("Biomes");
byte[] b = nbt.getByteArray("Biomes");
if (b.length < COLUMNS_PER_CHUNK) {
b = Arrays.copyOf(b, COLUMNS_PER_CHUNK);
}
this.biome = b;
}
else {
this.biome = new byte[COLUMNS_PER_CHUNK];