当前位置: 首页>>代码示例>>Python>>正文


Python NBTFile.name方法代码示例

本文整理汇总了Python中bravo.nbt.NBTFile.name方法的典型用法代码示例。如果您正苦于以下问题:Python NBTFile.name方法的具体用法?Python NBTFile.name怎么用?Python NBTFile.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bravo.nbt.NBTFile的用法示例。


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

示例1: save_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def save_to_tag(chunk):

        tag = NBTFile()
        tag.name = ""

        level = TAG_Compound()
        tag["Level"] = level

        level["Blocks"] = TAG_Byte_Array()
        level["HeightMap"] = TAG_Byte_Array()
        level["BlockLight"] = TAG_Byte_Array()
        level["Data"] = TAG_Byte_Array()
        level["SkyLight"] = TAG_Byte_Array()

        level["Blocks"].value = chunk.blocks.tostring()
        level["HeightMap"].value = chunk.heightmap.tostring()
        level["BlockLight"].value = pack_nibbles(chunk.blocklight)
        level["Data"].value = pack_nibbles(chunk.metadata)
        level["SkyLight"].value = pack_nibbles(chunk.skylight)

        level["TerrainPopulated"] = TAG_Byte(chunk.populated)

        level["TileEntities"] = TAG_List(type=TAG_Compound)
        for tile in chunk.tiles.itervalues():
            level["TileEntities"].tags.append(tile.save_to_tag())

        return tag
开发者ID:iamjagman,项目名称:bravo,代码行数:29,代码来源:alpha.py

示例2: _save_level_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_level_to_tag(self, level):
        tag = NBTFile()
        tag.name = ""

        tag["Data"] = TAG_Compound()
        tag["Data"]["RandomSeed"] = TAG_Long(level.seed)
        tag["Data"]["SpawnX"] = TAG_Int(level.spawn[0])
        tag["Data"]["SpawnY"] = TAG_Int(level.spawn[1])
        tag["Data"]["SpawnZ"] = TAG_Int(level.spawn[2])

        return tag
开发者ID:dequis,项目名称:bravo,代码行数:13,代码来源:serializers.py

示例3: _save_tile_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_tile_to_tag(self, tile):
        tag = NBTFile()
        tag.name = ""

        tag["id"] = TAG_String(tile.name)

        tag["x"] = TAG_Int(tile.x)
        tag["y"] = TAG_Int(tile.y)
        tag["z"] = TAG_Int(tile.z)

        self._tile_savers[tile.name](tile, tag)

        return tag
开发者ID:mmcgill,项目名称:bravo,代码行数:15,代码来源:beta.py

示例4: _save_chunk_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_chunk_to_tag(self, chunk):
        tag = NBTFile()
        tag.name = ""

        level = TAG_Compound()
        tag["Level"] = level

        level["xPos"] = TAG_Int(chunk.x)
        level["zPos"] = TAG_Int(chunk.z)

        level["HeightMap"] = TAG_Byte_Array()
        level["BlockLight"] = TAG_Byte_Array()
        level["SkyLight"] = TAG_Byte_Array()

        level["Sections"] = TAG_List(type=TAG_Compound)
        for i, s in enumerate(chunk.sections):
            if s:
                section = TAG_Compound()
                section.name = ""
                section["Y"] = TAG_Byte(i)
                section["Blocks"] = TAG_Byte_Array()
                section["Blocks"].value = s.blocks.tostring()
                section["Data"] = TAG_Byte_Array()
                section["Data"].value = pack_nibbles(s.metadata)
                section["SkyLight"] = TAG_Byte_Array()
                section["SkyLight"].value = pack_nibbles(s.skylight)
                level["Sections"].tags.append(section)

        level["HeightMap"].value = chunk.heightmap.tostring()
        level["BlockLight"].value = pack_nibbles(chunk.blocklight)

        level["TerrainPopulated"] = TAG_Byte(chunk.populated)

        level["Entities"] = TAG_List(type=TAG_Compound)
        for entity in chunk.entities:
            try:
                entitytag = self._save_entity_to_tag(entity)
                level["Entities"].tags.append(entitytag)
            except KeyError:
                log.msg("Unknown entity %s" % entity.name)

        level["TileEntities"] = TAG_List(type=TAG_Compound)
        for tile in chunk.tiles.itervalues():
            try:
                tiletag = self._save_tile_to_tag(tile)
                level["TileEntities"].tags.append(tiletag)
            except KeyError:
                log.msg("Unknown tile entity %s" % tile.name)

        return tag
开发者ID:MartysTardis,项目名称:bravo,代码行数:52,代码来源:beta.py

