mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-23 18:55:14 +01:00
Hack for chunk migration
This commit is contained in:
parent
85012ae478
commit
5645baec94
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.forge_1_18_2;
|
package org.dynmap.forge_1_18_2;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
@ -10,6 +11,7 @@ import org.dynmap.common.BiomeMap;
|
|||||||
import org.dynmap.common.chunk.GenericChunk;
|
import org.dynmap.common.chunk.GenericChunk;
|
||||||
import org.dynmap.common.chunk.GenericChunkCache;
|
import org.dynmap.common.chunk.GenericChunkCache;
|
||||||
import org.dynmap.common.chunk.GenericMapChunkCache;
|
import org.dynmap.common.chunk.GenericMapChunkCache;
|
||||||
|
import org.dynmap.utils.TileFlags;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerChunkCache;
|
import net.minecraft.server.level.ServerChunkCache;
|
||||||
@ -65,6 +67,8 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
|
|||||||
super.setChunks(dw, chunks);
|
super.setChunks(dw, chunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HashMap<String, TileFlags> tmap = new HashMap<String, TileFlags>();
|
||||||
|
|
||||||
private CompoundTag readChunk(int x, int z) {
|
private CompoundTag readChunk(int x, int z) {
|
||||||
try {
|
try {
|
||||||
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z));
|
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z));
|
||||||
@ -82,6 +86,30 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
|
|||||||
rslt = null;
|
rslt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rslt != null) {
|
||||||
|
int version = rslt.getInt("DataVersion");
|
||||||
|
if (version < 2975) {
|
||||||
|
boolean doIt = false;
|
||||||
|
synchronized(tmap) {
|
||||||
|
TileFlags tf = tmap.get(dw.getName());
|
||||||
|
if (tf == null) {
|
||||||
|
tf = new TileFlags();
|
||||||
|
tmap.put(dw.getName(), tf);
|
||||||
|
}
|
||||||
|
if (!tf.getFlag(x, z)) {
|
||||||
|
tf.setFlag(x, z, true);
|
||||||
|
doIt = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (doIt) {
|
||||||
|
ChunkPos pos = new ChunkPos(x, z);
|
||||||
|
CompoundTag newrec = cps.chunkMap.readChunk(pos);
|
||||||
|
if (rslt != null) {
|
||||||
|
cps.chunkMap.write(pos, newrec.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
|
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
|
||||||
// rslt.toString() : "null"));
|
// rslt.toString() : "null"));
|
||||||
return rslt;
|
return rslt;
|
||||||
|
Loading…
Reference in New Issue
Block a user