import { Entity } from "@minecraft/server"
import { arrayIncludes } from "../../utils/systemHelper"
import { EntityHelper } from "../../entities/utils/entityHelper"

export const DUSKITE_TOOLS = {
    _duskiteTools: [
        "piki_beyondsurvival:duskite_axe",
        "piki_beyondsurvival:duskite_pickaxe",
        "piki_beyondsurvival:duskite_shovel",
        "piki_beyondsurvival:duskite_hoe",
        "piki_beyondsurvival:duskite_sword"
    ],
    _attackEffect: EntityHelper.createEntityEffect("levitation", 1, 5, true),

    isDuskiteTool(itemId) {
        return arrayIncludes(this._duskiteTools, itemId)
    },

    /**
     * 
     * @param {Entity} hitEntity 
     */
    applyAttackEffect(hitEntity) {
        const {effectType, duration, amplifier, showParticles} = this._attackEffect
        hitEntity.addEffect(effectType, duration, {amplifier: amplifier, showParticles: showParticles})
    }
}