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);
}
Aggregations