コード例 #1
0
ファイル: anvil_test.py プロジェクト: shipbiulder101/mcedit2
def testBigEndianIntHeightMap():
    """ Test modifying, saving, and loading the new TAG_Int_Array heightmap
    added with the Anvil format.
    """
    region = RegionFile(TempFile("AnvilWorld/region/r.0.0.mca"))
    chunk_data = region.readChunkBytes(0, 0)
    chunk = nbt.load(buf=chunk_data)

    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()
コード例 #2
0
ファイル: anvil_test.py プロジェクト: nkjcqvcpi/mcedit2
def testBigEndianIntHeightMap():
    """ Test modifying, saving, and loading the new TAG_Int_Array heightmap
    added with the Anvil format.
    """
    region = RegionFile(TempFile("AnvilWorld/region/r.0.0.mca"))
    chunk_data = region.readChunkBytes(0, 0)
    chunk = nbt.load(buf=chunk_data)

    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()
コード例 #3
0
def testBigEndianIntHeightMap(tmpdir, temp_file):
    """ Test modifying, saving, and loading the new TAG_Int_Array heightmap
    added with the Anvil format.
    """
    region = RegionFile(temp_file.strpath)
    chunk_data = region.readChunkBytes(0, 0)
    chunk = nbt.load(buf=chunk_data)

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

    filename = tmpdir.join("ChangedChunk").strpath
    chunk.save(filename)
    changedChunk = nbt.load(filename)
    os.unlink(filename)

    eq = (changedChunk["Level"]["HeightMap"].value == oldhm)
    assert eq.all()
コード例 #4
0
ファイル: anvil_test.py プロジェクト: KevinKelley/mcedit2
def testBigEndianIntHeightMap(tmpdir, temp_file):
    """ Test modifying, saving, and loading the new TAG_Int_Array heightmap
    added with the Anvil format.
    """
    region = RegionFile(temp_file.strpath)
    chunk_data = region.readChunkBytes(0, 0)
    chunk = nbt.load(buf=chunk_data)

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

    filename = tmpdir.join("ChangedChunk").strpath
    chunk.save(filename)
    changedChunk = nbt.load(filename)
    os.unlink(filename)

    eq = (changedChunk["Level"]["HeightMap"].value == oldhm)
    assert eq.all()
コード例 #5
0
ファイル: worldfolder.py プロジェクト: metehanboy/mcedit2
    def getRegionFile(self, rx, rz, dimName):
        """

        :type rx: int or dtype
        :type rz: int or dtype
        :type dimName: unicode or str
        :return:
        :rtype: RegionFile
        """
        regionFile = self.regionFiles.get((rx, rz, dimName))
        if regionFile:
            return regionFile
        path = self.getRegionFilename(rx, rz, dimName)
        if not os.path.exists(path):
            self._dimensionNames.add(dimName)
            self._regionPositionsByDim[dimName].add((rx, rz))
        regionFile = RegionFile(path)
        self.regionFiles[rx, rz, dimName] = regionFile
        return regionFile
コード例 #6
0
ファイル: worldfolder.py プロジェクト: wcpe/mcedit2
    def getRegionFile(self, rx, rz, dimName):
        """

        :type rx: int or dtype
        :type rz: int or dtype
        :type dimName: unicode or str
        :return:
        :rtype: RegionFile
        """
        regionFile = self.regionFiles.get((rx, rz, dimName))
        if regionFile:
            return regionFile
        path = self.getRegionFilename(rx, rz, dimName)
        if not os.path.exists(path):
            self._dimensionNames.add(dimName)
            self._regionPositionsByDim[dimName].add((rx, rz))
        try:
            regionFile = RegionFile(path, self.readonly)
        except Exception:
            log.exception("Failed to open region file.")
            return None
        self.regionFiles[rx, rz, dimName] = regionFile
        return regionFile