import range from "../../modules/arrayRange.js";
import registerSystem from "../registerSystem.js";

export default class itemSystem extends registerSystem {
    constructor(json) {
        super();
        this.item = json.script_item;
        this.listenForEvent("minecraft:itemUse", (eventData) => {
            const { source, item } = eventData;
            if (item.typeId === this.item.typeId) {
                let def = this.item.on_use;
                if (def !== undefined) {
                    return def(eventData.source,this);
                }
            }
        });
    }
}

