• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python nbt.load函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nbt.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: findTrueSpawn

    def findTrueSpawn(self):
        """Adds the true spawn location to self.POI.  The spawn Y coordinate
        is almost always the default of 64.  Find the first air block above
        that point for the true spawn location"""

        ## read spawn info from level.dat
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]
        spawnX = data["Data"]["SpawnX"]
        spawnY = data["Data"]["SpawnY"]
        spawnZ = data["Data"]["SpawnZ"]

        ## The chunk that holds the spawn location
        chunkX = spawnX / 16
        chunkY = spawnZ / 16

        ## The filename of this chunk
        chunkFile = os.path.join(
            base36encode(chunkX % 64),
            base36encode(chunkY % 64),
            "c.%s.%s.dat" % (base36encode(chunkX), base36encode(chunkY)),
        )

        data = nbt.load(os.path.join(self.worlddir, chunkFile))[1]
        level = data["Level"]
        blockArray = numpy.frombuffer(level["Blocks"], dtype=numpy.uint8).reshape((16, 16, 128))

        ## The block for spawn *within* the chunk
        inChunkX = spawnX - (chunkX * 16)
        inChunkZ = spawnZ - (chunkY * 16)

        ## find the first air block
        while blockArray[inChunkX, inChunkZ, spawnY] != 0:
            spawnY += 1

        self.POI.append(dict(x=spawnX, y=spawnY, z=spawnZ, msg="Spawn"))
开发者ID:pilif,项目名称:Minecraft-Overviewer,代码行数:35,代码来源:world.py


示例2: findTrueSpawn

    def findTrueSpawn(self):
        """Adds the true spawn location to self.POI.  The spawn Y coordinate
        is almost always the default of 64.  Find the first air block above
        that point for the true spawn location"""

        ## read spawn info from level.dat
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]
        spawnX = data['Data']['SpawnX']
        spawnY = data['Data']['SpawnY']
        spawnZ = data['Data']['SpawnZ']
   
        ## The chunk that holds the spawn location 
        chunkX = spawnX/16
        chunkY = spawnZ/16

        ## The filename of this chunk
        chunkFile = self.get_chunk_path(chunkX, chunkY)

        data=nbt.load(chunkFile)[1]
        level = data['Level']
        blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128))

        ## The block for spawn *within* the chunk
        inChunkX = spawnX - (chunkX*16)
        inChunkZ = spawnZ - (chunkY*16)

        ## find the first air block
        while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
            spawnY += 1


        self.POI.append( dict(x=spawnX, y=spawnY, z=spawnZ, 
                msg="Spawn", type="spawn", chunk=(inChunkX,inChunkZ)))
开发者ID:rmccue,项目名称:Minecraft-Overviewer,代码行数:33,代码来源:world.py


示例3: __init__

    def __init__(self, shape=None, root_tag=None, filename=None, mats="Alpha"):
        """ shape is (x,y,z) for a new level's shape.  if none, takes
        root_tag as a TAG_Compound for an existing schematic file.  if
        none, tries to read the tag from filename.  if none, results
        are undefined. materials can be a MCMaterials instance, or one of
        "Classic", "Alpha", "Pocket" to indicate allowable blocks. The default
        is Alpha.

        block coordinate order in the file is y,z,x to use the same code as classic/indev levels.
        in hindsight, this was a completely arbitrary decision.

        the Entities and TileEntities are nbt.TAG_List objects containing TAG_Compounds.
        this makes it easy to copy entities without knowing about their insides.

        rotateLeft swaps the axes of the different arrays.  because of this, the Width, Height, and Length
        reflect the current dimensions of the schematic rather than the ones specified in the NBT structure.
        I'm not sure what happens when I try to re-save a rotated schematic.
        """

        # if(shape != None):
        #    self.setShape(shape)

        if filename:
            self.filename = filename
            if None is root_tag and os.path.exists(filename):
                root_tag = nbt.load(filename)
        else:
            self.filename = None

        if mats in namedMaterials:
            self.materials = namedMaterials[mats]
        else:
            assert isinstance(mats, MCMaterials)
            self.materials = mats

        if root_tag:
            self.root_tag = root_tag
            if Materials in root_tag:
                self.materials = namedMaterials[self.Materials]
            else:
                root_tag[Materials] = nbt.TAG_String(self.materials.name)
            self.shapeChunkData()

        else:
            assert shape != None
            root_tag = nbt.TAG_Compound(name="Schematic")
            root_tag[Height] = nbt.TAG_Short(shape[1])
            root_tag[Length] = nbt.TAG_Short(shape[2])
            root_tag[Width] = nbt.TAG_Short(shape[0])

            root_tag[Entities] = nbt.TAG_List()
            root_tag[TileEntities] = nbt.TAG_List()
            root_tag["Materials"] = nbt.TAG_String(self.materials.name)

            root_tag[Blocks] = nbt.TAG_Byte_Array(zeros((shape[1], shape[2], shape[0]), uint8))
            root_tag[Data] = nbt.TAG_Byte_Array(zeros((shape[1], shape[2], shape[0]), uint8))

            self.root_tag = root_tag

        self.dataIsPacked = True
