qusetion about sleeping

A big new update is now available, introducing biomes, caves and much more!
Latest hotfix: (2024-02-21)
  • i noticed we have a Player.isSleeping() and Npc.isSleeping(). i know what defines the player sleeping but what defines Npc.isSleeping()?

    im asking as im working on adding a Text3D to all npcs but im worried about performance. hoping i can use the isSleeping to skip updating npcs out of draw distance.

    I will no longer be updating or developing plugins for public use!

  • I think Npc.isSleeping() is made for the Sleep of the animals in the game.

    In the Java Version, there was something like "Range", thus, the vision should be determined width, at least for 3D objects.

    Probably it will repel better the kidney with the sight to be Combined.

    But a Stale isAktive True if the Npc is in the point of view is the area of a player.

    But currently, you can maybe have the World.getAllNpcsInRange(...) the number of limit something, maybe a Player could filter out the direction of view to the rear.

    Man could also display a Timer in the Npc.Attributes Store the Checks Slowly as far as the players Wake up and turn Off when the Player is far enough away. With the Lambda loop, it is pretty good.

  • The Npc.isSleeping() method determines if the npc is literally sleeping ^^ This is intended to happen at night, but unfortunately npcs don't sleep yet - but it's on our to-do list. So until this is implemented, this method will always return false...

    However, if you just want to show a nametag above npcs, you could use the Npc.setName() method for that - this sets a custom name for a particular npc, and if it's set, the game shows it above the npc automatically (and already handles everything related to it) ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!