Update BlueNBT

This commit is contained in:
Lukas Rieger (Blue) 2024-09-13 15:09:08 +02:00
parent 57e0e5efe2
commit 79fd4d0201
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
14 changed files with 136 additions and 61 deletions

View File

@ -25,7 +25,6 @@
package de.bluecolored.bluemap.core.map.renderstate; package de.bluecolored.bluemap.core.map.renderstate;
import com.flowpowered.math.vector.Vector2i; import com.flowpowered.math.vector.Vector2i;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.logger.Logger; import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.storage.GridStorage; import de.bluecolored.bluemap.core.storage.GridStorage;
import de.bluecolored.bluemap.core.storage.compression.CompressedInputStream; import de.bluecolored.bluemap.core.storage.compression.CompressedInputStream;
@ -33,6 +32,7 @@
import de.bluecolored.bluemap.core.util.PalettedArrayAdapter; import de.bluecolored.bluemap.core.util.PalettedArrayAdapter;
import de.bluecolored.bluemap.core.util.RegistryAdapter; import de.bluecolored.bluemap.core.util.RegistryAdapter;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.BlueNBT;
import de.bluecolored.bluenbt.TypeToken;
import lombok.Getter; import lombok.Getter;
import java.io.IOException; import java.io.IOException;
@ -44,8 +44,8 @@ abstract class CellStorage<T extends CellStorage.Cell> {
private static final BlueNBT BLUE_NBT = new BlueNBT(); private static final BlueNBT BLUE_NBT = new BlueNBT();
static { static {
BLUE_NBT.register(TypeToken.get(TileState.class), new RegistryAdapter<>(TileState.REGISTRY, Key.BLUEMAP_NAMESPACE, TileState.UNKNOWN)); BLUE_NBT.register(TypeToken.of(TileState.class), new RegistryAdapter<>(TileState.REGISTRY, Key.BLUEMAP_NAMESPACE, TileState.UNKNOWN));
BLUE_NBT.register(TypeToken.get(TileState[].class), new PalettedArrayAdapter<>(BLUE_NBT, TileState.class)); BLUE_NBT.register(TypeToken.of(TileState[].class), new PalettedArrayAdapter<>(BLUE_NBT, TileState.class));
} }
private static final int CACHE_SIZE = 4; private static final int CACHE_SIZE = 4;

View File

@ -24,12 +24,9 @@
*/ */
package de.bluecolored.bluemap.core.map.renderstate; package de.bluecolored.bluemap.core.map.renderstate;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.util.Key; import de.bluecolored.bluemap.core.util.Key;
import de.bluecolored.bluemap.core.util.RegistryAdapter; import de.bluecolored.bluemap.core.util.RegistryAdapter;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.*;
import de.bluecolored.bluenbt.NBTName;
import de.bluecolored.bluenbt.NBTPostDeserialize;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
@ -132,7 +129,7 @@ private static class PaletteOnly {
private final static BlueNBT BLUE_NBT = new BlueNBT(); private final static BlueNBT BLUE_NBT = new BlueNBT();
static { static {
BLUE_NBT.register(TypeToken.get(TileState.class), new RegistryAdapter<>(TileState.REGISTRY, Key.BLUEMAP_NAMESPACE, TileState.UNKNOWN)); BLUE_NBT.register(TypeToken.of(TileState.class), new RegistryAdapter<>(TileState.REGISTRY, Key.BLUEMAP_NAMESPACE, TileState.UNKNOWN));
} }
@NBTName("tile-states") @NBTName("tile-states")

View File

@ -24,11 +24,7 @@
*/ */
package de.bluecolored.bluemap.core.util; package de.bluecolored.bluemap.core.util;
import com.google.gson.reflect.TypeToken; import de.bluecolored.bluenbt.*;
import de.bluecolored.bluenbt.BlueNBT;
import de.bluecolored.bluenbt.NBTReader;
import de.bluecolored.bluenbt.NBTWriter;
import de.bluecolored.bluenbt.TypeAdapter;
import de.bluecolored.bluenbt.adapter.ArrayAdapterFactory; import de.bluecolored.bluenbt.adapter.ArrayAdapterFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -45,7 +41,7 @@ public class PalettedArrayAdapter<T> implements TypeAdapter<T[]> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public PalettedArrayAdapter(BlueNBT blueNBT, Class<T> type) { public PalettedArrayAdapter(BlueNBT blueNBT, Class<T> type) {
this.type = type; this.type = type;
this.paletteAdapter = ArrayAdapterFactory.INSTANCE.create((TypeToken<T[]>) TypeToken.getArray(type), blueNBT).orElseThrow(); this.paletteAdapter = ArrayAdapterFactory.INSTANCE.create((TypeToken<T[]>) TypeToken.array(type), blueNBT).orElseThrow();
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -24,12 +24,8 @@
*/ */
package de.bluecolored.bluemap.core.world.block.entity; package de.bluecolored.bluemap.core.world.block.entity;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.util.Key; import de.bluecolored.bluemap.core.util.Key;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.*;
import de.bluecolored.bluenbt.NBTDeserializer;
import de.bluecolored.bluenbt.NBTReader;
import de.bluecolored.bluenbt.TypeDeserializer;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -65,7 +61,7 @@ public static class BlockEntityDeserializer implements TypeDeserializer<BlockEnt
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public @Nullable BlockEntity read(NBTReader reader) throws IOException { public @Nullable BlockEntity read(NBTReader reader) throws IOException {
Map<String, Object> raw = (Map<String, Object>) blueNBT.read(reader, TypeToken.getParameterized(Map.class, String.class, Object.class)); Map<String, Object> raw = (Map<String, Object>) blueNBT.read(reader, TypeToken.of(Map.class, String.class, Object.class));
String id = (String) raw.get("id"); String id = (String) raw.get("id");
if (id == null) return null; if (id == null) return null;

View File

@ -24,13 +24,14 @@
*/ */
package de.bluecolored.bluemap.core.world.mca; package de.bluecolored.bluemap.core.world.mca;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.util.Key; import de.bluecolored.bluemap.core.util.Key;
import de.bluecolored.bluemap.core.world.BlockState; import de.bluecolored.bluemap.core.world.BlockState;
import de.bluecolored.bluemap.core.world.block.entity.BlockEntity; import de.bluecolored.bluemap.core.world.block.entity.BlockEntity;
import de.bluecolored.bluemap.core.world.mca.data.BlockStateDeserializer; import de.bluecolored.bluemap.core.world.mca.data.BlockStateDeserializer;
import de.bluecolored.bluemap.core.world.mca.data.KeyDeserializer; import de.bluecolored.bluemap.core.world.mca.data.KeyDeserializer;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.BlueNBT;
import de.bluecolored.bluenbt.NamingStrategy;
import de.bluecolored.bluenbt.TypeToken;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
public class MCAUtil { public class MCAUtil {
@ -39,26 +40,13 @@ public class MCAUtil {
@Contract(value = "_ -> param1", mutates = "param1") @Contract(value = "_ -> param1", mutates = "param1")
public static BlueNBT addCommonNbtAdapters(BlueNBT nbt) { public static BlueNBT addCommonNbtAdapters(BlueNBT nbt) {
nbt.register(TypeToken.get(BlockState.class), new BlockStateDeserializer()); nbt.setNamingStrategy(NamingStrategy.lowerCaseWithDelimiter("_"));
nbt.register(TypeToken.get(Key.class), new KeyDeserializer()); nbt.register(TypeToken.of(BlockState.class), new BlockStateDeserializer());
nbt.register(TypeToken.get(BlockEntity.class), new BlockEntity.BlockEntityDeserializer(nbt)); nbt.register(TypeToken.of(Key.class), new KeyDeserializer());
nbt.register(TypeToken.of(BlockEntity.class), new BlockEntity.BlockEntityDeserializer(nbt));
return nbt; return nbt;
} }
/**
* Having a long array where each long contains as many values as fit in it without overflowing, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.
*/
public static long getValueFromLongArray(long[] data, int valueIndex, int bitsPerValue) {
int valuesPerLong = 64 / bitsPerValue;
int longIndex = valueIndex / valuesPerLong;
int bitIndex = (valueIndex % valuesPerLong) * bitsPerValue;
if (longIndex >= data.length) return 0;
long value = data[longIndex] >>> bitIndex;
return value & (0xFFFFFFFFFFFFFFFFL >>> -bitsPerValue);
}
/** /**
* Treating the long array "data" as a continuous stream of bits, returning the "valueIndex"-th value when each value has "bitsPerValue" bits. * Treating the long array "data" as a continuous stream of bits, returning the "valueIndex"-th value when each value has "bitsPerValue" bits.
*/ */

View File

@ -28,7 +28,6 @@
import com.flowpowered.math.vector.Vector3i; import com.flowpowered.math.vector.Vector3i;
import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache; import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.BlueMap; import de.bluecolored.bluemap.core.BlueMap;
import de.bluecolored.bluemap.core.logger.Logger; import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.resources.pack.datapack.DataPack; import de.bluecolored.bluemap.core.resources.pack.datapack.DataPack;
@ -43,6 +42,7 @@
import de.bluecolored.bluemap.core.world.mca.data.LevelData; import de.bluecolored.bluemap.core.world.mca.data.LevelData;
import de.bluecolored.bluemap.core.world.mca.region.RegionType; import de.bluecolored.bluemap.core.world.mca.region.RegionType;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.BlueNBT;
import de.bluecolored.bluenbt.TypeToken;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
@ -286,7 +286,7 @@ public static Path resolveDimensionFolder(Path worldFolder, Key dimension) {
private static BlueNBT createBlueNBTForDataPack(DataPack dataPack) { private static BlueNBT createBlueNBTForDataPack(DataPack dataPack) {
BlueNBT blueNBT = MCAUtil.addCommonNbtAdapters(new BlueNBT()); BlueNBT blueNBT = MCAUtil.addCommonNbtAdapters(new BlueNBT());
blueNBT.register(TypeToken.get(DimensionType.class), new DimensionTypeDeserializer(blueNBT, dataPack)); blueNBT.register(TypeToken.of(DimensionType.class), new DimensionTypeDeserializer(blueNBT, dataPack));
return blueNBT; return blueNBT;
} }

View File

@ -292,38 +292,68 @@ public int getSectionY() {
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class Data extends MCAChunk.Data { public static class Data extends MCAChunk.Data {
@NBTName("Level")
private Level level = new Level(); private Level level = new Level();
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class Level { public static class Level {
@NBTName("Status")
private Key status = STATUS_EMPTY; private Key status = STATUS_EMPTY;
@NBTName("InhabitedTime")
private long inhabitedTime = 0; private long inhabitedTime = 0;
@NBTName("Heightmaps")
private HeightmapsData heightmaps = new HeightmapsData(); private HeightmapsData heightmaps = new HeightmapsData();
@NBTName("Sections")
private SectionData @Nullable [] sections = null; private SectionData @Nullable [] sections = null;
@NBTName("Biomes")
private int[] biomes = EMPTY_INT_ARRAY; private int[] biomes = EMPTY_INT_ARRAY;
@NBTName("TileEntities") @NBTName("TileEntities")
@NBTDeserializer(LenientBlockEntityArrayDeserializer.class) @NBTDeserializer(LenientBlockEntityArrayDeserializer.class)
private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY; private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class HeightmapsData { public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY; @NBTName("WORLD_SURFACE")
private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR")
private long[] oceanFloor = EMPTY_LONG_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class SectionData { public static class SectionData {
@NBTName("Y")
private int y = 0; private int y = 0;
@NBTName("BlockLight")
private byte[] blockLight = EMPTY_BYTE_ARRAY; private byte[] blockLight = EMPTY_BYTE_ARRAY;
@NBTName("SkyLight")
private byte[] skyLight = EMPTY_BYTE_ARRAY; private byte[] skyLight = EMPTY_BYTE_ARRAY;
@NBTName("Palette")
private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY; private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY;
@NBTName("BlockStates")
private long[] blockStates = EMPTY_LONG_ARRAY; private long[] blockStates = EMPTY_LONG_ARRAY;
} }
} }

View File

@ -279,38 +279,68 @@ public int getSectionY() {
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class Data extends MCAChunk.Data { public static class Data extends MCAChunk.Data {
@NBTName("Level")
private Level level = new Level(); private Level level = new Level();
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class Level { public static class Level {
@NBTName("Status")
private Key status = STATUS_EMPTY; private Key status = STATUS_EMPTY;
@NBTName("InhabitedTime")
private long inhabitedTime = 0; private long inhabitedTime = 0;
@NBTName("Heightmaps")
private HeightmapsData heightmaps = new HeightmapsData(); private HeightmapsData heightmaps = new HeightmapsData();
@NBTName("Sections")
private SectionData @Nullable [] sections = null; private SectionData @Nullable [] sections = null;
@NBTName("Biomes")
private int[] biomes = EMPTY_INT_ARRAY; private int[] biomes = EMPTY_INT_ARRAY;
@NBTName("TileEntities") @NBTName("TileEntities")
@NBTDeserializer(LenientBlockEntityArrayDeserializer.class) @NBTDeserializer(LenientBlockEntityArrayDeserializer.class)
private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY; private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class HeightmapsData { public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY; @NBTName("WORLD_SURFACE")
private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR")
private long[] oceanFloor = EMPTY_LONG_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class SectionData { public static class SectionData {
@NBTName("Y")
private int y = 0; private int y = 0;
@NBTName("BlockLight")
private byte[] blockLight = EMPTY_BYTE_ARRAY; private byte[] blockLight = EMPTY_BYTE_ARRAY;
@NBTName("SkyLight")
private byte[] skyLight = EMPTY_BYTE_ARRAY; private byte[] skyLight = EMPTY_BYTE_ARRAY;
@NBTName("Palette")
private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY; private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY;
@NBTName("BlockStates")
private long[] blockStates = EMPTY_LONG_ARRAY; private long[] blockStates = EMPTY_LONG_ARRAY;
} }
} }

View File

@ -294,45 +294,72 @@ public int getSectionY() {
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class Data extends MCAChunk.Data { public static class Data extends MCAChunk.Data {
@NBTName("Status")
private Key status = STATUS_EMPTY; private Key status = STATUS_EMPTY;
@NBTName("InhabitedTime")
private long inhabitedTime = 0; private long inhabitedTime = 0;
@NBTName("Heightmaps")
private HeightmapsData heightmaps = new HeightmapsData(); private HeightmapsData heightmaps = new HeightmapsData();
private SectionData @Nullable [] sections = null; private SectionData @Nullable [] sections = null;
@NBTName("block_entities")
@NBTDeserializer(LenientBlockEntityArrayDeserializer.class) @NBTDeserializer(LenientBlockEntityArrayDeserializer.class)
private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY; private @Nullable BlockEntity [] blockEntities = EMPTY_BLOCK_ENTITIES_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class HeightmapsData { public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY; @NBTName("WORLD_SURFACE")
private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR")
private long[] oceanFloor = EMPTY_LONG_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class SectionData { public static class SectionData {
@NBTName("Y")
private int y = 0; private int y = 0;
@NBTName("BlockLight")
private byte[] blockLight = EMPTY_BYTE_ARRAY; private byte[] blockLight = EMPTY_BYTE_ARRAY;
@NBTName("SkyLight")
private byte[] skyLight = EMPTY_BYTE_ARRAY; private byte[] skyLight = EMPTY_BYTE_ARRAY;
@NBTName("block_states") private BlockStatesData blockStates = new BlockStatesData();
private BlockStatesData blockStates = new BlockStatesData();
private BiomesData biomes = new BiomesData(); private BiomesData biomes = new BiomesData();
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class BlockStatesData { public static class BlockStatesData {
private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY; private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY;
private long[] data = EMPTY_LONG_ARRAY; private long[] data = EMPTY_LONG_ARRAY;
} }
@Getter @Getter
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public static class BiomesData { public static class BiomesData {
private Key[] palette = EMPTY_KEY_ARRAY; private Key[] palette = EMPTY_KEY_ARRAY;
private long[] data = EMPTY_LONG_ARRAY; private long[] data = EMPTY_LONG_ARRAY;
} }
} }

View File

@ -29,6 +29,7 @@
import de.bluecolored.bluemap.core.world.Chunk; import de.bluecolored.bluemap.core.world.Chunk;
import de.bluecolored.bluemap.core.world.block.entity.BlockEntity; import de.bluecolored.bluemap.core.world.block.entity.BlockEntity;
import de.bluecolored.bluemap.core.world.mca.MCAWorld; import de.bluecolored.bluemap.core.world.mca.MCAWorld;
import de.bluecolored.bluenbt.NBTName;
import lombok.Getter; import lombok.Getter;
import lombok.ToString; import lombok.ToString;
@ -58,7 +59,10 @@ public MCAChunk(MCAWorld world, Data chunkData) {
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
@Getter @Getter
public static class Data { public static class Data {
@NBTName("DataVersion")
private int dataVersion = 0; private int dataVersion = 0;
} }
} }

View File

@ -24,16 +24,12 @@
*/ */
package de.bluecolored.bluemap.core.world.mca.data; package de.bluecolored.bluemap.core.world.mca.data;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.logger.Logger; import de.bluecolored.bluemap.core.logger.Logger;
import de.bluecolored.bluemap.core.resources.pack.datapack.DataPack; import de.bluecolored.bluemap.core.resources.pack.datapack.DataPack;
import de.bluecolored.bluemap.core.resources.pack.datapack.dimension.DimensionTypeData; import de.bluecolored.bluemap.core.resources.pack.datapack.dimension.DimensionTypeData;
import de.bluecolored.bluemap.core.util.Key; import de.bluecolored.bluemap.core.util.Key;
import de.bluecolored.bluemap.core.world.DimensionType; import de.bluecolored.bluemap.core.world.DimensionType;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.*;
import de.bluecolored.bluenbt.NBTReader;
import de.bluecolored.bluenbt.TagType;
import de.bluecolored.bluenbt.TypeDeserializer;
import java.io.IOException; import java.io.IOException;
@ -43,7 +39,7 @@ public class DimensionTypeDeserializer implements TypeDeserializer<DimensionType
private final DataPack dataPack; private final DataPack dataPack;
public DimensionTypeDeserializer(BlueNBT blueNBT, DataPack dataPack) { public DimensionTypeDeserializer(BlueNBT blueNBT, DataPack dataPack) {
this.defaultTypeDeserializer = blueNBT.getTypeDeserializer(TypeToken.get(DimensionTypeData.class)); this.defaultTypeDeserializer = blueNBT.getTypeDeserializer(TypeToken.of(DimensionTypeData.class));
this.dataPack = dataPack; this.dataPack = dataPack;
} }

View File

@ -24,12 +24,8 @@
*/ */
package de.bluecolored.bluemap.core.world.mca.data; package de.bluecolored.bluemap.core.world.mca.data;
import com.google.gson.reflect.TypeToken;
import de.bluecolored.bluemap.core.world.block.entity.BlockEntity; import de.bluecolored.bluemap.core.world.block.entity.BlockEntity;
import de.bluecolored.bluenbt.BlueNBT; import de.bluecolored.bluenbt.*;
import de.bluecolored.bluenbt.NBTReader;
import de.bluecolored.bluenbt.TagType;
import de.bluecolored.bluenbt.TypeDeserializer;
import java.io.IOException; import java.io.IOException;

View File

@ -25,6 +25,7 @@
package de.bluecolored.bluemap.core.world.mca.data; package de.bluecolored.bluemap.core.world.mca.data;
import de.bluecolored.bluemap.core.world.DimensionType; import de.bluecolored.bluemap.core.world.DimensionType;
import de.bluecolored.bluenbt.NBTName;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -36,13 +37,27 @@
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
public class LevelData { public class LevelData {
@NBTName("Data")
private Data data = new Data(); private Data data = new Data();
@Getter @Getter
public static class Data { public static class Data {
@NBTName("LevelName")
private String levelName = "world"; private String levelName = "world";
private int spawnX = 0, spawnY = 0, spawnZ = 0;
@NBTName("SpawnX")
private int spawnX = 0;
@NBTName("SpawnY")
private int spawnY = 0;
@NBTName("SpawnZ")
private int spawnZ = 0;
@NBTName("WorldGenSettings")
private WGSettings worldGenSettings = new WGSettings(); private WGSettings worldGenSettings = new WGSettings();
} }
@Getter @Getter

View File

@ -6,7 +6,7 @@ spongegradle = "2.2.0"
[libraries] [libraries]
aircompressor = { module = "io.airlift:aircompressor", version = "0.24" } aircompressor = { module = "io.airlift:aircompressor", version = "0.24" }
bluenbt = { module = "de.bluecolored.bluenbt:BlueNBT", version = "2.3.0" } bluenbt = { module = "de.bluecolored.bluenbt:BlueNBT", version = "3.0.1" }
brigadier = { module = "com.mojang:brigadier", version = "1.0.17" } brigadier = { module = "com.mojang:brigadier", version = "1.0.17" }
bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" } bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" }
bstats-sponge = { module = "org.bstats:bstats-sponge", version.ref = "bstats" } bstats-sponge = { module = "org.bstats:bstats-sponge", version.ref = "bstats" }