Spawn entities at server start


#1

Hi i try to spawn “shop keeper” entities at server start.
The problem is they dont get spawned, or despawn immediately. i cant see them.
If i spawn them with a command it works.
If i spawn them with the ClientConnectionEvent.Join it also works.

My code looks like this:
https://pastebin.com/xF88YLv0


#2

Well if I had to guess, I would recommend trying on world load, it game started or something. Have you checked if the world is actually fully loaded at that stage?


#3

The entity doesnt spawn. If i try to get the UUID of the entity in the world, right after i spawned it, its return Empty


#4

Again, I believe that the world had not yet loaded, therefore the entire can’t spawn… try using the SERVER_STARTED event. That event guarantees that the server is fully initialized and that all worlds are loaded.


#5

Im already using GameStartedServerEvent if we speak of the same one.


#6

Its solved, i had to load the chunk before spawning the Entity


#7

Sorry, my bad… I was running on way to little sleep, and somehow totally misread your post.