#Enchant items with unbreakable?

1 messages · Page 1 of 1 (latest)

half dew
#

I can't find anything on how to enchant with unbreakable specifically
This is the code I have

function CreateTool(id: string , type: object , name: string , lore: objects , enchants: objects):
    set {_current} to {_type} named {_name}
    loop {_lore::*}:
        add loop-value to lore of {_current}
    send {_enchants::*} to all players
    loop {_enchants::*}:
        set {_e} to loop-value parsed as enchantment type
        send {_e} to all players
        enchant {_current} with {_e}
        enchant {_current} with loop-value
    give all players 1 of {_current}

Right now it's in testing phase that's why I have the send and give for debugging
but if I send a list for enchants that has "unbreakable" in it, it doesn't work, where as everything else does

half dew
#

Nvm I figured it out

function CreateTool(id: string , type: object , name: string , lore: objects , enchants: objects):
    set {_current} to {_type} named {_name}
    loop {_lore::*}:
        add loop-value to lore of {_current}
    loop {_enchants::*}:
        set {_e} to loop-value parsed as enchantment type
        enchant {_current} with {_e}
        if loop-value is "unbreakable":
            set {_current} to unbreakable {_current}
    give all players 1 of {_current}