Class CitizenSleepHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenSleepHandler
- All Implemented Interfaces:
ICitizenSleepHandler
Handles the sleep of the citizen.
-
Constructor Summary
ConstructorsConstructorDescriptionCitizenSleepHandler(AbstractEntityCitizen citizen) Constructor for the experience handler. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.BlockPosGet the bed location of the citizen.booleanisAsleep()Is the citizen a sleep?voidonWakeUp()Called when the citizen wakes up.booleanWhether we should start to go sleepingbooleantrySleep(net.minecraft.core.BlockPos bedLocation) Attempts a sleep interaction with the citizen and the given bed.
-
Constructor Details
-
CitizenSleepHandler
Constructor for the experience handler.- Parameters:
citizen- the citizen owning the handler.
-
-
Method Details
-
isAsleep
public boolean isAsleep()Is the citizen a sleep?- Specified by:
isAsleepin interfaceICitizenSleepHandler- Returns:
- true when a sleep.
-
trySleep
public boolean trySleep(net.minecraft.core.BlockPos bedLocation) Attempts a sleep interaction with the citizen and the given bed.- Specified by:
trySleepin interfaceICitizenSleepHandler- Parameters:
bedLocation- The possible location to sleep.- Returns:
- if successful.
-
onWakeUp
public void onWakeUp()Called when the citizen wakes up.- Specified by:
onWakeUpin interfaceICitizenSleepHandler
-
getBedLocation
public net.minecraft.core.BlockPos getBedLocation()Get the bed location of the citizen.- Specified by:
getBedLocationin interfaceICitizenSleepHandler- Returns:
- the bed location.
-
shouldGoSleep
public boolean shouldGoSleep()Description copied from interface:ICitizenSleepHandlerWhether we should start to go sleeping- Specified by:
shouldGoSleepin interfaceICitizenSleepHandler- Returns:
- true if should sleep
-