use of net.minecraftforge.event.entity.player.SleepingTimeCheckEvent in project MinecraftForge by MinecraftForge.
the class ForgeEventFactory method fireSleepingTimeCheck.
public static boolean fireSleepingTimeCheck(Player player, Optional<BlockPos> sleepingLocation) {
SleepingTimeCheckEvent evt = new SleepingTimeCheckEvent(player, sleepingLocation);
MinecraftForge.EVENT_BUS.post(evt);
Result canContinueSleep = evt.getResult();
if (canContinueSleep == Result.DEFAULT)
return !player.level.isDay();
else
return canContinueSleep == Result.ALLOW;
}
Aggregations