use of ivorius.reccomplex.world.gen.feature.structure.OperationClearArea in project RecurrentComplex by Ivorforce.
the class CommandSelectMove method execute.
@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
RCParameters parameters = RCParameters.of(args, "mirror", "noselect");
SelectionOwner selectionOwner = RCCommands.getSelectionOwner(commandSender, null, true);
RCCommands.assertSize(commandSender, selectionOwner);
BlockPos pos = parameters.pos("x", "y", "z", selectionOwner.getSelectedPoint1(), false).require();
AxisAlignedTransform2D transform = parameters.transform("rotation", "mirror").optional().orElse(AxisAlignedTransform2D.ORIGINAL);
boolean noselect = parameters.has("noselect");
BlockArea area = selectionOwner.getSelection();
IvWorldData worldData = IvWorldData.capture(commandSender.getEntityWorld(), area, true);
NBTTagCompound worldDataCompound = worldData.createTagCompound();
GenericStructure structure = GenericStructure.createDefaultStructure();
structure.worldDataCompound = worldDataCompound;
OperationRegistry.queueOperation(new OperationMulti(new OperationClearArea(area), new OperationGenerateStructure(structure, null, transform, pos, true).prepare((WorldServer) commandSender.getEntityWorld())), commandSender);
if (!noselect) {
StructureGenerator<GenericStructure.InstanceData> generator = new StructureGenerator<>(structure).transform(transform).lowerCoord(pos);
//noinspection OptionalGetWithoutIsPresent
StructureBoundingBox boundingBox = generator.boundingBox().get();
selectionOwner.setSelection(RCBlockAreas.from(boundingBox));
}
}
use of ivorius.reccomplex.world.gen.feature.structure.OperationClearArea in project RecurrentComplex by Ivorforce.
the class OperationRegistry method dummyOperation.
@Nullable
public static NBTTagCompound dummyOperation(@Nonnull Operation operation, int level) {
if (level == 0)
return writeOperation(operation);
if (operation instanceof OperationGenerateStructure) {
OperationGenerateStructure genStructure = (OperationGenerateStructure) operation;
if (level == 1 && genStructure.structure != null) {
IvWorldData dummyWorldData = genStructure.structure.constructWorldData();
dummyWorldData.entities.clear();
dummyWorldData.tileEntities.clear();
for (BlockPos pos : dummyWorldData.blockCollection.area()) dummyWorldData.blockCollection.setBlockState(pos, (dummyWorldData.blockCollection.getBlockState(pos).isNormalCube() ? Blocks.STONE : Blocks.AIR).getDefaultState());
GenericStructure dummyStructure = new GenericStructure();
dummyStructure.worldDataCompound = dummyWorldData.createTagCompound();
return writeOperation(new OperationGenerateStructure(dummyStructure, genStructure.generationInfoID, genStructure.transform, genStructure.lowerCoord, genStructure.generateAsSource));
} else if (level == 2)
return writeOperation(new OperationClearArea(genStructure.generationArea()));
}
return null;
}
Aggregations