Started by
Enderwarp9
on
Topic category: Help with Minecraft modding (Java Edition)
Hello.
I wanted to make my entity spawn particles which will damage any entity inside those particles (which works) but this particle process requires me to make a timer. The only procedure in the entity class which constantly runs is the "on entity tick update". The timer requires the procedure to run constantly and that is why I need to use this procedure. Now the problem is that I don't know how I can get the attack target of my entity in this procedure since it allows only the use of target/event entity and entity iterator. Any help is appreciated (I use the 2023.1 version btw)
There is a code block for "Get entity X is targeting for attack" which should be what you need, if I am not mistaken. However I'm not really clear why you need their attack target if you are damaging all nearby entities, so perhaps I am misunderstanding.
Just, if you do use that block, make sure you check the target is not null to avoid crashes.
Now the problem is that in the "on entity tick update", every entity of the mob gets called. Do you know how I can do it so the Event/target entity is only of one entity of my custom mob class?
There is an "X is of (sub)type Y" block at the bottom of the "Logic" category.
Actually that's not exactly what I meant. You are right with the entity class but I wanted to only get one single entity from that class. But since on entity tick update calls the entire class I guess it is not possible. Instead I think I found a solution. I just made it that when the entity swings my custom sword then certain particles will spawn one after another by using the "call procedure" block and the "wait X ticks on server side". I hope it will work but I am not sure