當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。