List of usage examples for net.minecraftforge.event.entity.player PlayerSleepInBedEvent setResult
public void setResult(SleepResult result)
From source file:com.lothrazar.cyclicmagic.item.sleep.ItemSleepingMat.java
License:Open Source License
@SubscribeEvent public void handleSleepInBed(PlayerSleepInBedEvent event) { EntityPlayer p = event.getEntityPlayer(); final IPlayerExtendedProperties sleep = p.getCapability(ModCyclic.CAPABILITYSTORAGE, null); if (sleep != null && sleep.isSleeping()) { event.setResult(EntityPlayer.SleepResult.OK); }/*from www .j a va 2 s .com*/ }
From source file:necauqua.mods.cm.Handlers.java
License:Apache License
@SubscribeEvent public void onPlayerSleepInBed(PlayerSleepInBedEvent e) { EntityPlayer player = e.getEntityPlayer(); float size = getSize(player); if (size < 1.0F) { e.setResult(TOO_SMALL); player.addChatComponentMessage(new TextComponentTranslation("chiseled_me.bed.too_small")); } else if (size > 1.0F) { e.setResult(TOO_BIG);/*w w w . j a v a 2 s. c o m*/ player.addChatComponentMessage(new TextComponentTranslation("chiseled_me.bed.too_big")); } }
From source file:valkyrienwarfare.mod.event.EventsCommon.java
License:Open Source License
@SubscribeEvent() public void onPlayerSleepInBedEvent(PlayerSleepInBedEvent event) { EntityPlayer player = event.getEntityPlayer(); BlockPos pos = event.getPos();/*from ww w . ja v a 2 s .c o m*/ PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(player.world, pos); if (wrapper != null) { if (player instanceof EntityPlayerMP) { EntityPlayerMP playerMP = (EntityPlayerMP) player; player.sendMessage(new TextComponentString("Spawn Point Set!")); player.setSpawnPoint(pos, true); event.setResult(SleepResult.NOT_POSSIBLE_HERE); } } }