Class CitizenSleepHandler

java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenSleepHandler
All Implemented Interfaces:
ICitizenSleepHandler

public class CitizenSleepHandler extends Object implements ICitizenSleepHandler
Handles the sleep of the citizen.
  • Constructor Details

    • CitizenSleepHandler

      public CitizenSleepHandler(AbstractEntityCitizen citizen)
      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:
      isAsleep in interface ICitizenSleepHandler
      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:
      trySleep in interface ICitizenSleepHandler
      Parameters:
      bedLocation - The possible location to sleep.
      Returns:
      if successful.
    • onWakeUp

      public void onWakeUp()
      Called when the citizen wakes up.
      Specified by:
      onWakeUp in interface ICitizenSleepHandler
    • getBedLocation

      public net.minecraft.core.BlockPos getBedLocation()
      Get the bed location of the citizen.
      Specified by:
      getBedLocation in interface ICitizenSleepHandler
      Returns:
      the bed location.
    • shouldGoSleep

      public boolean shouldGoSleep()
      Description copied from interface: ICitizenSleepHandler
      Whether we should start to go sleeping
      Specified by:
      shouldGoSleep in interface ICitizenSleepHandler
      Returns:
      true if should sleep