Jump to content

[1.12 to 1.14] Make custom mobs spawn only at night (custom biome)


Alex Sim

Recommended Posts

Hello, I'm having trouble getting a custom mob spawn at night in my custom biome.

 

Adding a spawn for a vanilla Zombie will automatically make it spawn only at night,

addSpawn(EntityClassification.MONSTER, Biome.SpawnListEntry(EntityType.ZOMBIE, 100, 5, 8))

 

but doing the same with my custom entity, which extends the ZombieEntity class and has EntityClassification.MONSTER classification will still make it spawn during the day

Link to comment
Share on other sites

It looks like spawning conditions are handled by EntitySpawnPlacementRegistry in 1.14.

 

You need to call EntitySpawnPlacementRegistry.register with your EntityType and a predicate that determines the conditions under which it can spawn. Zombies and other hostile mobs use MonsterEntity::func_223325_c for the predicate, this checks the difficulty and the light level.

Edited by Choonster
  • Thanks 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

19 minutes ago, Choonster said:

It looks like spawning conditions are handled by EntitySpawnPlacementRegistry in 1.14.

 

You need to call EntitySpawnPlacementRegistry.register with your EntityType and a predicate that determines the conditions under which it can spawn. Zombies and other hostile mobs use MonsterEntity::func_223325_c for the predicate, this checks the difficulty and the light level.

Thank you, but the register function is private inside EntitySpawnPlacementRegistry, isn't there any forge registry to handle this, or do I have to use reflection?

Link to comment
Share on other sites

3 minutes ago, Alex Sim said:

Thank you, but the register function is private inside EntitySpawnPlacementRegistry, isn't there any forge registry to handle this, or do I have to use reflection?

 

It was made public again in this PR (1.14.4-28.0.37). Update Forge.

  • Thanks 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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