import * as mc from "@minecraft/server";
import * as vector from "../utils/vector";
import * as effects from "../effects";

export function foodFinishUse(event) {
    if (event.itemStack.typeId === "minecraft:milk_bucket") {
        event.source.setDynamicProperty("hf_mzs:poison_resistance", 1);
    }
    if (event.itemStack.typeId === "hf_mzs:luminous_jelly") {
        event.source.addEffect("night_vision", 1200, {
            amplifier: 1,
            showParticles: true
        });
    }
    if (event.itemStack.typeId === "hf_mzs:potion_poison_resistance") {
        if (event.source.getGameMode() === "survival" || event.source.getGameMode() === "adventure")
            event.source.runCommand("/give @s glass_bottle");
        effects.applyPoisonResistance(event.source, 60);
        event.source.removeEffect("poison");
    }
}