Package net.minecraft.server.world
Class SleepManager
java.lang.Object
net.minecraft.server.world.SleepManager
A sleep manager allows easy tracking of whether nights should be skipped
 on a server world.
- Mappings:
- Namespace - Name - named - net/minecraft/server/world/SleepManager- intermediary - net/minecraft/class_5838- official - avg
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanResetTime(int percentage, List<ServerPlayerEntity> players) Returns if the night can actually be skipped at the tick this is called.booleancanSkipNight(int percentage) Returns if the number of sleeping players has reached apercentageout of all players.voidResets the number of sleeping players to 0.intgetNightSkippingRequirement(int percentage) Returns the number of sleepers needed to skip a night with the givenpercentage.intReturns the number of sleeping players.booleanupdate(List<ServerPlayerEntity> players) Updates the sleeping player and total player counts.
- 
Field Details- 
totalprivate int totalThe total number of players in a server world.- Mappings:
- Namespace - Name - Mixin selector - named - total- Lnet/minecraft/server/world/SleepManager;total:I- intermediary - field_28866- Lnet/minecraft/class_5838;field_28866:I- official - a- Lavg;a:I
 
- 
sleepingprivate int sleepingThe number of players sleeping in a server world.- Mappings:
- Namespace - Name - Mixin selector - named - sleeping- Lnet/minecraft/server/world/SleepManager;sleeping:I- intermediary - field_28867- Lnet/minecraft/class_5838;field_28867:I- official - b- Lavg;b:I
 
 
- 
- 
Constructor Details- 
SleepManagerpublic SleepManager()
 
- 
- 
Method Details- 
canSkipNightpublic boolean canSkipNight(int percentage) Returns if the number of sleeping players has reached apercentageout of all players.This allows initiating the night sleeping process, but still needs players to have slept long enough (checked in canResetTime) to actually skip the night. - Parameters:
- percentage- the percentage of players required, as obtained from the game rule
- Mappings:
- Namespace - Name - Mixin selector - named - canSkipNight- Lnet/minecraft/server/world/SleepManager;canSkipNight(I)Z- intermediary - method_33812- Lnet/minecraft/class_5838;method_33812(I)Z- official - a- Lavg;a(I)Z
 
- 
canResetTimeReturns if the night can actually be skipped at the tick this is called.This is usually tested after canSkipNight, which is less performance intensive to check. - Parameters:
- percentage- the percentage of players required, as obtained from the game rule
- players- the list of all players in a world where the night would be skipped
- Mappings:
- Namespace - Name - Mixin selector - named - canResetTime- Lnet/minecraft/server/world/SleepManager;canResetTime(ILjava/util/List;)Z- intermediary - method_33813- Lnet/minecraft/class_5838;method_33813(ILjava/util/List;)Z- official - a- Lavg;a(ILjava/util/List;)Z
 
- 
getNightSkippingRequirementpublic int getNightSkippingRequirement(int percentage) Returns the number of sleepers needed to skip a night with the givenpercentage.- Parameters:
- percentage- the percentage of players required, as obtained from the game rule
- Mappings:
- Namespace - Name - Mixin selector - named - getNightSkippingRequirement- Lnet/minecraft/server/world/SleepManager;getNightSkippingRequirement(I)I- intermediary - method_33816- Lnet/minecraft/class_5838;method_33816(I)I- official - b- Lavg;b(I)I
 
- 
clearSleepingpublic void clearSleeping()Resets the number of sleeping players to 0.- Mappings:
- Namespace - Name - Mixin selector - named - clearSleeping- Lnet/minecraft/server/world/SleepManager;clearSleeping()V- intermediary - method_33811- Lnet/minecraft/class_5838;method_33811()V- official - a- Lavg;a()V
 
- 
getSleepingpublic int getSleeping()Returns the number of sleeping players.- Mappings:
- Namespace - Name - Mixin selector - named - getSleeping- Lnet/minecraft/server/world/SleepManager;getSleeping()I- intermediary - method_33815- Lnet/minecraft/class_5838;method_33815()I- official - b- Lavg;b()I
 
- 
updateUpdates the sleeping player and total player counts.- Parameters:
- players- the list of all players in a server world
- Returns:
- trueif the sleeping players or total players have changed
- Mappings:
- Namespace - Name - Mixin selector - named - update- Lnet/minecraft/server/world/SleepManager;update(Ljava/util/List;)Z- intermediary - method_33814- Lnet/minecraft/class_5838;method_33814(Ljava/util/List;)Z- official - a- Lavg;a(Ljava/util/List;)Z
 
 
-