Straight to Night is a simple Minecraft mod that lets you take a nap whenever you want. Usually, the game tells you that you can only sleep at night, but this mod fixes that. Now, if you click on a bed during the middle of the day or very late at night, your character will actually go to sleep.
While you are napping, the sun moves across the sky fast until it reaches sunset. It’s a great way to skip the day and reach night so you can farm mobs!
This mod is a Bedrock Edition behavior pack that bypasses Minecraft's hardcoded "You can only sleep at night" restriction. It uses the @minecraft/server scripting module to detect when a player interacts with a bed during prohibited hours, specifically when the world time is between 0–12,500 (day) or greater than 23,459 (late night). By using afterEvents.itemUseOn, the script runs its own custom sleep cycle after the vanilla game's rejection, ensuring the mod triggers reliably without being canceled by the engine.
When activated, the mod teleports the player into a fixed position on the bed and executes the animation.player.sleeping pose via the playAnimation command. The script uses system.runInterval to increment the world clock by 500 ticks per frame until it reaches sunset. During this process, the player’s movement and camera are locked using input permission to prevent the game from breaking, and because you're sleeping. Duh!
Technically, the mod is designed for maximum compatibility by utilizing runCommandAsync to handle visuals rather than relying on volatile JavaScript API functions that often break between Minecraft versions. This approach ensures that even if the Scripting API's internal methods change, the core commands for animations and time manipulation remain functional. That's it.