use of ivorius.ivtoolkit.blocks.IvBlockCollection in project RecurrentComplex by Ivorforce.
the class TransformerSingleBlock method transform.
@Override
public void transform(S instanceData, Phase phase, StructureSpawnContext context, IvWorldData worldData, RunTransformer transformer) {
if (!generatesInPhase(instanceData, phase))
return;
IvBlockCollection blockCollection = worldData.blockCollection;
StructureBoundingBox relevantSourceArea = context.sourceIntersection(BlockAreas.toBoundingBox(blockCollection.area()));
if (relevantSourceArea == null)
return;
BlockPos lowerCoord = StructureBoundingBoxes.min(context.boundingBox);
int[] areaSize = new int[] { blockCollection.width, blockCollection.height, blockCollection.length };
// Freeze height to speed up light calculation
context.freezeHeightMap(context.intersection(context.boundingBox));
BlockPos.MutableBlockPos worldCoord = new BlockPos.MutableBlockPos();
for (BlockPos sourceCoord : RCStructureBoundingBoxes.mutablePositions(relevantSourceArea)) {
IvMutableBlockPos.add(context.transform.applyOn(sourceCoord, worldCoord, areaSize), lowerCoord);
if (!context.includesComplex(worldCoord))
continue;
IBlockState state = blockCollection.getBlockState(sourceCoord);
if (matches(context.environment, instanceData, sourceCoord, state))
transformBlock(instanceData, Phase.BEFORE, context, transformer, areaSize, worldCoord, state);
}
context.meltHeightMap();
}
Aggregations