(Solved) Time of Day Spawning

Started by artician on

Topic category: Help with modding (Java Edition)

Last seen on 21:56, 11. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(Solved) Time of Day Spawning
Sat, 08/08/2020 - 01:30 (edited)

Hi, I just picked up this editor and have watched a couple tutorial videos.  The objective I have is really simple but I can't see a way to implement it.  I just want to spawn mobs on the surface, but only at night.
I think I can assign the Mob Spawning Type attribute to "creature" to have it spawn on the surface, but I see no way to check for the time of day _before_ the mob spawns. 
I can't use the regular "Mob" for Mob Spawning Type because I don't want this mob to spawn underground.
I don't want to have the mob check for the time of day in one of its own behaviors because this would be bad for performance.

Can anyone recommend a solution? 

Thank you in advance!

Edited by artician on Sat, 08/08/2020 - 01:30
Last seen on 16:47, 29. Oct 2023
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This can be done using a…
Mon, 07/27/2020 - 16:05

This can be done using a procedure inside of the living entity creator. Under the spawning section, you can choose to create a procedure for entity spawning condition. Just enter what times you want them to spawn, and you should be good!

Last seen on 21:56, 11. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much for the…
Fri, 07/31/2020 - 22:13

Thank you so much for the reply.

I'm trying to implement this now using an If statement with isDayInTheProvidedWorld.  My intent is to have it spawn when that returns False, but I don't know what to call in order to have the procedure complete successfully or cancel without spawning anything.

Thank you again for your advice!  It was just as simple a solution as I was hoping for.

 

Last seen on 21:56, 11. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm so close!  I can't find…
Sat, 08/01/2020 - 23:23

I'm so close!  I can't find my answer in any of the tutorials I've watched.  Any advice?

Last seen on 21:56, 11. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For now I've used "Despawn…
Sun, 08/02/2020 - 14:54

For now I've used "Despawn Entity" in that procedure, but this suggests a really non-performant approach, as I'd not want entities to be spawning en masse just to check the time of day, and then despawning when it returned false. 

 

Going to test it but still hoping for some experienced input.

Last seen on 21:56, 11. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I got it.   Everything is…
Sat, 08/08/2020 - 01:38

I got it.   Everything is working, but I have one question which I'll pose at the bottom. 
For the solution, I wasn't able to use creature spawning rules as I started out to, as they must have a hardcoded rule not to spawn at night, even when their spawn rules say otherwise.

Similar to what Argus had recommended, I just did a bool check on IsDayInTheProvidedWorld, and despawned if true. 

I also needed them to only spawn above ground, which was the original inclination for using the Creature spawn rules.  To get around this I just followed up the daytime check with another elseIf to check Y spawn position value, and despawning the entity if it were <0.  They'll still be able to spawn within mountains, but it's a tradeoff I'm not unhappy with. 

My last question: Is there any cleaner way of not spawning an entity than using the Despawn block on its spawn procedure?  Or did I do this the right way?

Thanks for the help from the community.