def _loadPalette(self, data): palletLen, data = struct.unpack("<I", data[:4])[0], data[4:] dr = nbt.DataReader(data) palette = [] for _ in range(palletLen): palette.append(nbt.decode(dr)) return palette, data[dr.idx:]
def _loadEntities(self, db): try: data = ldb.get(db, self.keyBase + b"2") except KeyError: return [] data = nbt.DataReader(data) entities = [] while not data.finished(): entities.append(nbt.decode(data)) return entities
def _loadTileEntities(self, db): try: data = ldb.get(db, self.keyBase + b"1") except KeyError: return data = nbt.DataReader(data) while not data.finished(): nbtData = nbt.decode(data) x = nbtData.pop("x").payload # We add back theses with the correct value on save, they are important. y = nbtData.pop("y").payload z = nbtData.pop("z").payload self.getBlock(x % 16, y, z % 16).nbt = nbtData