开发者ID:nickodell,项目名称:pymclevel,代码行数:60,代码来源:schematic.py


示例4: get_worlds

def get_worlds():
    "Returns {world # or name : level.dat information}"
    ret = {}
    save_dir = get_save_dir()

    # No dirs found - most likely not running from inside minecraft-dir
    if save_dir is None:
        return None

    for dir in os.listdir(save_dir):
        world_dat = os.path.join(save_dir, dir, "level.dat")
        if not os.path.exists(world_dat):
            continue
        info = nbt.load(world_dat)[1]
        info["Data"]["path"] = os.path.join(save_dir, dir)
        if dir.startswith("World") and len(dir) == 6:
            try:
                world_n = int(dir[-1])
                ret[world_n] = info["Data"]
            except ValueError:
                pass
        if "LevelName" in info["Data"].keys():
            ret[info["Data"]["LevelName"]] = info["Data"]

    return ret
开发者ID:acastle,项目名称:Minecraft-Overviewer,代码行数:25,代码来源:world.py


示例5: findTrueSpawn

    def findTrueSpawn(self):
        """Adds the true spawn location to self.POI.  The spawn Y coordinate
        is almost always the default of 64.  Find the first air block above
        that point for the true spawn location"""

        ## read spawn info from level.dat
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]
        spawnX = data["Data"]["SpawnX"]
        spawnY = data["Data"]["SpawnY"]
        spawnZ = data["Data"]["SpawnZ"]

        ## The chunk that holds the spawn location
        chunkX = spawnX / 16
        chunkY = spawnZ / 16

        ## The filename of this chunk
        chunkFile = self.get_region_path(chunkX, chunkY)

        data = nbt.load_from_region(chunkFile, chunkX, chunkY)[1]
        level = data["Level"]
        blockArray = numpy.frombuffer(level["Blocks"], dtype=numpy.uint8).reshape((16, 16, 128))

        ## The block for spawn *within* the chunk
        inChunkX = spawnX - (chunkX * 16)
        inChunkZ = spawnZ - (chunkY * 16)

        ## find the first air block
        while blockArray[inChunkX, inChunkZ, spawnY] != 0:
            spawnY += 1
            if spawnY == 128:
                break

        self.POI.append(dict(x=spawnX, y=spawnY, z=spawnZ, msg="Spawn", type="spawn", chunk=(inChunkX, inChunkZ)))
        self.spawn = (spawnX, spawnY, spawnZ)
开发者ID:Aurecanabis,项目名称:Minecraft-Overviewer,代码行数:34,代码来源:world.py


示例6: testErrors

    def testErrors(self):
        """
        attempt to name elements of a TAG_List
        named list elements are not allowed by the NBT spec,
        so we must discard any names when writing a list.
        """

        level = self.testCreate()
        level["Map"]["Spawn"][0].name = "Torg Potter"
        data = level.save()
        newlevel = nbt.load(buf=data)

        n = newlevel["Map"]["Spawn"][0].name
        if n:
            print "Named list element failed: %s" % n

        # attempt to delete non-existent TAG_Compound elements
        # this generates a KeyError like a python dict does.
        level = self.testCreate()
        try:
            del level["DEADBEEF"]
        except KeyError:
            pass
        else:
            assert False
