MehVahdJukaar / sleep_tight

Other
1 stars 9 forks source link

[1.20.1] Compatibility with Hourglass? #49

Open RiscmonIngk opened 9 months ago

RiscmonIngk commented 9 months ago

Forge Version: 47.2.0 Minecraft version: 1.21.1 Sleep Tight version: 1.1.8 Hourglass version: 1.2.1.1

Steps to reproduce: Climb into bed with (R)click, Begin sleeping with Spacebar

Expected behavior: Sleeping in a bed begins time acceleration. Actual behavior: Pressing space to begin sleeping starts the sleeping animation, then stops with no acceleration, nor skipping of night/day.

PickyPixelStudio commented 8 months ago

I've both mod, and, i've the animation. BUT i can sleep over and over without restriction... nothing happens during the night, AND the home_bed_night never increase.

Edit : I also tried BetterDays( copy of Hourglass ) didn't work either. Sleep Tigh have it own tick count during night. Hourglass and BetterDays accelerate ticks during night/day. That why Sleep Tigh can't update properly it variable...

And, i don't understand why, but Cooldown_sleep can go under 0...

NB : If you disable the sleepFeatures, you the speed up animation disappear, but Sleep Tigh work fine. Like that you can use day/night lenght properly.

Hope to see a compatibility between both mod ;) (i think no... : https://github.com/MehVahdJukaar/sleep_tight/issues/14#issuecomment-1529422777 )

MehVahdJukaar commented 8 months ago

It's not easyly doable. Sleep encounters, nightmares and such all work on the assumption that player sleep is instantaneous like it is in vanilla. Hammocks too actually. Plus it's also thematically hugely in conflict as those mods give sleep a huge buff allowing it to be a free speed up for ingame mechanic as they speed ticks up

PickyPixelStudio commented 8 months ago

For the moment, we just deactivate the speed up effect, and we'll take a look here, if you found a solution. ;)

NB : To be honest, the speed up effect, is a pain, conflict with some other features, like heal/hunger cost from ScalableHealth for exemple.

AntonyCilleros commented 8 months ago

I would like to see these mods work together

MehVahdJukaar commented 8 months ago

As I've said it's not easily doable and would even go against the idea of the mod. Why wanting to have a sleep rework that makes sleeping harder and rewarding when you flat out buff the act of sleeping itself

SaltSouls commented 3 weeks ago

It's not easyly doable. Sleep encounters, nightmares and such all work on the assumption that player sleep is instantaneous like it is in vanilla. Hammocks too actually. Plus it's also thematically hugely in conflict as those mods give sleep a huge buff allowing it to be a free speed up for ingame mechanic as they speed ticks up

Why would you have these things fire on wakeImmediately instead of onSleepComplete(or whatever the Architectury equivalent is)? I get using the immediately for things like the spawning of monsters or nightmares, but the bed level/spawning of bed bugs/setting invigoration can and should all be done on complete. This would make at least half of this mod work with Hourglass right out of the box. The only thing that would need some adjustments to be done for it would be the nightmares and the hostile sleep events. You could make them have a chance to fire after the sleep timer reaches a certain value if hourglass is installed instead of firing on wakeImmediately.

As far as the why, my reasoning is always that it makes logical sense. It only makes sense that things in the would would continue to work/progress even as the player sleeps. This doesn't seem overpowered to me, as I always have it apply to everything. Hunger and potion effects included. This helps balance that out, and your mod could act as another nice balancing factor by disallowing sleeping via nightmares and bedbugs. I think these mods could play really nicely together if some time was taken to make them compatible.

Anyway, sorry about posting on this really old issue. Just felt like giving my two cents on the matter since I like both mods and wished I could use both at the same time without this one losing basically all of its functionality.

MehVahdJukaar commented 3 weeks ago

What? i dont know what you are talking about. There's no such thing as wakeImmediately or onSleepComplete. Mod uses fabric and forge events for most of its wokings. These are, on forge, PlayerSleepInBedEvent, fired when one tries to sleep, SleepingTimeCheckEvent, used to determine if player can sleep at current time, SleepFinishedTimeEvent, used to calculate the time to set when one wakes up and PlayerWakeUpEvent, fired when the player wakes up.

SaltSouls commented 3 weeks ago

It may be an older 1.19 forge event, I have even used it here. Though if it has been changed/renamed, then I'm not sure what the equivalent would be currently as nothing that I am working on as of current messes with sleeping.

EDIT: Sorry, I'm tired and got my function name confused with the event name. Disregard my previous statements. Though if you are running these on the SleepFinishedTimeEvent, then the ones being called on that event should work with Hourglass. The problem I've seen is that nothing seems to be happening when the player wakes up.

MehVahdJukaar commented 3 weeks ago

Yes but that's not how that event is supposed to be used. Read it's javadocs. It's supposed to be used to set time of when wakes up. Wake up event should be used for woken up stuff

MehVahdJukaar commented 3 weeks ago

Sleep tight is using all those events correctly. Wether other mods work with it or not depends on if they are overriding sleep system stuff, skipping those events or misusing them