#(MrHoneyBun) Is there a better way to write this?

1 messages · Page 1 of 1 (latest)

brittle schooner
#

right clicking the air with the lucky diamond gives you a random lucky item. is there easier ways to write this code? did i overcomplicate anything?

luckdiamondore:
    type: world
    events:
        on player breaks diamond_ore chance:50:
            - determine luckydiamonditem
        on player right clicks air with:luckydiamonditem:
            - take iteminhand quantity:1
            - define lucky_item <list[lucky_helmet|lucky_chestplate|lucky_leggings|lucky_boots|lucky_sword|lucky_pickaxe|lucky_axe|lucky_shovel|lucky_hoe].random[1]>
            - give <[lucky_item]>
            - adjust <[lucky_item]> enchantments:mending
            - adjust <[lucky_item]> hides:ENCHANTS
            - narrate "<&a>You received a lucky item!"
lucky_helmet:
    type: item
    material: diamond_helmet
    display name: <&e>Lucky Helmet
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_chestplate:
    type: item
    material: diamond_chestplate
    display name: <&e>Lucky Chestplate
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_leggings:
    type: item
    material: diamond_leggings
    display name: <&e>Lucky Leggings
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_boots:
    type: item
    material: diamond_boots
    display name: <&e>Lucky Boots
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_sword:
    type: item
    material: diamond_sword
    display name: <&e>Lucky Sword
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_pickaxe:
    type: item
    material: diamond_pickaxe
    display name: <&e>Lucky Pickaxe
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_axe:
    type: item
    material: diamond_axe
    display name: <&e>Lucky Axe
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_shovel:
    type: item
    material: diamond_shovel
    display name: <&e>Lucky Shovel
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
lucky_hoe:
    type: item
    material: diamond_hoe
    display name: <&e>Lucky Hoe
    enchantments:
    - mending:1
    mechanisms:
        hides: ENCHANTS
LuckyDiamondItem:
    type: item
    material: diamond
    display name: <&e>Lucky Diamond

quiet umbraBOT
#

(MrHoneyBun) Is there a better way to write this?

quiet umbraBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

brittle schooner
#

this 100% works btw

earnest osprey
#

yup theres absolutely a way to write that better

#

first, a question: do you need them to be item scripts?

night shuttle
#

The item scripts part is fine, although why are you adjusting stuff the item already has?

#

Also, I'd probably just have one "lucky_item", and just change the material and name, since they're all identical anyways.

earnest osprey
#

forgot you could change an item's material lmao yeah thats better

static grotto
#

you can't adjust items

#

item objects are templates, not things in the real world

brittle schooner
maiden moatBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@brittle schooner