Fix 1.14 biome mapping

This commit is contained in:
Mike Primm 2019-06-08 21:47:43 -05:00
parent 82de1b6899
commit 7f8dcf0eb3
4 changed files with 25 additions and 5 deletions

View File

@ -103,6 +103,10 @@ public class BiomeMap {
new BiomeMap(49, "DEEP_COLD_OCEAN");
new BiomeMap(50, "DEEP_FROZEN_OCEAN");
}
if (HDBlockModels.checkVersionRange(mcver, "1.14.0-")) {
new BiomeMap(168, "BAMBOO_JUNGLE");
new BiomeMap(169, "BAMBOO_JUNGLE_HILLS");
}
loadDone = true;
}

View File

@ -12,6 +12,7 @@ import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.SnapshotCache;
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
import org.dynmap.renderer.DynmapBlockState;
@ -41,6 +42,7 @@ public class MapChunkCache114_1 extends AbstractMapChunkCache {
private final Section[] section;
private final int[] hmap; // Height map
private final int[] biome;
private final Object[] biomebase;
private final long captureFulltime;
private final int sectionCnt;
private final long inhabitedTicks;
@ -119,6 +121,7 @@ public class MapChunkCache114_1 extends AbstractMapChunkCache {
this.z = z;
this.captureFulltime = captime;
this.biome = new int[COLUMNS_PER_CHUNK];
this.biomebase = new Object[COLUMNS_PER_CHUNK];
this.sectionCnt = worldheight / 16;
/* Allocate arrays indexed by section */
this.section = new Section[this.sectionCnt];
@ -214,12 +217,16 @@ public class MapChunkCache114_1 extends AbstractMapChunkCache {
}
/* Get biome data */
this.biome = new int[COLUMNS_PER_CHUNK];
this.biomebase = new Object[COLUMNS_PER_CHUNK];
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
if (nbt.hasKey("Biomes")) {
int[] bb = nbt.getIntArray("Biomes");
if (bb != null) {
for (int i = 0; i < bb.length; i++) {
int bv = bb[i];
this.biome[i] = (bv < 0) ? 0 : bv;
if (bv < 0) bv = 0;
this.biome[i] = bv;
this.biomebase[i] = bbl[bv];
}
}
}
@ -276,7 +283,7 @@ public class MapChunkCache114_1 extends AbstractMapChunkCache {
@Override
public Object[] getBiomeBaseFromSnapshot() {
return null;
return this.biomebase;
}
}

View File

@ -89,6 +89,8 @@ public class BukkitVersionHelperSpigot114 extends BukkitVersionHelperCB {
biomelist = new Object[1024];
for (int i = 0; i < 1024; i++) {
biomelist[i] = IRegistry.BIOME.fromId(i);
if (biomelist[i] != null)
Log.info("biome[" + i + "]=" + biomelist[i].toString());
}
}
return biomelist;

View File

@ -11,6 +11,7 @@ import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.bukkit.helper.AbstractMapChunkCache;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.SnapshotCache;
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
import org.dynmap.renderer.DynmapBlockState;
@ -40,6 +41,7 @@ public class MapChunkCache114 extends AbstractMapChunkCache {
private final Section[] section;
private final int[] hmap; // Height map
private final int[] biome;
private final Object[] biomebase;
private final long captureFulltime;
private final int sectionCnt;
private final long inhabitedTicks;
@ -118,6 +120,7 @@ public class MapChunkCache114 extends AbstractMapChunkCache {
this.z = z;
this.captureFulltime = captime;
this.biome = new int[COLUMNS_PER_CHUNK];
this.biomebase = new Object[COLUMNS_PER_CHUNK];
this.sectionCnt = worldheight / 16;
/* Allocate arrays indexed by section */
this.section = new Section[this.sectionCnt];
@ -213,14 +216,18 @@ public class MapChunkCache114 extends AbstractMapChunkCache {
}
/* Get biome data */
this.biome = new int[COLUMNS_PER_CHUNK];
this.biomebase = new Object[COLUMNS_PER_CHUNK];
Object[] bbl = BukkitVersionHelper.helper.getBiomeBaseList();
if (nbt.hasKey("Biomes")) {
int[] bb = nbt.getIntArray("Biomes");
if (bb != null) {
for (int i = 0; i < bb.length; i++) {
int bv = bb[i];
this.biome[i] = (bv < 0) ? 0 : bv;
if (bv < 0) bv = 0;
this.biome[i] = bv;
this.biomebase[i] = bbl[bv];
}
}
}
}
}
@ -275,7 +282,7 @@ public class MapChunkCache114 extends AbstractMapChunkCache {
@Override
public Object[] getBiomeBaseFromSnapshot() {
return null;
return this.biomebase;
}
}