Search in sources :

Example 1 with TransformerMulti

use of ivorius.reccomplex.world.gen.feature.structure.generic.transformers.TransformerMulti in project RecurrentComplex by Ivorforce.

the class RCConfig method getUniversalTransformer.

public static TransformerMulti getUniversalTransformer() {
    if (universalTransformer == null) {
        universalTransformer = new TransformerMulti("rc_universal", "");
        universalTransformer.getData().setToCustom();
        universalTransformer.getTransformers().clear();
        universalTransformerPresets.stream().map(TransformerMulti::fromPreset).forEach(universalTransformer.getTransformers()::add);
    }
    return universalTransformer;
}
Also used : TransformerMulti(ivorius.reccomplex.world.gen.feature.structure.generic.transformers.TransformerMulti)

Example 2 with TransformerMulti

use of ivorius.reccomplex.world.gen.feature.structure.generic.transformers.TransformerMulti in project RecurrentComplex by Ivorforce.

the class GenericStructure method prepareInstanceData.

@Nullable
@Override
public InstanceData prepareInstanceData(@Nonnull StructurePrepareContext context, @Nonnull TransformerMulti foreignTransformer) {
    InstanceData instanceData = new InstanceData();
    if (!context.generateAsSource) {
        IvWorldData worldData = constructWorldData();
        IvBlockCollection blockCollection = worldData.blockCollection;
        int[] areaSize = new int[] { blockCollection.width, blockCollection.height, blockCollection.length };
        BlockPos origin = StructureBoundingBoxes.min(context.boundingBox);
        variableDomain.fill(instanceData.variableDomain, context.environment, context.random);
        instanceData.variableDomain.fill(context.environment.variables);
        instanceData.transformerData = this.transformer.prepareInstanceData(context, worldData);
        instanceData.foreignTransformerData = foreignTransformer.prepareInstanceData(context, worldData);
        TransformerMulti transformer = TransformerMulti.fuse(Arrays.asList(this.transformer, foreignTransformer));
        TransformerMulti.InstanceData cInstanceData = transformer.fuseDatas(Arrays.asList(instanceData.transformerData, instanceData.foreignTransformerData));
        RunTransformer runTransformer = new RunTransformer(transformer, cInstanceData);
        transformer.configureInstanceData(cInstanceData, context, worldData, runTransformer);
        if (context.generateMaturity.isSuggest() && !transformer.mayGenerate(cInstanceData, context, worldData, runTransformer))
            return null;
        worldData.tileEntities.forEach(tileEntityCompound -> {
            asGeneratingTileEntity(context, IvTileEntityHelper.getAnyWorld(), areaSize, origin, tileEntityCompound, (src, tileEntity) -> {
                NBTStorable tileEntityInstanceData = (NBTStorable) tileEntity.prepareInstanceData(context);
                if (tileEntityInstanceData != null)
                    instanceData.tileEntities.put(src, tileEntityInstanceData);
            });
        });
    }
    return instanceData;
}
Also used : RunTransformer(ivorius.reccomplex.world.gen.feature.structure.generic.transformers.RunTransformer) IvWorldData(ivorius.ivtoolkit.tools.IvWorldData) TransformerMulti(ivorius.reccomplex.world.gen.feature.structure.generic.transformers.TransformerMulti) IvMutableBlockPos(ivorius.ivtoolkit.blocks.IvMutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos) NBTStorable(ivorius.reccomplex.nbt.NBTStorable) IvBlockCollection(ivorius.ivtoolkit.blocks.IvBlockCollection) Nullable(javax.annotation.Nullable)

Aggregations

TransformerMulti (ivorius.reccomplex.world.gen.feature.structure.generic.transformers.TransformerMulti)2 IvBlockCollection (ivorius.ivtoolkit.blocks.IvBlockCollection)1 IvMutableBlockPos (ivorius.ivtoolkit.blocks.IvMutableBlockPos)1 IvWorldData (ivorius.ivtoolkit.tools.IvWorldData)1 NBTStorable (ivorius.reccomplex.nbt.NBTStorable)1 RunTransformer (ivorius.reccomplex.world.gen.feature.structure.generic.transformers.RunTransformer)1 Nullable (javax.annotation.Nullable)1 BlockPos (net.minecraft.util.math.BlockPos)1