Esempio n. 1
0
def fill_(world: "World", dimension: int, selection_box: Selection,
          options: dict):
    if isinstance(options.get('fill_block'), Block):
        fill(world, dimension, selection_box, options)
    else:
        wx.MessageBox(
            'Please specify a block before running the fill operation')
Esempio n. 2
0
 def _run_operation(self, _):
     self.canvas.run_operation(lambda: fill(
         self.world,
         self.canvas.dimension,
         self.canvas.selection_group,
         self._get_fill_block(),
     ))
Esempio n. 3
0
def fill_(world: "World", dimension: Dimension, selection: SelectionGroup,
          options: dict):
    if isinstance(options.get('fill_block'), Block):
        yield from fill(world, dimension, selection, options)
    else:
        raise Exception(
            'Please specify a block before running the fill operation')
Esempio n. 4
0
def delete(world: "BaseLevel", dimension: Dimension,
           selection: SelectionGroup) -> OperationReturnType:
    yield from fill(
        world,
        dimension,
        selection,
        UniversalAirBlock,
    )
Esempio n. 5
0
def delete(world: "World", dimension: Dimension, selection: SelectionGroup):
    yield from fill(
        world, dimension, selection, {
            "fill_block":
            world.translation_manager.get_version(
                'java',
                (1, 15, 2)).block.to_universal(Block("minecraft", "air"))[0]
        })
Esempio n. 6
0
def delete(
    world: "World", dimension: Dimension, selection: SelectionGroup
) -> OperationReturnType:
    yield from fill(
        world,
        dimension,
        selection,
        world.translation_manager.get_version("java", (1, 15, 2)).block.to_universal(
            Block("minecraft", "air")
        )[0],
    )
Esempio n. 7
0
        def test_fill_operation(self):
            subbox_1 = SelectionBox((1, 70, 3), (5, 71, 5))
            selection = SelectionGroup((subbox_1, ))

            # Start sanity check
            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,
            )
            # End sanity check

            generator_unpacker(
                fill(
                    self.world,
                    OVERWORLD,
                    selection,
                    Block.from_string_blockstate("universal_minecraft:stone"),
                ))
            self.world.create_undo_point()

            for x, y, z in selection.blocks:
                self.assertEqual(
                    "universal_minecraft:stone",
                    self.world.get_block(x, y, z, OVERWORLD).blockstate,
                    f"Failed at coordinate ({x},{y},{z})",
                )

            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()

            for x, y, z in selection.blocks:
                self.assertEqual(
                    "universal_minecraft:stone",
                    self.world.get_block(x, y, z, OVERWORLD).blockstate,
                    f"Failed at coordinate ({x},{y},{z})",
                )
Esempio n. 8
0
def copy_selection(
    world: "World",
    dimension: Dimension,
    selection: SelectionGroup
):
    structure = Structure.from_world(
        world, selection, dimension
    )
    structure_buffer.append(structure)
    yield from fill(
        world,
        dimension,
        selection,
        {
            "fill_block": world.translation_manager.get_version(
                'java', (1, 15, 2)
            ).block.to_universal(
                Block("minecraft", "air")
            )[0]
        }
    )