#can somone help to save the enchantment and load it back

1 messages · Page 1 of 1 (latest)

fickle grove
#
const pickaxeList = ["minecraft:wooden_pickaxe", "minecraft:iron_pickaxe", "minecraft:diamond_pickaxe", "minecraft:golden_pickaxe", "minecraft:netherite_pickaxe", "minecraft:stone_pickaxe"];

system.runInterval(data => {
    const players = [...world.getPlayers()];
    players.forEach(player => {
        player.runCommandAsync(`scoreboard players remove @s[scores={combat=1..}] combat 1`);
        const inv = player.getComponent("minecraft:inventory").container;
        for (let i = 0; i < inv.size; i++) {
            const item = inv.getItem(i);
            if (!item) continue;
            const itemName = item.typeId;
            if (pickaxeList.includes(itemName) && item.nameTag != "§r§bFarming §cPVP") {
                const destroyBlocks = ["diamond_block", "coal_block", "iron_block", "gold_block", "iron_ore", "gold_ore", "diamond_ore", "coal_ore", "emerald_block", "emerald_ore"];
                const command = `execute as @a at @s[hasitem={item=${itemName},location=slot.weapon.mainhand}] run replaceitem entity @s slot.weapon.mainhand 1 ${itemName} 1 0 {"minecraft:can_destroy":{"blocks":${JSON.stringify(destroyBlocks)}}}`;
                player.runCommandAsync(`${command}`);
            }
        }
    });
}, 20);
#

i have this but its doesn't work

#

oh

#

ik

#

sorry

#

i asked chat gbt

#

IK thats why i ask do you have a idea