示例#1
0
 def _delete_chunks(self, evt):
     load_original = self._ask_delete_chunks()
     if load_original is not None:
         self.canvas.run_operation(lambda: delete_chunk(
             self.canvas.world,
             self.canvas.dimension,
             self.canvas.selection.selection_group,
             load_original,
         ))
示例#2
0
        def test_delete_chunk(self):
            subbox1 = SelectionBox((1, 1, 1), (5, 5, 5))
            box1 = SelectionGroup((subbox1, ))

            self.assertEqual(
                "universal_minecraft:stone",
                self.world.get_block(1, 70, 3, OVERWORLD).blockstate,
            )
            self.assertEqual(
                "universal_minecraft:granite[polished=false]",
                self.world.get_block(1, 70, 5, OVERWORLD).blockstate,
            )

            generator_unpacker(delete_chunk(self.world, OVERWORLD, box1))
            self.world.create_undo_point()

            with self.assertRaises(ChunkDoesNotExist):
                _ = self.world.get_block(1, 70, 3, OVERWORLD).blockstate

            self.assertEqual(
                0,
                len([
                    x for x in self.world.get_chunk_slice_box(
                        OVERWORLD, subbox1)
                ]),
            )

            self.world.undo()

            self.assertEqual(
                "universal_minecraft:stone",
                self.world.get_block(1, 70, 3, OVERWORLD).blockstate,
            )
            self.assertEqual(
                "universal_minecraft:granite[polished=false]",
                self.world.get_block(1, 70, 5, OVERWORLD).blockstate,
            )

            self.world.redo()

            with self.assertRaises(ChunkDoesNotExist):
                _ = self.world.get_block(1, 70, 3, OVERWORLD).blockstate

            self.assertEqual(
                0,
                len([
                    x for x in self.world.get_chunk_slice_box(
                        OVERWORLD, subbox1)
                ]),
            )
def delete_chunk_wrapper(world, dimension, selection, _):
    return delete_chunk(world, dimension, selection)
示例#4
0
 def _delete_chunks(self, evt):
     self.canvas.run_operation(lambda: delete_chunk(
         self.canvas.world,
         self.canvas.dimension,
         self.canvas.selection.selection_group,
     ))