Entity killed by player procedure trigger

Published by WeswePengu on Mon, 11/12/2018 - 00:56
Upvotes: 0
Issue description

Running 1.8.1 (see screenshot)

 

Before updating to 1.8.1 I added a loot system to my mod using procedures, which also sends a message to the player telling them they got something and playing a sound effect as well. What is weird is that the sound effect will play perfectly but no item will be added to the player and no message will be sent to the player. This was working perfectly in 1.8.0 but after updating to 1.8.1 it seems to not work anymore.

Everything is explained through the MCR and Screenshot I attached.

MCR Instructions: Check mod element named: EngramDropEvent

 

Edit: Tried recreating procedure after updating to 1.8.1, made no difference, still an issue.

Edit 2: Added Loot System Procedure for analysis purposes.

Edit 3: Can confirm that "add 1 item to inventory" and "send message to player" events work when trigger is set to "when block is broken" Makes me wonder if the issue is related to trigger types, still remembering "play sound events" work under "when entity is killed" trigger, while "add 1 item to inventory" and "send message to player" events do not work under "when entity is killed" trigger.

Attachment Size
Screenshot showing Procedure232.16 KB 232.16 KB
Procedure in question5.72 KB 5.72 KB

Issue comments

In 1.8.1 we improved the procedure global trigger to better reflect their names. Now, the entity dependency of this trigger is the entity that is being killed, not the source of the killing. We can add new procedure trigger called Player kills entity, where the entity dependency would be the player, not the entity killed.

You hear the sound of this entity, but the message and items are shown to the entity you kill.

I am changing this to a feature request for a new trigger called Player kills entity. If this is not what you meant, please correct me.

Okay that makes sense to me! Glad to hear its an actual feature and not a bug! Changing this to a feature request is fine with me! Really hope to see this new trigger really soon for the sake of all loot systems!

Thank you very much!

 

Ok, I will add new procedure trigger called Player kills entity, where the entity dependency would be the player, not the entity killed in the future updates.

Current workaround:

In the procedure, inside function onEntityAttacked, replace this line:

Entity entity=event.getEntity();

with

Entity entity=event.getSource().getTrueSource();

and the trigger will work as it used in 1.8.0.

I felt this was at least somewhat relevant as I'm using this knowledge in my mod to have mobs when killed with a certain sword drop a certain item. I'm able to get mobs to drop this certain item; however, I only want certain mobs to drop this item, and when I tried to do this it didn't work. Any help on how to do this would be appreciated.

We have added a new procedure trigger called Entity kills entity. This one represents entity dependency as the entity which killed another entity, not the killed entity itself.

On entity dies trigger has been improved too as right now it did not trigger if the event source was unknown.

This feature will be added in MCreator 1.8.2. I am closing this ticket.