package electrosphere.game.server.datacell;

import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.types.collision.CollisionObjUtils;
import electrosphere.entity.types.foliage.FoliageUtils;
import electrosphere.main.Globals;
import java.util.List;
import java.util.Random;
import org.joml.Quaternionf;
import org.joml.Vector3f;

/**
 *
 * @author amaterasu
 */
public class EnvironmentGenerator {
    
    
    public static void generatePlains(List<Entity> entityList, int worldX, int worldY, long randomizer){
        Random rand = new Random(randomizer);
        int targetNum = (int)(rand.nextFloat() * 10) + 10;
        for(int i = 0; i < targetNum; i++){
            Entity newTree = FoliageUtils.spawnBasicFoliage("FallOak1");
            entityList.add(newTree);
            double posX = worldX * Globals.serverWorldData.getDynamicInterpolationRatio() + (float)(rand.nextFloat() * Globals.serverWorldData.getDynamicInterpolationRatio());
            double posZ = worldY * Globals.serverWorldData.getDynamicInterpolationRatio() + (float)(rand.nextFloat() * Globals.serverWorldData.getDynamicInterpolationRatio());
            double posY = Globals.serverTerrainManager.getHeightAtPosition(posX, posZ);
//            System.out.println("Spawning tree at: " + posX + "," + posY + "," + posZ);
//            CollisionObjUtils.positionCharacter(newTree, new Vector3f(posX,posY,posZ));
            EntityUtils.getPosition(newTree).set(posX,posY,posZ);
        }
    }
}
