Started by
Daniel1123
on
Topic category: Help with Minecraft modding (Java Edition)
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???
...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.