Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport playersSleepingPercentage gamerule and implement #162

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Cleptomania
Copy link
Member

This backports the gamerule playersSleepingPercentage from Minecraft 1.17+, and adds an implementation for that with a mixin. It produces chat outputs identical to that of Morpheus.

With this merged, assuming we keep it enabled by default like it is in the PR currently, we will want to remove Morpheus from the pack, as this will potentially conflict with it's functionality. (get outta here ARR mods)

This will also conflict with the feature in Et Futurum Requiem, players installing both will need to disable this feature in one of the mods. We could potentially add a check to see if it's installed and enabled in Et Futurum Requiem here(or maybe vice versa in EFR).

@Cleptomania
Copy link
Member Author

Cleptomania commented Dec 18, 2024

This is now disabled by default for the time being, to keep default compatibility with EFR, however we will want to change this to be enabled in the GTNH specific config by default.

It will also ignore AFK players in the percentage calculation of players sleeping.

Copy link
Contributor

Warning: 2 uncommitted changes
#163

@Cleptomania Cleptomania requested a review from Lyfts December 18, 2024 06:37
@Cleptomania Cleptomania requested a review from Lyfts December 18, 2024 20:25
@Cleptomania
Copy link
Member Author

I've tested this on my own server now with GTNH 2.7.0. Ignoring AFK players works, and broadly everything seems to work.

@@ -23,7 +22,10 @@ public enum Mixins {
REPLACE_TAB_NAMES(new Builder("Replace tab menu names").addTargetedMod(VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).addMixinClasses("forge.MixinGuiIngameForge")),
VANILLA_TP_BACK_COMPAT(new Builder("/back compat for the vanilla /tp").addTargetedMod(VANILLA).setSide(Side.BOTH)
.setPhase(Phase.EARLY).setApplyIf(() -> commands.back).addMixinClasses("minecraft.MixinCommandTeleport")),;
.setPhase(Phase.EARLY).setApplyIf(() -> commands.back).addMixinClasses("minecraft.MixinCommandTeleport")),
PLAYERS_SLEEPING_PERCENTAGE(new Builder("Player Sleeping Percentage").addTargetedMod(VANILLA).setSide(Side.BOTH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a scenario where this feature is useful in SP since the mixin is also applied client-side?
I'm not a big fan of it printing two additional chat messages whenever you sleep in SP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe Open to lan

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to apply on both in order to work with open to lan? I don't particularly care about supporting that feature, but that's the only use case I can think of. Otherwise it could be changed to server only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning off the chat notifications when there's only one player present could also work to prevent unnecessary messages in SP, but I don't really care much for lan either so changing it to server only is also fine by me.

@Lyfts
Copy link
Member

Lyfts commented Jan 17, 2025

@Cleptomania any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants