@SubscribeEvent public void onWakeUp(PlayerWakeUpEvent event) { boolean willSleep = event.setSpawn; EntityPlayer player = event.entityPlayer; if (!willSleep && playersToNotSetSpawn.get(player.getPersistentID()) != null) { playersToNotSetSpawn.remove(player.getUniqueID()); } /*else if (!Settings.playerChecksBedRespawn[1]) { LogHelper.info("Forcing bed spawn location"); ChunkCoordinates bedLocation = player.getBedLocation(player.dimension); player.setSpawnChunk(bedLocation, true); }*/ }
@SubscribeEvent public void playerWokeUp(PlayerWakeUpEvent event) { if (event.entity.worldObj.isRemote) return; ChunkCoordinates bedLocation = event.entityPlayer.getBedLocation(event.entityPlayer.dimension); if (bedLocation != null && event.entityPlayer.worldObj.getBlock(bedLocation.posX, bedLocation.posY, bedLocation.posZ) == ModBlocks.blockSleepingBag) { //If the player wakes up in one of those super confortable SleepingBags (tm) (Patent Pending) BackpackProperty.get(event.entityPlayer).setForceCampFire(true); LogHelper.info("Player just woke up in a sleeping bag, forcing respawn in the last lighted campfire, if there's any"); } else { //If it's a regular bed or whatever BackpackProperty.get(event.entityPlayer).setForceCampFire(false); } }
/** Adds behaviour when player wakes up from a bed. */ @SubscribeEvent public void playerWakeUp(PlayerWakeUpEvent event) { if (!event.shouldSetSpawn()) { return; } EntityPlayer player = event.getEntityPlayer(); BlockPos pos = new BlockPos(player); World world = event.getEntityPlayer().world; IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (!(block instanceof BlockBed) || world.isRemote) { return; } BlockPos posFoot = state.getValue(BlockBed.PART) == EPartBed.FOOT ? pos : pos.offset(state.getValue(BlockBed.FACING).getOpposite()); BlockBed bed = (BlockBed) block; bed.onWakeup(world, posFoot, (TEBed) world.getTileEntity(posFoot)); if (GeoConfig.gameplay.food) { player.getCapability(GeoCaps.CAP_PLAYER, null) .sleep(bed.getHealAmount()); } }
@SubscribeEvent public void PlayerWakeUpEvent(PlayerWakeUpEvent e){ if(!e.getEntity().getEntityWorld().isRemote && ConfigurationFile.sleepingHealValue > 0.0f && !e.updateWorld()) { e.getEntityPlayer().heal(ConfigurationFile.sleepingHealValue); e.getEntityPlayer().addChatComponentMessage(new TextComponentTranslation("You feel refreshed...")); } }
@SubscribeEvent public void onWakeUp(PlayerWakeUpEvent evt) { EntityPlayer p = evt.getEntityPlayer(); final IPlayerExtendedProperties sleep = p.getCapability(ModCyclic.CAPABILITYSTORAGE, null); if (sleep != null && sleep.isSleeping()) { sleep.setSleeping(false); } }
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn) { MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn)); }
@SubscribeEvent public void onPlayerWakeup(PlayerWakeUpEvent event) { ProgressionAPI.registry.fireTrigger(event.getEntityPlayer(), getProvider().getUnlocalisedName()); }