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.
#(Resolved) Kinda dumb, I want two "on_interacts"
1 messages · Page 1 of 1 (latest)
filters?
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?
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
let me see the code then
"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")
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
You can just use filters instead of using queries
How
How event?
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" } ] } }
Thank you nikki, I'll try this out!
It kinda is already
(in a forum post about blocks)
but yeah, it would be useful to have it in #1072983602821861426 for new creators
Okay, update...
I've been some time making addons and I didn't know that lol
"blocks/raspberry_bush.json | choco:raspberry_bush | events | choco:on_interact | event | child 'event' not valid here."
it's supposed to have interactions
It appears to be displeased in how the event's triggering events or smth?
how
how do I stick that trigger in there?
Got it
Testing time!
It worked! Now I just gotta adjust loot tables and growth times and it'll be done
Thanks ya'll!
(Resolved) Kinda dumb, I want two "on_interacts"
I guess this was resolved. Please make sure to close your post if you don’t have any other questions.
How?