use of net.minecraft.world.gen.feature.util.FeatureContext in project SpoornPink by spoorn.
the class AbstractSPTree method generate.
@Override
public boolean generate(FeatureContext<FC> context) {
Set<BlockPos> changedTrunkBlocks = Sets.newHashSet();
Set<BlockPos> changedLeafBlocks = Sets.newHashSet();
StructureWorldAccess world = context.getWorld();
boolean generated = generate(changedTrunkBlocks, changedLeafBlocks, world, context.getRandom(), context.getOrigin(), context.getConfig());
if (!generated || changedTrunkBlocks.isEmpty() && changedLeafBlocks.isEmpty()) {
return false;
}
/**
* Copy vanilla's from {@link TreeFeature}.
*/
return BlockBox.encompassPositions(Iterables.concat(changedTrunkBlocks, changedLeafBlocks)).map(box -> {
VoxelSet voxelSet = placeLogsAndLeaves(world, box, changedTrunkBlocks);
Structure.updateCorner(world, Block.NOTIFY_ALL, voxelSet, box.getMinX(), box.getMinY(), box.getMinZ());
return true;
}).orElse(false);
}
Aggregations