mirror of https://github.com/webbukkit/dynmap.git
Fix for legacy vs 1.15 biome layout
This commit is contained in:
parent
40472f88fd
commit
deb81d984b
|
@ -1,7 +1,6 @@
|
||||||
package org.dynmap.bukkit.helper.v114_1;
|
package org.dynmap.bukkit.helper.v114_1;
|
||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.libs.jline.internal.Log;
|
|
||||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||||
private final long inhabitedTicks;
|
private final long inhabitedTicks;
|
||||||
|
|
||||||
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
|
private static final int BLOCKS_PER_SECTION = 16 * 16 * 16;
|
||||||
private static final int COLUMNS_PER_CHUNK = 16 * 16 * 4;
|
private static final int COLUMNS_PER_CHUNK = 16 * 16;
|
||||||
|
private static final int V1_15_BIOME_PER_CHUNK = 4 * 4 * 64;
|
||||||
private static final byte[] emptyData = new byte[BLOCKS_PER_SECTION / 2];
|
private static final byte[] emptyData = new byte[BLOCKS_PER_SECTION / 2];
|
||||||
private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2];
|
private static final byte[] fullData = new byte[BLOCKS_PER_SECTION / 2];
|
||||||
|
|
||||||
|
@ -223,12 +224,25 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
||||||
if (nbt.hasKey("Biomes")) {
|
if (nbt.hasKey("Biomes")) {
|
||||||
int[] bb = nbt.getIntArray("Biomes");
|
int[] bb = nbt.getIntArray("Biomes");
|
||||||
if (bb != null) {
|
if (bb != null) {
|
||||||
for (int i = 0; i < bb.length; i++) {
|
// If v1.15+ format
|
||||||
int bv = bb[i];
|
if (bb.length > COLUMNS_PER_CHUNK) {
|
||||||
if (bv < 0) bv = 0;
|
// For now, just pad the grid with the first 16
|
||||||
this.biome[i] = bv;
|
for (int i = 0; i < COLUMNS_PER_CHUNK; i++) {
|
||||||
this.biomebase[i] = bbl[bv];
|
int off = ((i >> 4) & 0xC) + ((i >> 2) & 0x3);
|
||||||
}
|
int bv = bb[off + 64]; // Offset to y=64
|
||||||
|
if (bv < 0) bv = 0;
|
||||||
|
this.biome[i] = bv;
|
||||||
|
this.biomebase[i] = bbl[bv];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // Else, older chunks
|
||||||
|
for (int i = 0; i < bb.length; i++) {
|
||||||
|
int bv = bb[i];
|
||||||
|
if (bv < 0) bv = 0;
|
||||||
|
this.biome[i] = bv;
|
||||||
|
this.biomebase[i] = bbl[bv];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue