#Entity X spawns -> event Y triggers

20 messages · Page 1 of 1 (latest)

barren mural
#

How to make it check condition entity x spawns so I can then call an event (not the other way around)

wiki don say shi

naive pineBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

barren mural
#

Before Id just do onEvent('EntitySpawned', event => {})

#

But now I cant

#

Cause the format changed

#

And now I need to know the specific event category name

#

And the wiki is literally empty

wicked helm
#

The event you are looking for is called:
EntityEvents.spawned(<modid:entityName>, event => {})

I recommend using ProbeJS so it shows the methods & events in VS Code

#

Also you don’t need the modid thing but it’s handy if you want to check for just one entity type like
minecraft:zombie

barren mural
#

Which way would be most optimized?

#

If that is relevant (i think it is for optimization reasons), yes, the event I want to call for when EntityX spawns is the spawning of an EntityY.

#

What is the better way to structure the picking of a randomized block within a numerically set nearby-range area in that case?

#

Cause the script is going to trigger many times in short timeframes.

#

I really dont wanna impede performance with this.

barren mural
valid haven
#

Easiest why would be to generate the coordinate by choosing a random number between -5 and 5 and then adding that to the coordinate

barren mural
#

That is also super helpful