#(Resolved) Kinda dumb, I want two "on_interacts"

1 messages · Page 1 of 1 (latest)

soft abyss
#

So I want an event to trigger if someone interacts with a block with [item], and something to occur if they interact with an open hand. I have no idea what to do about this, as it won't let me use two "on_interact"s, and I am a little silly and never learned anything outside of trying things until they work. I feel like this is a really easy and basic concept that most people should know, but I know nothing. Help.

static tree
#

filters?

soft abyss
#

How

#

All I've learned yet is conditions

static tree
#

You can make another on interact condition if it's a array

#

[
{condition 1, event 1}
{condition 2, event 2}
]

#

Is this what you meant?

soft abyss
#

I tried that (sorta)

#

"on_interact":[
{event1, condition1},
{event2, condition2}
]

#

I think

#

But it said something about "this is an array, we expected an object", and the whole block failed

static tree
#

let me see the code then

soft abyss
#

"minecraft:on_interact": [{ "event": "choco:fertilize", "condition": "q.is_item_name_any('slot.weapon.mainhand', 'minecraft:bone_meal') && q.block_property('choco:growth_stage') < 3" }, { "event": "choco:harvest", "condition": "q.is_item_name_any('slot.weapon.mainhand', 'minecraft:air') && q.block_property('choco:growth_stage') = 3" } ]

#

It's very possible I did something dumber than expected

#

(I ran it again, the error says that the on_interact has an unknown child schema option type, and it only allows type "Object")

dim frigate
#

Interact -> event
event -> sequence
within the sequences can do filters and trigger to another event

#

The event the interact calls will just be the middle man and you can have as many filters/conditions as you want

static tree
#

You can just use filters instead of using queries

dim frigate
#

interactjson "components":{ "minecraft:on_interact": {"event": "ev:on_interact"} },

eventjson "events": { "ev:on_interact": { "sequence": [ { "condition": "q.is_item_name_any('slot.weapon.mainhand', 'minecraft:bone_meal') && q.block_property('choco:growth_stage') < 3", "event": "choco:fertilize" }, { "condition": "q.is_item_name_any('slot.weapon.mainhand', 'minecraft:air') && q.block_property('choco:growth_stage') = 3", "event": "choco:harvest" } ] } }

soft abyss
#

Thank you nikki, I'll try this out!

narrow fractal
#

This should be on #1072983602821861426

#

It's quite useful

static tree
#

It kinda is already

#

(in a forum post about blocks)

#

but yeah, it would be useful to have it in #1072983602821861426 for new creators

soft abyss
#

Okay, update...

narrow fractal
soft abyss
#

"blocks/raspberry_bush.json | choco:raspberry_bush | events | choco:on_interact | event | child 'event' not valid here."

static tree
#

it's supposed to have interactions

soft abyss
#

It appears to be displeased in how the event's triggering events or smth?

soft abyss
static tree
#

oh wait that is for on_interact

#

it's supposed to be trigger insteas

soft abyss
#

how do I stick that trigger in there?

static tree
#

the trigger triggers events that your mob have

#

change from event to trigger

soft abyss
#

Got it

#

Testing time!

#

It worked! Now I just gotta adjust loot tables and growth times and it'll be done

#

Thanks ya'll!

soft abyss
#

(Resolved) Kinda dumb, I want two "on_interacts"

fringe urchin
#

I guess this was resolved. Please make sure to close your post if you don’t have any other questions.

soft abyss
#

How?