Help, how to make an entity that sleeps at night?

Started by Daniel1123 on

Topic category: Help with modding (Java Edition)

Last seen on 19:06, 7. Feb 2024
Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help, how to make an entity that sleeps at night?

how to make an entity that goes to bed at night and goes to sleep?? - not using the entity base vilager option! Is it possible to use custom code for this purpose???

Last seen on 18:36, 16. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
...Maybe? It depends on if…
Tue, 11/07/2023 - 05:01

...Maybe? It depends on if you just want it to sleep like foxes, or use a bed like villagers.

Either way, you could probably use some variety of the 'make entity pathfind to x/y/z' function, and a 'search for block in 6*6*6 box' procedure template to search for a bed nearby and force the entity to pathfind to it, then transform the entity into a sleeping variant of itself by spawning in a new variant and despawning the original entity. This isn't a great solution, and will likely be a bit janky, (anything involving pathfinding will be janky), but it might be worth a try. I don't think you'd need custom code for this, though it might help.