开发者ID:Aftershock1133,项目名称:minecraft.print,代码行数:25,代码来源:nbt_test.py


示例7: saveGeneratedChunk

    def saveGeneratedChunk(self, cx, cz, tempChunkBytes):
        """
        Chunks get generated using Anvil generation. This is a (slow) way of importing anvil chunk bytes
        and converting them to MCPE chunk data. Could definitely use some improvements, but at least it works.
        :param cx, cx: Coordinates of the chunk
        :param tempChunkBytes: str. Raw MCRegion chunk data.
        :return:
        """
        loaded_data = nbt.load(buf=tempChunkBytes)

        class fake:
            def __init__(self):
                self.Height = 128

        tempChunk = AnvilChunkData(fake(), (0, 0), loaded_data)

        if not self.containsChunk(cx, cz):
            self.createChunk(cx, cz)
            chunk = self.getChunk(cx, cz)
            chunk.Blocks = numpy.array(tempChunk.Blocks, dtype='uint16')
            chunk.Data = numpy.array(tempChunk.Data, dtype='uint8')
            chunk.SkyLight = numpy.array(tempChunk.SkyLight, dtype='uint8')
            chunk.BlockLight = numpy.array(tempChunk.BlockLight, dtype='uint8')

            chunk.dirty = True
            self.worldFile.saveChunk(chunk)
        else:
            logger.info("Tried to import generated chunk at %s, %s but the chunk already existed." % cx, cz)
开发者ID:gwpantazes,项目名称:MCEdit-Unified,代码行数:28,代码来源:leveldbpocket.py


示例8: __init__

    def __init__(self, filename, create=False):
        self.zipfilename = filename

        tempdir = tempfile.mktemp("schematic")
        if create is False:
            zf = zipfile.ZipFile(filename)
            zf.extractall(tempdir)
            zf.close()

        super(ZipSchematic, self).__init__(tempdir, create)
        atexit.register(shutil.rmtree, self.worldFolder.filename, True)

        try:
            schematicDat = nbt.load(self.worldFolder.getFilePath("schematic.dat"))

            self.Width = schematicDat['Width'].value
            self.Height = schematicDat['Height'].value
            self.Length = schematicDat['Length'].value

            if "Materials" in schematicDat:
                self.materials = namedMaterials[schematicDat["Materials"].value]

        except Exception, e:
            print "Exception reading schematic.dat, skipping: {0!r}".format(e)
            self.Width = 0
            self.Length = 0
开发者ID:Aiybe,项目名称:MCEdit-Unified,代码行数:26,代码来源:schematic.py


示例9: testBigEndianIntHeightMap

    def testBigEndianIntHeightMap(self):
        """ Test modifying, saving, and loading the new TAG_Int_Array heightmap
        added with the Anvil format.
        """
        chunk = nbt.load("testfiles/AnvilChunk.dat")

        hm = chunk["Level"]["HeightMap"]
        hm.value[2] = 500
        oldhm = numpy.array(hm.value)

        filename = mktemp("ChangedChunk")
        chunk.save(filename)
        changedChunk = nbt.load(filename)
        os.unlink(filename)

        eq = (changedChunk["Level"]["HeightMap"].value == oldhm)
        assert eq.all()
开发者ID:Aftershock1133,项目名称:minecraft.print,代码行数:17,代码来源:anvil_test.py


示例10: testSpeed

 def testSpeed(self):
     d = join("testfiles", "TileTicks_chunks")
     files = [join(d, f) for f in os.listdir(d)]
     startTime = time.time()
     for i in range(20):
         for f in files[:40]:
             n = nbt.load(f)
     print "Duration: ", time.time() - startTime
开发者ID:dcoshea,项目名称:pymclevel,代码行数:8,代码来源:tests.py


