#pragma once #include #include "ZonedChunkStorage.h" #include "nbt/CompoundTag.h" #include "nbt/NbtIo.h" class NbtSlotFile { private: static std::vector READ_BUFFER; static const int FILE_HEADER_SIZE = 1024; static const int MAGIC_NUMBER = 0x13737001; static const int FILE_SLOT_HEADER_SIZE = 12; static const int FILE_SLOT_SIZE = 500; std::FILE* raf; std::vector** fileSlotMap; int fileSlotMapLength; std::vector freeFileSlots; int totalFileSlots; static int64_t largest; public: NbtSlotFile(File file); private: void readHeader(); void writeHeader(); void seekSlotHeader(int fileSlot); void seekSlot(int fileSlot); public: std::vector* readAll(int slot); private: std::vector* toReplace; int getFreeSlot(); public: void replaceSlot(int slot, std::vector* tags); void close(); };