Morpheus doesn't actually wake players when a new day starts, it only sets the day time.
This causes players to instead wake up automatically on the next tick as they're in a bed while its day.
This isn't good, and causes the GT5-Unofficial buff you get after sleeping to not be awarded.
This uses an Accessor mixin to call wakeAllPlayers. Because this has to run early but the actual Morpheus fix has to run late, they're split into two mixins.
Maybe reorganize the Accessor mixin to be in the general/minecraft section instead of Morpheus (+change description)? Not sure; this is my first hodgepodge PR
Transforms the Morpheus Method
private void advanceToMorning(World world) {
try {
((INewDayHandler)MorpheusRegistry.registry.get(world.provider.dimensionId)).startNewDay();
} catch (Exception var3) {
Morpheus.mLog.error("Exception caught while starting a new day for dimension " + world.provider.dimensionId);
}
if (!(Boolean)this.alertSent.get(world.provider.dimensionId)) {
this.alertPlayers(new ChatComponentText(DateHandler.getMorningText()), world);
((WorldSleepState)Morpheus.playerSleepStatus.get(world.provider.dimensionId)).wakeAllPlayers();
this.alertSent.put(world.provider.dimensionId, true);
}
world.provider.resetRainAndThunder();
}
into the equivalent of
private void advanceToMorning(World world) {
try {
((INewDayHandler)MorpheusRegistry.registry.get(world.provider.dimensionId)).startNewDay();
} catch (Exception var3) {
Morpheus.mLog.error("Exception caught while starting a new day for dimension " + world.provider.dimensionId);
}
if (!(Boolean)this.alertSent.get(world.provider.dimensionId)) {
this.alertPlayers(new ChatComponentText(DateHandler.getMorningText()), world);
((WorldSleepState)Morpheus.playerSleepStatus.get(world.provider.dimensionId)).wakeAllPlayers();
this.alertSent.put(world.provider.dimensionId, true);
}
/* Inject Start */
if (world instanceof WorldServer worldServer) {
worldServer.wakeAllPlayers();
return;
}
/* Inject End */
world.provider.resetRainAndThunder();
}
The return before the call to resetRainAndThunder is intentional, as wakeAllPlayers also calls resetRainAndThunder
Tested ingame to verify that it works. The behavior is now
If Morpheus partial sleeping starts a new day, all players that were in a bed when the new day was started will get the buff
Normal sleeping without morpheus kicking in remains as it was before
Exiting a bed manually still correctly doesn't award the buff
Closes https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/16893
Morpheus doesn't actually wake players when a new day starts, it only sets the day time. This causes players to instead wake up automatically on the next tick as they're in a bed while its day. This isn't good, and causes the
GT5-Unofficial
buff you get after sleeping to not be awarded.This uses an Accessor mixin to call
wakeAllPlayers
. Because this has to run early but the actual Morpheus fix has to run late, they're split into two mixins. Maybe reorganize the Accessor mixin to be in the general/minecraft section instead of Morpheus (+change description)? Not sure; this is my first hodgepodge PRTransforms the Morpheus Method
into the equivalent of
The return before the call to
resetRainAndThunder
is intentional, aswakeAllPlayers
also callsresetRainAndThunder
Tested ingame to verify that it works. The behavior is now