示例11: repair

    def repair(self):
        lostAndFound = {}
        _freeSectors = [True] * len(self.freeSectors)
        _freeSectors[0] = _freeSectors[1] = False
        deleted = 0
        recovered = 0
        log.info("Beginning repairs on {file} ({chunks} chunks)".format(file=os.path.basename(self.path), chunks=sum(self.offsets > 0)))
        rx, rz = self.regionCoords
        for index, offset in enumerate(self.offsets):
            if offset:
                cx = index & 0x1f
                cz = index >> 5
                cx += rx << 5
                cz += rz << 5
                sectorStart = offset >> 8
                sectorCount = offset & 0xff
                try:

                    if sectorStart + sectorCount > len(self.freeSectors):
                        raise RegionMalformed("Offset {start}:{end} ({offset}) at index {index} pointed outside of the file".format(
                            start=sectorStart, end=sectorStart + sectorCount, index=index, offset=offset))

                    data = self.readChunk(cx, cz)
                    if data is None:
                        raise RegionMalformed("Failed to read chunk data for {0}".format((cx, cz)))

                    chunkTag = nbt.load(buf=data)
                    lev = chunkTag["Level"]
                    xPos = lev["xPos"].value
                    zPos = lev["zPos"].value
                    overlaps = False

                    for i in range(sectorStart, sectorStart + sectorCount):
                        if _freeSectors[i] is False:
                            overlaps = True
                        _freeSectors[i] = False

                    if xPos != cx or zPos != cz or overlaps:
                        lostAndFound[xPos, zPos] = data

                        if (xPos, zPos) != (cx, cz):
                            raise RegionMalformed("Chunk {found} was found in the slot reserved for {expected}".format(found=(xPos, zPos), expected=(cx, cz)))
                        else:
                            raise RegionMalformed("Chunk {found} (in slot {expected}) has overlapping sectors with another chunk!".format(found=(xPos, zPos), expected=(cx, cz)))

                except Exception as e:
                    log.info("Unexpected chunk data at sector {sector} ({exc})".format(sector=sectorStart, exc=e))
                    self.setOffset(cx, cz, 0)
                    deleted += 1

        for cPos, foundData in lostAndFound.items():
            cx, cz = cPos
            if self.getOffset(cx, cz) == 0:
                log.info("Found chunk {found} and its slot is empty, recovering it".format(found=cPos))
                self.saveChunk(cx, cz, foundData)
                recovered += 1

        log.info("Repair complete. Removed {0} chunks, recovered {1} chunks, net {2}".format(deleted, recovered, recovered - deleted))
开发者ID:gargan26,项目名称:py3mclevel,代码行数:58,代码来源:regionfile.py


示例12: testSpeed

    def testSpeed(self):
        d = join("testfiles", "TileTicks_chunks")
        files = [join(d, f) for f in os.listdir(d)]
        startTime = time.time()
        for f in files[:40]:
            n = nbt.load(f)
        duration = time.time() - startTime

        assert duration < 1.0 # Will fail when not using _nbt.pyx
开发者ID:Aftershock1133,项目名称:minecraft.print,代码行数:9,代码来源:nbt_test.py


示例13: _loadLevelDat

 def _loadLevelDat(filename):
     root_tag_buf = open(filename, 'rb').read()
     magic, length, root_tag_buf = root_tag_buf[:4], root_tag_buf[4:8], root_tag_buf[8:]
     if struct.Struct('<i').unpack(magic)[0] < 3:
         logger.info("Found an old level.dat file. Aborting world load")
         raise InvalidPocketLevelDBWorldException()  # Maybe try convert/load old PE world?
     if len(root_tag_buf) != struct.Struct('<i').unpack(length)[0]:
         raise nbt.NBTFormatError()
     self.root_tag = nbt.load(buf=root_tag_buf)
开发者ID:gwpantazes,项目名称:MCEdit-Unified,代码行数:9,代码来源:leveldbpocket.py


