"Source" and "Target" entity dependencies

Upvotes: 40
Issue description

Some procedure triggers like "when entity hit with item", "when mob/player collides this entity", "when player hit with bullet" could use two entities as dependency rather than just one.

For example, in the "when entity hit with item", the "user" is the player that uses the item and the "target" is the entity hit with the item. This way it would be possible to do something like this:

(When mob/player hit with item:)

If has (user) in inventory item (mana)

Do

   Add potion effect (poison) to (target)

   Remove item (mana) from (user)

 

Of course these dependencies could only be used with compatible triggers, like the others. Otherwise they will simply stay "entity" like default.

This isn't very important but would make events more dynamic.

Attachment Size
sourceandtarget.PNG29 KB 29 KB

Issue comments

This is a very nice idea, but I am not sure how to implement this in UI. Right now, entity blocks automatically add new dependency entity. If we wanted to add support for multiple entities, there would need to be some kind of selector on which entity to use or two types of block depending on the target.

I will think on how to implement this and I also accept ideas here. But we will definitely implement this in later updates.

Maybe for each event you add a define parameter to show which entity values will be changed/returned from. 

Yeah, this will help me with bosses, as if i use the trigger [When mob die], Add achievement

It won't add the achievement to player but to the mob die so it would be useful

I have an idea on how to implement it in UI.
First of all, in the dropdown of the base block "Event trigger - triggered by external call or when (global trigger):" The options that could use multiple dependencies such as "Entity kills entity" or "Entity attacked" would look like this:
"Entity(A) kills entity(B)", "Entity(A) attacked by entity(B)"

What I mean by the As and Bs is seperate dependencies.
If an option from the dropdown such as these is chosen an unremovable block could be added, here's an example:

the image

Hope this helps.

I can not see the image. Our current plan is if like block that wraps entity blocks that should be associated with another entity.

This is similar to how we will make it, but these block will be removable so one will be able to reference only when they wanted to.

same, i need this for a really small mod i NEED to make to give sense to my zombie apocalypse survival modpack xD

This is BIGGGGGGGGGGGG!!!!!!! And will it work with ranged items too ? XD

Yes, we added this on all places where this is possible ;)

I have been waiting for this............. now I only need Gui that bind to Items and Entities XD but anyway thank you all for ALL OF THIS <3



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.