Search in sources :

Example 6 with MockWorld

use of ivorius.ivtoolkit.world.MockWorld in project RecurrentComplex by Ivorforce.

the class CommandMapStructure method execute.

@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
    RCParameters parameters = RCParameters.of(args);
    String id = parameters.get().first().require();
    GenericStructure structure = parameters.rc().genericStructure().require();
    ResourceDirectory directory = parameters.rc("dir").resourceDirectory().optional().orElse(ResourceDirectory.ACTIVE);
    CommandVirtual virtual = parameters.rc().move(1).virtualCommand(server).require();
    IvWorldData worldData = structure.constructWorldData();
    MockWorld world = new MockWorld.WorldData(worldData);
    try {
        virtual.execute(world, new CommandSelecting.SelectingSender(commandSender, BlockPos.ORIGIN, worldData.blockCollection.area().getHigherCorner()), parameters.get().move(2).varargs());
    } catch (MockWorld.VirtualWorldException ex) {
        throw ServerTranslations.commandException("commands.rcmap.nonvirtual.arguments");
    }
    structure.worldDataCompound = worldData.createTagCompound();
    PacketSaveStructureHandler.write(commandSender, structure, id, directory, true, true);
}
Also used : RCParameters(ivorius.reccomplex.commands.parameters.RCParameters) CommandVirtual(ivorius.reccomplex.commands.CommandVirtual) ResourceDirectory(ivorius.reccomplex.files.loading.ResourceDirectory) IvWorldData(ivorius.ivtoolkit.tools.IvWorldData) IvWorldData(ivorius.ivtoolkit.tools.IvWorldData) CommandSelecting(ivorius.reccomplex.commands.CommandSelecting) MockWorld(ivorius.ivtoolkit.world.MockWorld) GenericStructure(ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure)

Aggregations

MockWorld (ivorius.ivtoolkit.world.MockWorld)6 CommandVirtual (ivorius.reccomplex.commands.CommandVirtual)6 RCParameters (ivorius.reccomplex.commands.parameters.RCParameters)6 RCConfig (ivorius.reccomplex.RCConfig)4 SelectionOwner (ivorius.reccomplex.capability.SelectionOwner)4 RCCommands (ivorius.reccomplex.commands.RCCommands)4 RCExpect (ivorius.reccomplex.commands.parameters.RCExpect)4 ServerTranslations (ivorius.reccomplex.utils.ServerTranslations)4 Collectors (java.util.stream.Collectors)4 Nullable (javax.annotation.Nullable)4 CommandException (net.minecraft.command.CommandException)4 ICommandSender (net.minecraft.command.ICommandSender)4 MinecraftServer (net.minecraft.server.MinecraftServer)4 BlockPos (net.minecraft.util.math.BlockPos)4 BlockStates (ivorius.ivtoolkit.blocks.BlockStates)3 List (java.util.List)3 IntStream (java.util.stream.IntStream)3 Block (net.minecraft.block.Block)3 IBlockState (net.minecraft.block.state.IBlockState)3 IvWorldData (ivorius.ivtoolkit.tools.IvWorldData)2