示例14: find_true_spawn

    def find_true_spawn(self):
        """Adds the true spawn location to self.POI.  The spawn Y coordinate
        is almost always the default of 64.  Find the first air block above
        that point for the true spawn location"""

        ## read spawn info from level.dat
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]
        disp_spawnX = spawnX = data['Data']['SpawnX']
        spawnY = data['Data']['SpawnY']
        disp_spawnZ = spawnZ = data['Data']['SpawnZ']
        if self.north_direction == 'upper-left':
            temp = spawnX
            spawnX = -spawnZ
            spawnZ = temp
        elif self.north_direction == 'upper-right':
            spawnX = -spawnX
            spawnZ = -spawnZ
        elif self.north_direction == 'lower-right':
            temp = spawnX
            spawnX = spawnZ
            spawnZ = -temp
   
        ## The chunk that holds the spawn location 
        chunkX = spawnX/16
        chunkY = spawnZ/16
        
        ## clamp spawnY to a sane value, in-chunk value
        if spawnY < 0:
            spawnY = 0
        if spawnY > 127:
            spawnY = 127
        
        try:
            ## The filename of this chunk
            chunkFile = self.get_region_path(chunkX, chunkY)
            if chunkFile is not None:
                data = nbt.load_from_region(chunkFile, chunkX, chunkY, self.north_direction)
                if data is not None:
                    level = data[1]['Level']
                    blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128))
                
                    ## The block for spawn *within* the chunk
                    inChunkX = spawnX - (chunkX*16)
                    inChunkZ = spawnZ - (chunkY*16)
                
                    ## find the first air block
                    while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
                        spawnY += 1
                        if spawnY == 128:
                            break
        except chunk.ChunkCorrupt:
            #ignore corrupt spawn, and continue
            pass
        self.POI.append( dict(x=disp_spawnX, y=spawnY, z=disp_spawnZ,
                msg="Spawn", type="spawn", chunk=(chunkX, chunkY)))
        self.spawn = (disp_spawnX, spawnY, disp_spawnZ)
开发者ID:Psykar,项目名称:Minecraft-Overviewer,代码行数:56,代码来源:world.py


示例15: addSpawn

    def addSpawn(self):
        """Adds the true spawn location to self.POI."""

        ## read spawn info from level.dat
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]
        spawnX = data["Data"]["SpawnX"]
        spawnY = data["Data"]["SpawnY"]
        spawnZ = data["Data"]["SpawnZ"]

        self.POI.append(dict(x=spawnX, y=spawnY, z=spawnZ, msg="Spawn", id=0))
开发者ID:mrsheen,项目名称:Minecraft-Overviewer-Mega,代码行数:10,代码来源:markers.py


示例16: setup

    def setup(self):
        if not self._scs:
            self.root_tag = nbt.load(self.level.worldFolder.getFolderPath("data")+"/scoreboard.dat")
            for objective in self.root_tag["data"]["Objectives"]:
                self.objectives.append(Objective(objective))

            for team in self.root_tag["data"]["Teams"]:
                self.teams.append(Team(team))
        else:
            self.root_tag = nbt.TAG_Compound()
            self.root_tag["data"] = nbt.TAG_Compound()
开发者ID:LaChal,项目名称:MCEdit-Unified,代码行数:11,代码来源:scoreboard.py


示例17: load

 def load(_data):
     sep = "\x00\x00\x00\x00\n"
     sep_data = _data.split(sep)
     compounds = []
     for d in sep_data:
         if len(d) != 0:
             if not d.startswith("\n"):
                 d = "\n" + d
             tag = (nbt.load(buf=(d + '\x00\x00\x00\x00')))
             compounds.append(tag)
     return compounds
开发者ID:gwpantazes,项目名称:MCEdit-Unified,代码行数:11,代码来源:leveldbpocket.py


示例18: findPlayerPosition

 def findPlayerPosition(self):
     """Load player positions from players folder for all players who haven't been inactive for over a week"""
     playerfolder=os.path.join(self.worlddir, "players")
     playerList=os.listdir(playerfolder)
     now = time.time()
     for playerFile in playerList:
         absPlayerFile =os.path.join(playerfolder, playerFile)
         if os.path.getmtime(absPlayerFile)+60*60*24*7 < now:
             continue
         data = nbt.load(absPlayerFile)[1]
         pos = data['Pos']
         self.POI.append( dict(x=pos[0], y=pos[1], z=pos[2], msg=playerFile[0:-4]))
开发者ID:arrai,项目名称:Minecraft-Overviewer,代码行数:12,代码来源:world.py


