#include <Decoration/Decoration.hpp>
#include <WorldGenerator/SurvivalWorldGenerator/SurvivalWorldGenerator.hpp>
#include <World/LocalWorld/LocalWorld.hpp>

Decoration::Builder::Builder(SurvivalWorldGenerator& worldgen, Chunk& chunk) : worldgen(worldgen), chunk(chunk) {}

void Decoration::Builder::place(glm::ivec3 pos, std::string name, uint8_t meta)
{
    int id = worldgen.getWorld().getBlockId(name);
    glm::ivec3 offset = pos - chunk.base;
    glm::bvec3 inBounds(glm::greaterThanEqual(offset, glm::ivec3(0)) && glm::lessThan(offset, glm::ivec3(16)));

    if (inBounds == glm::bvec3(true))
    {
        chunk.setBlockAndMeta(offset, id, meta);
    }
}