Java 类net.minecraftforge.event.entity.player.PlayerWakeUpEvent 实例源码

项目:sprinkles_for_vanilla    文件:PlayerHandlers.java   
@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);
    }*/
}
项目:AdventureBackpack2    文件:PlayerEventHandler.java   
@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);
    }
}
项目:geomastery    文件:PlayerEvents.java   
/** 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());
    }
}
项目:Event-Tweaks    文件:SleepingEventHandler.java   
@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..."));
    }
}
项目:Cyclic    文件:ItemSleepingMat.java   
@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);
  }
}
项目:CustomWorldGen    文件:ForgeEventFactory.java   
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn)
{
    MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn));
}
项目:Progression    文件:TriggerSleep.java   
@SubscribeEvent
public void onPlayerWakeup(PlayerWakeUpEvent event) {
    ProgressionAPI.registry.fireTrigger(event.getEntityPlayer(), getProvider().getUnlocalisedName());
}