示例5: save_player

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def save_player(self, player):
        tag = NBTFile()
        tag.name = ""

        tag["Pos"] = TAG_List(type=TAG_Double)
        tag["Pos"].tags = [TAG_Double(i) for i in player.location.pos]

        tag["Rotation"] = TAG_List(type=TAG_Double)
        tag["Rotation"].tags = [TAG_Double(i)
            for i in player.location.ori.to_degs()]

        tag["Inventory"] = self._save_inventory_to_tag(player.inventory)

        fp = self.folder.child("players").child("%s.dat" % player.username)
        self._write_tag(fp, tag)
开发者ID:MartysTardis,项目名称:bravo,代码行数:17,代码来源:beta.py

示例6: _save_level_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_level_to_tag(self, level):
        tag = NBTFile()
        tag.name = ""

        tag["Data"] = TAG_Compound()
        tag["Data"]["RandomSeed"] = TAG_Long(level.seed)
        tag["Data"]["SpawnX"] = TAG_Int(level.spawn[0])
        tag["Data"]["SpawnY"] = TAG_Int(level.spawn[1])
        tag["Data"]["SpawnZ"] = TAG_Int(level.spawn[2])
        tag["Data"]["Time"] = TAG_Long(level.time)

        # Beta version and accounting.
        # Needed for Notchian tools to be able to comprehend this world.
        tag["Data"]["version"] = TAG_Int(19132)
        tag["Data"]["LevelName"] = TAG_String("Generated by Bravo :3")

        return tag
开发者ID:MartysTardis,项目名称:bravo,代码行数:19,代码来源:beta.py

示例7: save_player

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def save_player(self, player):
        tag = NBTFile()
        tag.name = ""

        tag["Pos"] = TAG_List(type=TAG_Double)
        tag["Pos"].tags = [TAG_Double(i) for i in (player.location.x, player.location.y, player.location.z)]

        tag["Rotation"] = TAG_List(type=TAG_Double)
        tag["Rotation"].tags = [TAG_Double(i) for i in (player.location.yaw, player.location.pitch)]

        tag["Inventory"] = self._save_inventory_to_tag(player.inventory)

        fp = self.folder.child("players")
        if not fp.exists():
            fp.makedirs()
        fp = fp.child("%s.dat" % player.username)
        self._write_tag(fp, tag)
开发者ID:Varriount,项目名称:bravo,代码行数:19,代码来源:beta.py

示例8: _save_entity_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_entity_to_tag(self, entity):
        tag = NBTFile()
        tag.name = ""

        tag["id"] = TAG_String(entity.name)

        position = [entity.location.x, entity.location.y, entity.location.z]
        tag["Pos"] = TAG_List(type=TAG_Double)
        tag["Pos"].tags = [TAG_Double(i) for i in position]

        rotation = [entity.location.yaw, entity.location.pitch]
        tag["Rotation"] = TAG_List(type=TAG_Double)
        tag["Rotation"].tags = [TAG_Double(i) for i in rotation]

        tag["OnGround"] = TAG_Byte(int(entity.location.grounded))

        self._entity_savers[entity.name](entity, tag)

        return tag
开发者ID:mmcgill,项目名称:bravo,代码行数:21,代码来源:beta.py

示例9: _save_chunk_to_tag

# 需要导入模块: from bravo.nbt import NBTFile [as 别名]
# 或者: from bravo.nbt.NBTFile import name [as 别名]
    def _save_chunk_to_tag(self, chunk):
        tag = NBTFile()
        tag.name = ""

        level = TAG_Compound()
        tag["Level"] = level

        level["Blocks"] = TAG_Byte_Array()
        level["HeightMap"] = TAG_Byte_Array()
        level["BlockLight"] = TAG_Byte_Array()
        level["Data"] = TAG_Byte_Array()
        level["SkyLight"] = TAG_Byte_Array()

        level["Blocks"].value = chunk.blocks.tostring()
        level["HeightMap"].value = chunk.heightmap.tostring()
        level["BlockLight"].value = pack_nibbles(chunk.blocklight)
        level["Data"].value = pack_nibbles(chunk.metadata)
        level["SkyLight"].value = pack_nibbles(chunk.skylight)

        level["TerrainPopulated"] = TAG_Byte(chunk.populated)

        level["Entities"] = TAG_List(type=TAG_Compound)
        for entity in chunk.entities:
            try:
                entitytag = self._save_entity_to_tag(entity)
                level["Entities"].tags.append(entitytag)
            except KeyError:
                print "Unknown entity %s" % entity.name

        level["TileEntities"] = TAG_List(type=TAG_Compound)
        for tile in chunk.tiles.itervalues():
            try:
                tiletag = self._save_tile_to_tag(tile)
                level["TileEntities"].tags.append(tiletag)
            except KeyError:
                print "Unknown tile entity %s" % tile.name

        return tag
开发者ID:dequis,项目名称:bravo,代码行数:40,代码来源:serializers.py


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