import { Player, ItemStack, Block, world } from "@minecraft/server";
import { notReinforceable } from "./config";

class ItemUtils {
  /**
   * @param {ItemStack} item
   * @param {Block} block
   * @param {Player} player
   */
  constructor(item, block, player) {
    this.item = item;
    this.itemid = item?.typeId;
    this.block = block;
    this.blockid = block?.typeId;
    this.blockLoc = block?.location;
    this.player = player;
    this.dimension = player?.dimension;
    this.properties = world.getDynamicPropertyIds();
    this.reinforceable = this.isReinforceablel(block);
  }
  // PENDIENTE
  reforceBlock() {
    console.warn(this.itemid)
    if (this.itemid == "scb:block_reinforcer" && !this.reinforceable) {
        
    }
  }

  /**
   * @param {Block} block
   */
  isReinforceablel(block) {
    for (const not of notReinforceable) {
        if (block?.typeId.includes(not)) return false;
        else return true;
    }
  }
}

export default ItemUtils;
