Started by
guy.24
on
Topic category: Help with Minecraft modding (Java Edition)
Im new to this and i don't know if this is the right place for this but here i go. I want to make a item when right clicked it will kill a entity in a radius then give the player a item. What i made was If a player is holding item then Do kill the entity in a radius, and i want a procedure to activate only if i killed that entity. Any ideas?
And sorry for my bad grammar
You might have to wait on this one. If you look in MCreator's changelog, you can see that they are actually adding a block for just this purpose that can detect entities in a given radius. Unfortunately, you will at least have to wait until the snapshots to use that feature. Without this, I don't know of any way to accomplish what you're asking.
You can easily do that by creating a logic global variable that will be true when right clicking the item, then you need a procedure on player tick update that will get players coordinates and save them as number global variables PosX, PosY and PosZ. Then on this entity on entity tick update verify if player is near by the mathmatical distance formula in 3 dimensions (easily find on google) and if the logic global variable is true, then kill the entity.
Thanks