Fix handling of new, additional buiomes

This commit is contained in:
Mike Primm 2021-12-05 05:01:59 -06:00
parent dac53e38fc
commit ddc484d737
8 changed files with 40 additions and 20 deletions

View file

@ -56,6 +56,7 @@ import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -283,12 +284,7 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
@Override
/** Get ID string from biomebase */
public String getBiomeBaseIDString(Object bb) {
String s = ((BiomeBase)bb).toString();
if (s != null) {
String[] ss = s.split("\\.");
return ss[ss.length-1];
}
return null;
return getBiomeReg().b((BiomeBase)bb).a();
}
@Override
public String getBiomeBaseResourceLocsation(Object bb) {

View file

@ -35,6 +35,7 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
import org.dynmap.Log;
/**
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
@ -56,7 +57,9 @@ public class MapChunkCache118 extends GenericMapChunkCache {
if (nbt == null) return null;
// Start generic chunk builder
GenericChunk.Builder bld = new GenericChunk.Builder(dw.minY, dw.worldheight);
bld.coords(nbt.h("xPos"), nbt.h("zPos"));
int cx = nbt.h("xPos");
int cz = nbt.h("zPos");
bld.coords(cx, cz);
if (nbt.e("InhabitedTime")) {
bld.inhabitedTicks(nbt.i("InhabitedTime"));
}
@ -213,7 +216,9 @@ public class MapChunkCache118 extends GenericMapChunkCache {
bdata = new SimpleBitStorage(bdataPacked.length, 64, bdataPacked);
for (int j = 0; j < 64; j++) {
int b = bdata != null ? bdata.a(j) : 0;
sbld.xyzBiome(j & 0x3, (j & 0x30) >> 4, (j & 0xC) >> 2, BiomeMap.byBiomeResourceLocation(bpalette.j(b)));
String rl = bpalette.j(b);
BiomeMap bm = BiomeMap.byBiomeResourceLocation(rl);
sbld.xyzBiome(j & 0x3, (j & 0x30) >> 4, (j & 0xC) >> 2, bm);
}
}
else { // Else, apply legacy biomes