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


Python block.Block方法代码示例

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


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

示例1: __init__

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def __init__(self, x, y, z, blockType, blockData = 0, tag = ""):
        #persist data
        self.blockType = blockType
        self.blockData = blockData

        #store the positions
        # original pos
        self.originalPos = minecraft.Vec3(x, y, z)
        # relative pos - block position relatively to other shape blocks
        self.relativePos = minecraft.Vec3(x, y, z)
        # actual pos - actual block position in the world
        self.actualPos = minecraft.Vec3(x, y, z)

        #the tag system is used to give a particular block inside a shape meaning
        # e.g. for an animal shape you could tag the block which is its head
        self.tag = tag

        # the mc block object
        self.mcBlock = block.Block(blockType, blockData) 
开发者ID:TeachCraft,项目名称:TeachCraft-Examples,代码行数:21,代码来源:minecraftstuff.py

示例2: getBlockWithData

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def getBlockWithData(self, *args):
        """Get block with data (x,y,z) => Block"""
        ans = self.conn.sendReceive("world.getBlockWithData", intFloor(args))
        return Block(*map(int, ans.split(","))) 
开发者ID:teachthenet,项目名称:TeachCraft-Challenges,代码行数:6,代码来源:minecraft.py

示例3: __init__

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def __init__(self, address=None):
        self._bucket = Bucket(Blockchain.db_file, Blockchain.block_bucket)

        try:
            self._tip = self._bucket.get('l')
        except KeyError:
            if not address:
                self._tip = None
            else:
                cb_tx = CoinbaseTx(
                    address, Blockchain.genesis_coinbase_data)
                genesis = Block([cb_tx]).pow_of_block()
                self._block_put(genesis) 
开发者ID:yummybian,项目名称:blockchain-py,代码行数:15,代码来源:blockchain.py

示例4: MineBlock

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def MineBlock(self, transaction_lst):
        # Mines a new block with the provided transactions
        last_hash = self._bucket.get('l')

        for tx in transaction_lst:
            if not self.verify_transaction(tx):
                print("ERROR: Invalid transaction")
                sys.exit()

        new_block = Block(transaction_lst, last_hash).pow_of_block()
        self._block_put(new_block)
        return new_block 
开发者ID:yummybian,项目名称:blockchain-py,代码行数:14,代码来源:blockchain.py

示例5: __init__

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def __init__(self, x, y, z, blockType, blockData=0):
        #persist data
        self.blockType = blockType
        self.blockData = blockData
        #store the positions
        # relative pos - block position relatively to other shape blocks
        self.relativePos = minecraft.Vec3(x, y, z)
        # actual pos - actual block position in the world
        self.actualPos = minecraft.Vec3(x, y, z)
        # the mc block object
        self.mcBlock = block.Block(blockType, blockData) 
开发者ID:martinohanlon,项目名称:minecraft-starwars,代码行数:13,代码来源:minecraftstuff.py

示例6: penblock

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def penblock(self, blockId, blockData=0):
        """
        set the block the turtle uses as its pen.

        :param int blockType:
            The block id.

        :param int blockData:
            The block data value, defaults to ``0``.
        """
        self._penblock = block.Block(blockId, blockData) 
开发者ID:TeachCraft,项目名称:TeachCraft-Examples,代码行数:13,代码来源:minecraftstuff.py

示例7: refresh

# 需要导入模块: import block [as 别名]
# 或者: from block import Block [as 别名]
def refresh(self):
        """ Even though blocks never change, you freshly obtain its contents
            from an API with this method
        """
        identifier = self.identifier
        block = self.blockchain.rpc.get_block(self.identifier)
        if not block:
            raise BlockDoesNotExistsException
        super(Block, self).__init__(
            block, blockchain_instance=self.blockchain, use_cache=self._use_cache
        )
        # block does not contain an id and thus identifier gets overwritten
        self.identifier = identifier 
开发者ID:xeroc,项目名称:python-graphenelib,代码行数:15,代码来源:block.py


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