本文整理汇总了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)