There should be an NBT boolean for if a mob is sleeping. This would assist in sorting mobs that are sleeping or not, such as Villagers.
Currently in the game, you can discern the exact position of a mob's bed, but for the purposes of simply determining whether or not a mob is sleeping, the position is unnecessary.
Practically speaking, in @e target selection, you can sort specifically by NBT tags, but not necessarily the lack thereof for integers. You can use ! to check if an integer NBT is not a specific value, but it'll still pass any other value.
/effect give @e[type=minecraft:villager,nbt={SleepingY:64}] minecraft:glowing 10
This would give every villager sleeping at Y 64 the glowing effect, but there's no easy way to sort by villagers that are sleeping, regardless of their Y level. My proposition would be something along the lines of a boolean named "IsSleeping" so that you can easily check between if they're sleeping, 1, or if they aren't, 0.
For example, to sort for villagers that aren't sleeping:
/effect give @e[type=minecraft:villager,nbt={IsSleeping:0b}] minecraft:glowing 10
This would give every non-sleeping villager the glowing effect, and with this boolean, you'd be able to target select any villager depending on their sleeping status, not their exact sleeping position.
Please sign in to leave a comment.
0 Comments