• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PlayerWakeUpEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraftforge.event.entity.player.PlayerWakeUpEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerWakeUpEvent类的具体用法?Java PlayerWakeUpEvent怎么用?Java PlayerWakeUpEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlayerWakeUpEvent类属于net.minecraftforge.event.entity.player包,在下文中一共展示了PlayerWakeUpEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onWakeUp

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
@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);
    }*/
}
 
开发者ID:VikeStep,项目名称:sprinkles_for_vanilla,代码行数:17,代码来源:PlayerHandlers.java


示例2: playerWokeUp

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:17,代码来源:PlayerEventHandler.java


示例3: playerWakeUp

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
/** 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());
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:33,代码来源:PlayerEvents.java


示例4: PlayerWakeUpEvent

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
@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..."));
    }
}
 
开发者ID:baileyholl,项目名称:Event-Tweaks,代码行数:8,代码来源:SleepingEventHandler.java


示例5: onWakeUp

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:9,代码来源:ItemSleepingMat.java


示例6: onPlayerWakeup

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn)
{
    MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:ForgeEventFactory.java


示例7: onPlayerWakeup

import net.minecraftforge.event.entity.player.PlayerWakeUpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerWakeup(PlayerWakeUpEvent event) {
    ProgressionAPI.registry.fireTrigger(event.getEntityPlayer(), getProvider().getUnlocalisedName());
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:5,代码来源:TriggerSleep.java



注:本文中的net.minecraftforge.event.entity.player.PlayerWakeUpEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NorwegianLightStemFilter类代码示例发布时间:2022-05-22
下一篇:
Java ValidationError类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap