本文整理汇总了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)
示例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(",")))
示例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)
示例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
示例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)
示例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)
示例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