public static void generateCircle(World world, Random rand, BlockPos center, float radius, int width, int height, ITreeBlockType block, float chance, EnumReplaceMode replace) {
Vec3i start = new Vec3i(center.getX() - radius, center.getY(), center.getZ() - radius);
Vec3i area = new Vec3i(radius * 2 + 1, height, radius * 2 + 1);
for (int x = start.getX(); x < start.getX() + area.getX(); x++) {
for (int y = start.getY() + area.getY() - 1; y >= start.getY(); y--) {
for (int z = start.getZ(); z < start.getZ() + area.getZ(); z++) {
if (rand.nextFloat() > chance) {
continue;
}
double distance = new Vec3i(x, y, z).getDistance(center.getX(), y, center.getZ());
if (radius - width - 0.01 < distance && distance <= radius + 0.01) {
addBlock(world, new BlockPos(x, y, z), block, replace);
}
}
}
}
}