jodeks-datapacks / Sleep

Simple Multiplayer Sleep
https://modrinth.com/datapack/sleep
Other
2 stars 0 forks source link

1.19.2 backport #3

Closed ja-cop closed 3 months ago

ja-cop commented 4 months ago

Hello, thanks for publishing this cool datapack as open source! :slightly_smiling_face: I'm running a server based on Minecraft 1.19.2 and I'd love to use this. I know it's not marked as compatible, but I tested it anyway and indeed it doesn't seem to work.

I'm new to datapacks, but are there any blockers for backporting this to 1.19? If you don't have any plans for supporting older versions - which would be perfectly understandable - any tips for a newbie for what I'd need to change?

Jodekq commented 4 months ago

Hey there, Im glad you like the pack! I can do a backport for 1.19.2! I'll be back home in 3 days so I'll most likely publish it here and on modrinth any time next week.

Jodekq commented 3 months ago

Hey there, I just uploaded the version on modrinth: https://modrinth.com/datapack/sleep/version/v.1.0.0 If anything doesn't work, let me know (when I tested it, everything worked but you never know...)

ja-cop commented 3 months ago

Awesome, thanks! I gave it a quick try just now, and it seems to be working!

How does this interact with the playersSleepingPercentage gamerule? I had it set to 30%, and that seemed to prevent the night from passing even when I was alone on the server. Setting it to 100% seems to have allowed the night to pass, but I haven't tested with more players yet.

Jodekq commented 3 months ago

The datapack sets the playersSleepingPercentage gamerule too 101, so the night cannot be passed. What Im doing with the pack is that I look how long a player is in a bed and then I add 11000 to the time when he was the configured amount of time in the bed --> then it's morning and the player gets kicked out of the bed. TL;DR The datapack needs the gamrule to be any over 100 to work

ja-cop commented 3 months ago

I can't quite get it to work. I set &amount_to_sleep to 3 and the playersSleepingPercentage gamerule to 101, but it still requires both players sleep when there are two players online.

Actually, I can't get the night to be passed with fewer than all players sleeping, no matter what I set these values to. I'll do more testing.

Jodekq commented 3 months ago

Hmm that sounds weird. When I test it (replicating like you said, 2 players and &amount_to_sleep set to 3) it works so only 1 player has to sleep. Try to do /function sleep:uninstall and then /reload _Then you have to set &amount_to_sleep back to 3_

ja-cop commented 3 months ago

Alright, I managed to get it to work! I have to explicitly set both &time_control (I used 0) and &time_until_skip (I used 2). Is that intentional? The Modrinth description gave me the impression that the stated default values would be used if these config variables were left unset.

FWIW, I've been testing around in fresh vanilla instances of both 1.19.2 and 1.21 and I get the same behavior in both.

Jodekq commented 3 months ago

No, you do not have to set these value on your own. The default values from the modrinth description are set when you first load the datapack.