本文整理匯總了Python中bravo.chunk.Chunk.get_metadata方法的典型用法代碼示例。如果您正苦於以下問題:Python Chunk.get_metadata方法的具體用法?Python Chunk.get_metadata怎麽用?Python Chunk.get_metadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bravo.chunk.Chunk
的用法示例。
在下文中一共展示了Chunk.get_metadata方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestChunkBlocks
# 需要導入模塊: from bravo.chunk import Chunk [as 別名]
# 或者: from bravo.chunk.Chunk import get_metadata [as 別名]
class TestChunkBlocks(unittest.TestCase):
def setUp(self):
self.c = Chunk(0, 0)
def test_trivial(self):
pass
def test_destroy(self):
"""
Test block destruction.
"""
self.c.set_block((0, 0, 0), 1)
self.c.set_metadata((0, 0, 0), 1)
self.c.destroy((0, 0, 0))
self.assertEqual(self.c.get_block((0, 0, 0)), 0)
self.assertEqual(self.c.get_metadata((0, 0, 0)), 0)
def test_sed(self):
"""
``sed()`` should work.
"""
self.c.set_block((1, 1, 1), 1)
self.c.set_block((2, 2, 2), 2)
self.c.set_block((3, 3, 3), 3)
self.c.sed(1, 3)
self.assertEqual(self.c.get_block((1, 1, 1)), 3)
self.assertEqual(self.c.get_block((2, 2, 2)), 2)
self.assertEqual(self.c.get_block((3, 3, 3)), 3)
def test_set_block_heightmap(self):
"""
Heightmaps work.
"""
self.c.populated = True
self.c.set_block((0, 20, 0), 1)
self.assertEqual(self.c.heightmap[0], 20)
def test_set_block_heightmap_underneath(self):
"""
A block placed underneath the highest block will not alter the
heightmap.
"""
self.c.populated = True
self.c.set_block((0, 20, 0), 1)
self.assertEqual(self.c.heightmap[0], 20)
self.c.set_block((0, 10, 0), 1)
self.assertEqual(self.c.heightmap[0], 20)
def test_set_block_heightmap_destroyed(self):
"""
Upon destruction of the highest block, the heightmap will point at the
next-highest block.
"""
self.c.populated = True
self.c.set_block((0, 30, 0), 1)
self.c.set_block((0, 10, 0), 1)
self.c.destroy((0, 30, 0))
self.assertEqual(self.c.heightmap[0], 10)