示例19: __init__

    def __init__(self, worlddir, cachedir, chunklist=None, lighting=False, night=False, spawn=False, useBiomeData=False):
        self.worlddir = worlddir
        self.caves = False
        self.lighting = lighting or night or spawn
        self.night = night or spawn
        self.spawn = spawn
        self.cachedir = cachedir
        self.useBiomeData = useBiomeData

        # figure out chunk format is in use
        # if mcregion, error out early until we can add support
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]['Data']
        #print data
        if not ('version' in data and data['version'] == 19132):
            logging.error("Sorry, This version of Minecraft-Overviewer only works with the new McRegion chunk format")
            sys.exit(1)

        if self.useBiomeData:
            textures.prepareBiomeData(worlddir)

        self.chunklist = chunklist

        # In order to avoid having to look up the cache file names in
        # ChunkRenderer, get them all and store them here
        # TODO change how caching works
        for root, dirnames, filenames in os.walk(cachedir):
            for filename in filenames:
                if not filename.endswith('.png') or not filename.startswith("img."):
                    continue
                dirname, dir_b = os.path.split(root)
                _, dir_a = os.path.split(dirname)
                _, x, z, cave, _ = filename.split('.', 4)
                dir = '/'.join((dir_a, dir_b))
                bits = '.'.join((x, z, cave))
                cached[dir][bits] = os.path.join(root, filename)

        #  stores Points Of Interest to be mapped with markers
        #  a list of dictionaries, see below for an example
        self.POI = []

        # if it exists, open overviewer.dat, and read in the data structure
        # info self.persistentData.  This dictionary can hold any information
        # that may be needed between runs.
        # Currently only holds into about POIs (more more details, see quadtree)
        self.pickleFile = os.path.join(self.cachedir,"overviewer.dat")
        if os.path.exists(self.pickleFile):
            with open(self.pickleFile,"rb") as p:
                self.persistentData = cPickle.load(p)
        else:
            # some defaults
            self.persistentData = dict(POI=[])
开发者ID:3kings,项目名称:Minecraft-Overviewer,代码行数:51,代码来源:world.py


示例20: __init__

    def __init__(self, worlddir, useBiomeData=False,regionlist=None):
        self.worlddir = worlddir
        self.useBiomeData = useBiomeData
                
        #find region files, or load the region list
        #this also caches all the region file header info
        logging.info("Scanning regions")
        regionfiles = {}
        self.regions = {}
        if regionlist:
            self.regionlist = map(os.path.abspath, regionlist) # a list of paths
        else:
            self.regionlist = None
        for x, y, regionfile in self._iterate_regionfiles():
            mcr = self.reload_region(regionfile) 
            mcr.get_chunk_info()
            regionfiles[(x,y)]	= (x,y,regionfile,mcr)
        self.regionfiles = regionfiles	
        # set the number of region file handles we will permit open at any time before we start closing them
#        self.regionlimit = 1000
        # the max number of chunks we will keep before removing them (includes emptry chunks)
        self.chunklimit = 1024 
        self.chunkcount = 0
        self.empty_chunk = [None,None]
        logging.debug("Done scanning regions")
        
        # figure out chunk format is in use
        # if not mcregion, error out early
        data = nbt.load(os.path.join(self.worlddir, "level.dat"))[1]['Data']
        #print data
        if not ('version' in data and data['version'] == 19132):
            logging.error("Sorry, This version of Minecraft-Overviewer only works with the new McRegion chunk format")
            sys.exit(1)

        #  stores Points Of Interest to be mapped with markers
        #  a list of dictionaries, see below for an example
        self.POI = []

        # if it exists, open overviewer.dat, and read in the data structure
        # info self.persistentData.  This dictionary can hold any information
        # that may be needed between runs.
        # Currently only holds into about POIs (more more details, see quadtree)
        # TODO maybe store this with the tiles, not with the world?
        self.pickleFile = os.path.join(self.worlddir, "overviewer.dat")
        if os.path.exists(self.pickleFile):
            with open(self.pickleFile,"rb") as p:
                self.persistentData = cPickle.load(p)
        else:
            # some defaults
            self.persistentData = dict(POI=[])
开发者ID:christo,项目名称:Minecraft-Overviewer,代码行数:50,代码来源:world.py



注:本文中的nbt.load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.ret_info函数代码示例发布时间:2022-05-27
下一篇:
Python utils.compute_checksum函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap