import * as mc from "@minecraft/server";

export class variantManager {
    static beforeplace(data) {
        data.permutationToPlace = mc.BlockPermutation.resolve(data.permutationToPlace.type.id, {"minecraft:cardinal_direction": data.permutationToPlace.getState("minecraft:cardinal_direction"), 'sgs_farm:variant': getRandomInt(0,3)});
    }
}

function getRandomInt(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min + 1)) + min;
}