Jump to content

[1.15] Spawning monsters/entities at daytime on the surface


Recommended Posts

In a way I have found a workaround for this problem, but it just doesn't quite work the way I would like it to. My plan is to spawn my custom entities on the surface of my custom dimension during daytime. So far so good. After figuring out, that entities are initialized after Biomes, I instead registered them into the biome spawn lists of my custom biomes (in a custom dimension) in the FMLCommonSetupEvent. This also works, as my entities now spawn, but only underground. As this wasn't the desired result, I read into this deeper and figured out, that I can use EntitySpawnPlacementRegistry.register to tell the game when it actually is appropriate to spawn my entity. Since I just wanted to get this to work, I just returned true in a custom method for this at all times. Still didn't work, only underground spawning. My (somewhat) working workaround is to use LivingSpawnEvent.CheckSpawn and allow any and all spawns. This sort of works, but it spams entities pretty hard, as it just allows any and all spawns. Surely there is a better way to make this work properly? I also have another different MonsterEntity that I want to spawn on the surface (but this time only the surface). With this one I only registered it as a creature, not as a monster and once again just allowed any and all entities above a certain y level to spawn. Barely any entities seem to spawn though, or atleast they seem to immediately despawn again, since the console claims to have spawned them, but when I actually go to the aledged coords nothing is actually there. I even tried to change them to AnimalEntities (since these seem to be handled differently from monsters) but still no luck. I also fiddled with disallowing despawns, some (probably all) of the despawn methods in the entity class (that seem to control whether an entity is allowed to despawn) but that didn't change anything either, still next to no entities to be seen anywhere, very rarely I can spot a single group of the custom entity. But as I said, this all is just a workaround and the only way to make it work (semi) properly is to spawn the entity as monsters, which then again spams it super hard, so it's either almost no entities or way too many with no real way of controlling it.

My questions are: First of all I guess how do I properly get any (custom!) entity to spawn on the surface of my custom biome (in my custom dimension), as even AnimalEntities seem to not properly want to do that, and after that, how do I get a MonsterEntity to spawn that way (eventhough I'm sure that one isn't even really necessary, as I can theoretically just change the entities into AnimalEntities or something)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.