Handle chunks with no biome data
This commit is contained in:
parent
288a7ad9ea
commit
499d78a0a9
5 changed files with 30 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
|
|
@ -154,7 +155,11 @@ public class ChunkSnapshot
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
if (nbt.hasKey("Biomes")) {
|
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 {
|
else {
|
||||||
this.biome = new byte[COLUMNS_PER_CHUNK];
|
this.biome = new byte[COLUMNS_PER_CHUNK];
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
|
|
@ -154,7 +155,11 @@ public class ChunkSnapshot
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
if (nbt.hasKey("Biomes")) {
|
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 {
|
else {
|
||||||
this.biome = new byte[COLUMNS_PER_CHUNK];
|
this.biome = new byte[COLUMNS_PER_CHUNK];
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
|
|
@ -154,7 +155,11 @@ public class ChunkSnapshot
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
if (nbt.hasKey("Biomes")) {
|
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 {
|
else {
|
||||||
this.biome = new byte[COLUMNS_PER_CHUNK];
|
this.biome = new byte[COLUMNS_PER_CHUNK];
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
|
|
@ -156,7 +157,11 @@ public class ChunkSnapshot
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
if (nbt.hasKey("Biomes")) {
|
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 {
|
else {
|
||||||
this.biome = new byte[COLUMNS_PER_CHUNK];
|
this.biome = new byte[COLUMNS_PER_CHUNK];
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import org.dynmap.renderer.DynmapBlockState;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||||
|
|
@ -154,7 +155,11 @@ public class ChunkSnapshot
|
||||||
}
|
}
|
||||||
/* Get biome data */
|
/* Get biome data */
|
||||||
if (nbt.hasKey("Biomes")) {
|
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 {
|
else {
|
||||||
this.biome = new byte[COLUMNS_PER_CHUNK];
|
this.biome = new byte[COLUMNS_PER_CHUNK];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue