package net.mcreator.cawezsmantletostratus.procedures;

import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Mth;
import net.minecraft.core.BlockPos;

import net.minecraft.world.level.LevelAccessor;

public class WetlandcrossesAdditionalGenerationConditionProcedure {
	public static boolean execute(LevelAccessor world, double x, double y, double z) {
		for (int i = 1 ; i < 100 ; i++) {
			if (world.getBlockState(BlockPos.containing(x, y + i, z)).canOcclude()) {
				float dx = Mth.nextFloat(RandomSource.create(), -0.2f, 0.2f);
				float dz = Mth.nextFloat(RandomSource.create(), -0.2f, 0.2f);
				for (int j = 0 ; j < 100 ; j++) {

					if (Mth.nextFloat(RandomSource.create(), 0f, 1f)>0.9f) {
						world.setBlock(BlockPos.containing((x + dx * j), y - j + i, (z + dz * j)), Blocks.SEA_LANTERN.defaultBlockState(), 3);
					} else{
						if (Mth.nextFloat(RandomSource.create(), 0f, 1f)>0.5f) {
							world.setBlock(BlockPos.containing((x + dx * j), y - j + i, (z + dz * j)), Blocks.PRISMARINE.defaultBlockState(), 3);
						} else {
							world.setBlock(BlockPos.containing((x + dx * j), y - j + i, (z + dz * j)), Blocks.DARK_PRISMARINE.defaultBlockState(), 3);

							if (Mth.nextFloat(RandomSource.create(), 0f, 1f)>0.95f) {
								world.setBlock(BlockPos.containing((x + dx * j), y - j + i, (z + dz * j)), Blocks.WET_SPONGE.defaultBlockState(), 3);
							}
						}
					}
			
					if (world.getBlockState(BlockPos.containing((x + dx * j), y - j + i - 1, (z + dz * j))).canOcclude()) {
						return true;
					}
				}
				return true;
			}
		}
		return true;
	}
}
