import { EquipmentSlot } from "@minecraft/server";
import { system, world, Entity, Player } from "@minecraft/server";
export const afterEvents = world.afterEvents;
export const beforeEvents = world.beforeEvents;
export function sleep(ticks) {
    return new Promise((resolve) => system.runTimeout(resolve, ticks));
}
Entity.prototype.isPlayer = function () {
    return this.typeId === "minecraft:player";
};
Object.defineProperties(Entity.prototype, {
    health: {
        get: function () {
            return this.getComponent('health');
        }
    },
    inventory: {
        get: function () {
            return this.getComponent('inventory');
        }
    }
});
Object.defineProperty(Player.prototype, 'equippable', {
    get: function () {
        return this.getComponent('equippable');
    },
    enumerable: true,
    configurable: false
});
Player.prototype.getMainhand = function () {
    return this.equippable.getEquipment(EquipmentSlot.Mainhand);
};
