List of usage examples for net.minecraftforge.event.entity.player PlayerSleepInBedEvent getResultStatus
public SleepResult getResultStatus()
From source file:com.lothrazar.cyclicmagic.item.sleep.ItemSleepingMat.java
License:Open Source License
/** * hack in the vanilla sleep test, or at least something similar * /* w w w . j av a2 s.c o m*/ * @param player * @param world * @return */ private SleepResult canPlayerSleep(EntityPlayer player, World world) { if (player.isEntityAlive() == false) { return EntityPlayer.SleepResult.OTHER_PROBLEM; } if (world.isDaytime()) { return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW; } PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, player.getPosition()); MinecraftForge.EVENT_BUS.post(event); if (event.getResultStatus() != null) { return event.getResultStatus(); } return EntityPlayer.SleepResult.OK; }