#(jah_coby) Scripts material vs material.name

10 messages · Page 1 of 1 (latest)

humble dove
#

Did I just make a mistake and this is working as intended or is this an issue? I was throwing down a basic event to prevent any method of fortune being used on diamond ores and it throw an error if the ".name" isn't present.

I feel like I recall other cases where denizen is meant to "know" and process the right outcome from something like the context.material returning as an object rather than the name.

    type: world
    events:
        on player breaks *diamond_ore with:netherite_pickaxe|diamond_pickaxe|iron_pickaxe:
            - determine <context.material>```

Unless you append .name to material it throws an error. Is this normal behavior?
gritty boughBOT
gritty boughBOT
#

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.

quiet cosmos
#

That event doesn't have a MaterialTag determination. It's likely that the .name is triggering the ItemTag determination and using that

#

!e player breaks

rancid oarBOT
quiet cosmos
#

!e player breaks block

rancid oarBOT
# quiet cosmos !e player breaks block
Group

Player

Event Lines

player breaks block player breaks <material>

Switches

with:<item> to only process the event when the player is breaking the block with a specified item.

Triggers

when a player breaks a block.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.location> returns the LocationTag the block was broken at.
<context.material> returns the MaterialTag of the block that was broken.
<context.xp> returns how much XP will be dropped.
<context.should_drop_items> returns whether the event will drop items.

Determine

"NOTHING" to make the block drop no items.
ListTag(ItemTag) to make the block drop a specified list of items.
ElementTag(Number) to set the amount of xp to drop.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

humble dove
#

Okay so just nature of how that event works? Had wondered and figured I'd see if intended, thanks.