Started by
Rocketdude9611
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make it so that when I kill an entity with a certain item an overlay appears. (i don't mean the entity has the item i mean the player)
Does anyone know how to make this happen?
Use global trigger "entity dies".
Then use "item in main hand" block to check what item the player is holding.
There might be some special overlay code like an "if" statement in the actual overlay element itself that you can set it to but I'm not quite sure.
Probably a global number variable with scope of player lifetime that is set to something like 20 when you kill the entity (using the trigger and condition suggested by Peteypops13)
Then a procedure that returns logic ((number variable) > (0)) for the overlay condition.
And another procedure running on Player tick update that checks if the variable is greater than 0, and if so, decreases it by 1.
That will make the overlay appear for 1 second on killing an entity with the certain item. If you want it to be longer, you can increase the 20.
And I just realized, you'll want to update the variable for source entity instead of event/target entity in the first procedure (the kill entity, get variable to 20 procedure), both for getting the item from the player's hand and for updating the variable.