Interface EntitySleepEvents.AllowSleeping

Enclosing class:
EntitySleepEvents
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface EntitySleepEvents.AllowSleeping
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.entity.player.PlayerEntity.SleepFailureReason
    allowSleep(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.math.BlockPos sleepingPos)
    Checks whether a player can start sleeping in a bed-like block.
  • Method Details

    • allowSleep

      @Nullable net.minecraft.entity.player.PlayerEntity.SleepFailureReason allowSleep(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.math.BlockPos sleepingPos)
      Checks whether a player can start sleeping in a bed-like block.
      Parameters:
      player - the sleeping player
      sleepingPos - the future sleeping position of the entity
      Returns:
      null if the player can sleep, or a failure reason if they cannot
      See Also:
      • PlayerEntity.trySleep(BlockPos)