def test_prepare_stage_should_return_none_if_no_init_pos_or_level_is_set(self):
        init_pos = [-269, 4, 1584]
        b = BaseBuilder(level_path=None, init_pos=init_pos)

        ret = b.prepare_stage()
        self.assertEquals(ret, None)

        b = BaseBuilder(level_path=None, init_pos=None)
        b.level = "loaded_level"

        ret = b.prepare_stage()
        self.assertEquals(ret, None)
Example #2
0
def testando(block_id=2504, block_data=15):
    level_path = "/home/arruda/.minecraft_galera/saves/testando/level.dat"
    init_pos = [-269, 4, 1584]
    size = [4, 4, 4]
    x, y, z = init_pos
    b = BaseBuilder(level_path, init_pos=init_pos, size=size)
    b.load_level()
    b.prepare_stage()

    # block_id = 2504
    # block_data = 15

    b.change_block_at(x, y, z, block_id, block_data)

    b.save()
    return b
    def test_prepare_stage_should_instantiate_box_with_correct_sizes_and_origin(self):
        init_pos = [1, 2, 3]
        size = [6, 5, 4]
        bb = BaseBuilder(level_path=None, init_pos=init_pos, size=size)

        #mocks
        customine.base.BoundingBox.return_value.chunkPositions = 'chunk_positions'
        bb.level = Mock()
        bb.level.createChunksInBox = Mock()

        ret_chunks = bb.prepare_stage()
        self.assertEquals(ret_chunks, 'chunk_positions')
        customine.base.BoundingBox.assert_called_once_with(
            origin=tuple(init_pos), size=size
        )