Java 类cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent 实例源码

项目:PopularMMOS-EpicProportions-Mod    文件:ClientProxy.java   
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{

    if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote 
          && !ClientProxy.versionChecker.isLatestVersion())
    {
        ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, 
              "http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
        ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
        ChatComponentText versionWarningChatComponent = 
              new ChatComponentText("Your EpicProportions Mod is not latest version!  Click here to update.");
        versionWarningChatComponent.setChatStyle(clickableChatStyle);
        event.player.addChatMessage(versionWarningChatComponent);
        ClientProxy.haveWarnedVersionOutOfDate = true;
    }

}
项目:PopularMMOS-EpicProportions-Mod    文件:VersionChecker.java   
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{

    if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote 
          && !ClientProxy.versionChecker.isLatestVersion())
    {
        ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, 
              "http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
        ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
        ChatComponentText versionWarningChatComponent = 
              new ChatComponentText("�4�l" + "Your EpicProportions Mod is not latest version!  Click here to update.");
        versionWarningChatComponent.setChatStyle(clickableChatStyle);
        event.player.addChatMessage(versionWarningChatComponent);
        ClientProxy.haveWarnedVersionOutOfDate = true;
    }

}
项目:MagicBees    文件:TickHandlerVersion.java   
@SubscribeEvent
public void tickStart(PlayerTickEvent evt) {
    if (evt.phase != Phase.START) {
        return;
    }
    if (ticksToPoll > 0) {
        ticksToPoll--;
        return;
    }
    ticksToPoll = TICK_POLL_INTERVAL;

    if (versionInfo.versionCheckComplete) {
        unsubscribeFromBus();

        if (updateNotificationsEnabledOrCriticalUpdate()) {
            sendNotificationToPlayer(evt.player);
        }
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Effect.java   
/** ʵ��Skill331-������֮����Ч���� */
@SubscribeEvent
public void Point_CuringFog(PlayerTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    EntityPlayer player = event.player;
    if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
        && RewriteHelper.hasSkill(player, RewriteHelper.CuringFog.id)
        && new Random().nextInt(1200) == 600
        ) {
        List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
        for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
            EntityLivingBase entity = (EntityLivingBase)iterator.next();
            if (entity.isPotionActive(Potion.blindness)) entity.removePotionEffect(Potion.blindness.id);
            if (entity.isPotionActive(Potion.confusion)) entity.removePotionEffect(Potion.confusion.id);
            if (entity.isPotionActive(Potion.digSlowdown)) entity.removePotionEffect(Potion.digSlowdown.id);
            if (entity.isPotionActive(Potion.hunger)) entity.removePotionEffect(Potion.hunger.id);
            if (entity.isPotionActive(Potion.poison)) entity.removePotionEffect(Potion.poison.id);
            if (entity.isPotionActive(Potion.weakness)) entity.removePotionEffect(Potion.weakness.id);
            if (entity.isPotionActive(Potion.wither)) entity.removePotionEffect(Potion.wither.id);          
        }
        player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.cure")));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Effect.java   
/** ʵ��Skill332-������֮����Ч���� */
@SubscribeEvent
public void Point_HealingFog(PlayerTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    EntityPlayer player = event.player;
    if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
        && RewriteHelper.hasSkill(player, RewriteHelper.HealingFog.id)
        && new Random().nextInt(2400) == 800
        ) {
        List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
        for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
            EntityLivingBase entity = (EntityLivingBase)iterator.next();
            entity.addPotionEffect(new PotionEffect(Potion.heal.id, 1, 0));
        }
        player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.heal")));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Effect.java   
/** ʵ��Skill333-���˺�֮����Ч���� */
@SubscribeEvent
public void Point_HurtingFog(PlayerTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    EntityPlayer player = event.player;
    if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
        && RewriteHelper.hasSkill(player, RewriteHelper.HurtingFog.id)
        && new Random().nextInt(2400) == 1600
        ) {
        List entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX-3.0D, player.posY-2.0D, player.posZ-3.0D, player.posX+3.0D, player.posY+2.0D, player.posZ+3.0D));
        for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
            EntityLivingBase entity = (EntityLivingBase)iterator.next();
            if (!entity.equals(player)) entity.attackEntityFrom(DamageSource.causePlayerDamage(player), 10.0F);
        }
        player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.hurt")));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Effect.java   
/** �������Skill343-��ŷ������������ŷ�������� */
@SubscribeEvent
public void Point_AuroraAutoRecover(PlayerTickEvent event) {
    if (event.phase == Phase.END) {
        return;
    }

    EntityPlayer player = event.player;
    if (!player.worldObj.isRemote // ����¼�ֻ�����ڷ�����
        && RewriteHelper.hasSkill(player, RewriteHelper.AuroraRegeneration.id)
        && new Random().nextInt(6000) == 3000
        ) {
        RewriteHelper.modifyAuroraPoint(player, 1);
        player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.aurorarecovery")));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill100-�������ɶ������ٶ�Buff */
@SubscribeEvent
public void Point_AutoSpeedUp(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.HuntingRhythm.id)
        && !player.isPotionActive(Potion.moveSpeed)
        ) {
        List entities = player.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(player.posX-8.0D, player.posY-2.0D, player.posZ-8.0D, player.posX+8.0D, player.posY+2.0D, player.posZ+8.0D));
        for (Iterator iterator = entities.iterator(); iterator.hasNext(); ) {
            EntityLiving entity = (EntityLiving)iterator.next();
            if(!entity.equals(player)) {
                player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100));
                return;
            }
        }
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill200-���������������ٶ�Buff */
@SubscribeEvent
public void Point_ER(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.UrgentProtect.id)
        && player.getHealth() > 0
        && player.getHealth() <= player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue() * 0.25
        && RewriteHelper.getAuroraPoint(player) > 5
        && isCD_Buff_ER(player)
        ) {
        RewriteHelper.modifyAuroraPoint(player, -5);
        player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 1));
        player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 4));
        player.addPotionEffect(new PotionEffect(Potion.resistance.id, 200, 1));
    }
}
项目:ItsRainingFood    文件:FoodEventHandler.java   
@SubscribeEvent
public void onPlayerTickEvent(PlayerTickEvent event)
{
    EntityPlayer player = event.player;
    int i = MathHelper.floor_double(player.posX);
    int j = MathHelper.floor_double(player.posY);
    int k = MathHelper.floor_double(player.posZ);

    if (player.isEntityAlive() && player.worldObj.isRaining() && player.worldObj.getBiomeGenForCoords(i, k).getIntRainfall() > 0)
    {
        if (player.ticksExisted%Config.configTicks == 0 && player.rotationPitch < -65f && player.getFoodStats().needFood() && player.worldObj.canBlockSeeTheSky(i, j, k))
        {
            player.getFoodStats().addStats(1, 1.0f);
            if (ItsRainingFood.proxy.shouldPlaySound())
                player.worldObj.playSoundAtEntity(player, "itsrainingfood:omnomnom", 0.8f, 1.0f);
        }
    }
}
项目:ComponentEquipment    文件:ArcaneBoreSlotChanger.java   
public void tickEnd( PlayerTickEvent event )
{
    if ( !event.phase.equals( TickEvent.Phase.END ) )
    {
        return;
    }
    EntityPlayer player = ( EntityPlayer ) event.player;

    if ( !player.openContainer.getClass().getName().equals( "thaumcraft.common.container.ContainerArcaneBore" ) )
    {
        return;
    }

    Slot oldSlot = player.openContainer.getSlot( 1 );
    if ( oldSlot instanceof PickaxeSlot )
    {
        return;
    }

    PickaxeSlot newSlot = new PickaxeSlot( oldSlot.inventory, 1, oldSlot.xDisplayPosition, oldSlot.yDisplayPosition );
    newSlot.slotNumber = oldSlot.slotNumber;
    player.openContainer.inventorySlots.set( 1, newSlot );
}
项目:ModJam-4    文件:StainManager.java   
@SubscribeEvent
public void playerTick(final PlayerTickEvent e)
{
    if (e.player.worldObj.isRemote)
    {
        // server only.
        return;
    }

    final PlayerState state = new PlayerState(e.player);

    PlayerStateContainer container = containers.get(e.player.getUniqueID());
    if (container == null)
    {
        container = new PlayerStateContainer(e.player.getUniqueID(), e.player.getDisplayName(), state);
        containers.put(e.player.getUniqueID(), container);
        LogManager.getLogger().trace("Creating container for {}", e.player.getDisplayName());
    }
    else
    {
        container.addState(state);
    }
}
项目:thatconference-baconmod    文件:PlayerTickHandler.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
    // this happens on every tick (20x per second)
    EntityClientPlayerMP player = _mc.thePlayer;

    IAttributeInstance movement = player.getEntityAttribute(SharedMonsterAttributes.movementSpeed); 
    if (player.getCurrentArmor(0) != null && player.getCurrentArmor(0).getItem() instanceof BaconBoots) {
        // if they're wearing bacon boots and they don't have the move bonus applied, then apply it
        if (movement.getModifier(BaconBoots.BaconBootsMoveBonusUUID) == null) {
            movement.applyModifier(BaconBoots.BaconBootsMoveBonus);
        }
    }
    else {
        // if they're not wearing bacon boots and they have the move bonus applied, then remove it
        if (movement.getModifier(BaconBoots.BaconBootsMoveBonusUUID) != null) {
            movement.removeModifier(BaconBoots.BaconBootsMoveBonus);
        }
    }
}
项目:ExtraAcC    文件:DamageRecalc.java   
@SubscribeEvent
   public void air(PlayerTickEvent event) {
    if (event.player.getAir() < 300 && event.player.worldObj.getTotalWorldTime() % 10 == 0) {
        if (AbilityData.get(event.player).isSkillLearned(SkillAirControl.INSTANCE)) {
            event.player.setAir(300);
        }
    }
}
项目:LambdaLib    文件:LIFMLGameEventDispatcher.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
    if (!addPlayerTick.isEmpty()) {
        hPlayerTick.addAll(addPlayerTick);
        addPlayerTick.clear();
    }
    for (Iterator<LIHandler> it = hPlayerTick.iterator(); it.hasNext(); ) {
        LIHandler handler = it.next();
        if (handler.isDead())
            it.remove();
        else
            handler.trigger(event);
    }
}
项目:EnderCore    文件:FireworkHandler.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
  EntityPlayer player = event.player;

  if (!player.worldObj.isRemote && event.phase == Phase.END) {
    if (player.worldObj.getTotalWorldTime() % 100 == 0) {
      Calendar cal = Calendar.getInstance();
      if (cal.get(DAY_OF_MONTH) == 1 && cal.get(MONTH) == JANUARY
          && !player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("celebrated")) {
        player.getEntityData().setInteger("fireworksLeft", 15);
        player.getEntityData().setBoolean("fireworkDelay", false);
        NBTTagCompound tag = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
        tag.setBoolean("celebrated", true);
        player.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, tag);
        player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + EnderCore.lang.localize("celebrate")));
      }
    }

    int fireworksLeft = player.getEntityData().getInteger("fireworksLeft");
    if (fireworksLeft > 0 && (!player.getEntityData().getBoolean("fireworkDelay") || player.worldObj.getTotalWorldTime() % 20 == 0)) {
      BlockCoord pos = getBlockCoord(player);
      pos = pos.withY(pos.y + 2);
      EntityUtil.spawnFirework(pos, player.worldObj.provider.dimensionId, 12);
      player.getEntityData().setInteger("fireworksLeft", fireworksLeft - 1);

      if (fireworksLeft > 5) {
        player.getEntityData().setBoolean("fireworkDelay", true);
      } else {
        player.getEntityData().setBoolean("fireworkDelay", false);
      }
    }
  }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill141-�����Ԫ��֪����ҹ��Buff */
@SubscribeEvent
public void Point_OtherWorldPerception(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.OtherWorldPerception.id)
        && !player.isPotionActive(Potion.nightVision)
        && !player.worldObj.provider.isSurfaceWorld()
        ) {
        player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 1200));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill142-��ҹ�ӡ���ҹ��Buff */
@SubscribeEvent
public void Point_Nightvision(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.Nightvision.id)
        && !player.isPotionActive(Potion.nightVision)
        && !player.worldObj.provider.isDaytime()
        && player.worldObj.provider.isSurfaceWorld()
        ) {
        player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 11000));
           player.addChatComponentMessage(new ChatComponentText("The night starts."));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill212-����������������������Buff */
@SubscribeEvent
public void Point_MoreHealth(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.PhysiqueUp.id)
        && !player.isPotionActive(Potion.field_76434_w)
        ) {
        player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 0x7FFFFFFF, 2));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill341-��ŷ�������\Skill342-��ŷ����ӿ�����������ظ�Buff */
@SubscribeEvent
public void Point_AutoHeal(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (player.getHealth() < player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue()
        && !player.isPotionActive(Potion.regeneration)
        ) {
        if (RewriteHelper.hasSkill(player, RewriteHelper.AuroraSurge.id)) {
            player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1));
        } else if (RewriteHelper.hasSkill(player, RewriteHelper.AuroraActivation.id)) {
            player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100));
        }
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** �������Skill���ർ�µ�ŷ�������ߵ��ٶȺ���Ծ����Buff */
@SubscribeEvent
public void Point_Burst(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (RewriteHelper.hasSkill(player, RewriteHelper.PhysiqueUp.id)
        && RewriteHelper.hasSkill(player, RewriteHelper.WitherAttach.id)
        && RewriteHelper.hasSkill(player, RewriteHelper.AuroraRob.id)
        && RewriteHelper.hasSkill(player, RewriteHelper.FireResistMax.id) 
        && RewriteHelper.hasSkill(player, RewriteHelper.HurtingFog.id) 
        && RewriteHelper.hasSkill(player, RewriteHelper.AuroraRegeneration.id) 
        ) {
        player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100, 255));
        player.addPotionEffect(new PotionEffect(Potion.jump.id, 100, 99));
    }
}
项目:KeyCraft    文件:SubscribeOnTick_Buff.java   
/** ������ҳ��е��߸���ʱû��Skill232-���������Ļ���Debuff */
@SubscribeEvent
public void Overweight(PlayerTickEvent event) {
    EntityPlayer player = event.player;
    if (!RewriteHelper.hasSkill(player, RewriteHelper.BruteForce.id)) {
        ItemStack held = player.getHeldItem();
        if (held != null
            && held.getItem() == ModItems.WirePole
            ) {
            player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1)); 
        }
    }
}
项目:amunra    文件:TickHandlerClient.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
    if(playerGravityState > 0 && event.phase == Phase.END) {
        playerGravityState--;
    }
    /*if(event.phase == Phase.START) {
        playerWasOnGround = event.player.onGround;
    }*/
}
项目:vsminecraft    文件:CommonPlayerTickHandler.java   
@SubscribeEvent
public void onTick(PlayerTickEvent event)
{
    if(event.phase == Phase.END && event.side == Side.SERVER)
    {
        tickEnd(event.player);
    }
}
项目:CountCraft    文件:TaskFindSameBlocksNearby.java   
@Override
public boolean canExecute(Event event) {
    if (event instanceof TickEvent && ((TickEvent) event).side == Side.CLIENT && ((TickEvent) event).type == Type.PLAYER && ((TickEvent) event).phase == Phase.END) {
        return ((PlayerTickEvent) event).player.worldObj.provider.dimensionId == this.dimension && ((PlayerTickEvent) event).player.getUniqueID().equals(this.playerUUID);
    }

    return false;
}
项目:AdvancedMod    文件:AdvancedModEventHandler.java   
/**
 * Using the PlayerTickEvent. Note that this is from cpw.mods.fml.common.gameevent, so to make this method be called, this class needs to be registered at FMLCommonHandler.instance().bus().register(new AdvancedModEventHandler()).
 * @param event
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event){
    if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END) {
        List<Entity> entities = event.player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(event.player.posX - 3, event.player.posY - 3, event.player.posZ - 3, event.player.posX + 3, event.player.posY + 3, event.player.posZ + 3));
        for(Entity entity : entities) {
            if(entity != event.player) {
                //entity.setVelocity(0, 1, 0); //This will crash when run on a dedicated server, because Entity#setVelocity is marked with @SideOnly(Side.CLIENT), and therefore stripped from a dedicated server instance.
                entity.motionX = 0;//The solution is to do this.
                entity.motionY = 1;
                entity.motionZ = 0;
            }
        }
    }
}
项目:bUpload    文件:KeyBindingHandler.java   
@SubscribeEvent
public void onKeyPress(PlayerTickEvent event) {
    Minecraft minecraft = Minecraft.getMinecraft();

    if (Keyboard.isKeyDown(onScreenShot.getKeyCode())) {
        if (handled) {
            return;
        }

        ScreenshotHandler.handleScreenshot();
        handled = true;
    } else {
        handled = false;
    }
}
项目:TheCorruptedSector    文件:MiningWorldEvents.java   
@SubscribeEvent
public void tryTeleportToOverworld(PlayerTickEvent evt) {
    if (evt.side == Side.SERVER) {
        if (evt.player.dimension == TCSConfig.dimensionID && evt.player.posY < -2.5D) {
            EntityPlayerMP playerMP = (EntityPlayerMP) evt.player;
            playerMP.fallDistance = 0.0F;
            TeleportUtils.teleportPlayerToMiningWorld(playerMP, true, false);
        }
    }
}
项目:SecurityCraft    文件:ForgeEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerTick(PlayerTickEvent event){
    counter++;
    if(cooldownCounter > 0){
        cooldownCounter--;
    }

    if(counter >= 20){
        mod_SecurityCraft.network.sendToServer(new PacketCheckRetinalScanner(event.player.getCommandSenderName()));
        counter = 0;
    }

}
项目:Dimensional-Pockets    文件:ClientPlayerTickEventHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void event(PlayerTickEvent evt) {
    if (evt.player != Minecraft.getMinecraft().thePlayer) {
        return;
    }

    if (hideStuffFromNEI) {
        hideStuffFromNEI = false;
        hideStuffFromNEI();
    }

    if (checkForVersion) {
        checkForVersion = false;
        VersionChecker.checkUpToDate(evt.player);
    }

    ItemStack equippedItemStack = evt.player.getCurrentEquippedItem();
    Item equippedItem = equippedItemStack != null ? equippedItemStack.getItem() : null;

    // check for Nether Crystal in hand to trigger side color coding of pockets
    TileRendererPocket.doIndicateSides = equippedItem == ModItems.netherCrystal;

    // check for Guide Book and show wiki link
    if (suggestWiki && equippedItem == ModItems.book) {
        suggestWiki = false;
        evt.player.addChatMessage(new ChatComponentText(Localise.translate("info.wiki.1")));
        IChatComponent linkLine = new ChatComponentText(Localise.translate("info.wiki.2") + " -> [ ");
        linkLine.appendSibling(Utils.createChatLink(Localise.translate("click.me"), Reference.MOD_WIKI_URL, true, false, false, EnumChatFormatting.AQUA));
        linkLine.appendSibling(new ChatComponentText(" ]"));
        evt.player.addChatMessage(linkLine);
    }
}
项目:archimedes-ships    文件:CommonPlayerTicker.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent e)
{
    if (e.phase == Phase.END && e.player.ridingEntity instanceof EntityParachute && e.player.ridingEntity.ticksExisted < 40)
    {
        if (e.player.isSneaking())
        {
            e.player.setSneaking(false);
        }
    }
}
项目:RuneMagic    文件:KeyHandler.java   
@SideOnly(value=Side.CLIENT)
@SubscribeEvent
public void playerTick(PlayerTickEvent event) {
    if (event.side == Side.SERVER) return;
    if (event.phase == Phase.START ) {
        if (key.getIsKeyPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) {
                Baubles.packetPipeline.sendToServer(new PacketOpenBaublesInventory(event.player));
        }
    }
}
项目:PerFabricaAdAstra    文件:RespirationHandler.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
    if (event.phase == Phase.START) {
        this.playerAir = event.player.getAir();
    } else {
        handleRespiration(event.player, this.playerAir);
    }
}
项目:TheMinersFriend    文件:MiningHelmetTickHandler.java   
@SubscribeEvent
public void onPlayerUpdate(PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        EntityPlayer entityplayer = event.player;
        World world = entityplayer.worldObj;
        checkForFallingBlocks(entityplayer,
                              world);
    }
}
项目:OpenPeripheral-Addons    文件:TerminalManagerServer.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent evt) {
    if (evt.phase == Phase.START && evt.player instanceof EntityPlayerMP) {
        final Optional<Long> guid = TerminalIdAccess.instance.getIdFrom(evt.player);
        if (guid.isPresent()) {
            TileEntityGlassesBridge listener = listeners.get(guid.get());
            if (listener != null) listener.registerTerminal((EntityPlayerMP)evt.player);
        }
    }
}
项目:Soul-Forest    文件:CommonTickHandler.java   
@SubscribeEvent
   public void onPlayerTick(PlayerTickEvent event){     
this.player = event.player;

if(this.checkPlayerIsWearingSetArmorType(InitMaterials.Bronze_Armor)){
    // Player is wearing full bronze set
    player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 3, 1));
    Random random = new Random();               
    if(random.nextInt(10) == 0){                    
    float f1 = (float)MathHelper.floor_double(player.boundingBox.minY);
    double f2 = (random.nextFloat() * 2.0F - 1.0F) * player.width;
    double f3 = (random.nextFloat() * 2.0F - 1.0F) * player.width;
    player.worldObj.spawnParticle("bubble", MathHelper.floor_double(player.posX) + (double)f2, (double)(f1 + 1.5F), MathHelper.floor_double(player.posZ) + (double)f3, player.motionX, player.motionY, player.motionZ);
    }
}
else if(this.checkPlayerIsWearingSetArmorType(InitMaterials.Slime_Armor)){
    // Player is wearing full slime set
    player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 5, 4));
    player.fallDistance = 0.0F;
}
else if(this.checkPlayerIsWearingSetArmorType(InitMaterials.Silver_Armor)){
    // Player is wearing full silver set
    player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 5, 4));
}
else if(this.checkPlayerIsWearingSetArmorType(InitMaterials.Fyrised_Armor)){
    // Player is wearing full fyrised set
    player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 5, 4));
    if(player.isInWater()){
    if(player.getHeldItem() != null){
        if(!player.getHeldItem().getItem().equals(SoulItems.FrostShard.get())){
        player.attackEntityFrom(DamageSource.drown, 1.0F);
        }
    }
    else{
        player.attackEntityFrom(DamageSource.drown, 1.0F);
    }
    }
}
   }
项目:minecraft-quiverbow    文件:ListenerClient.java   
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
    if (event.side.isServer()) { return; }          // Only doing this on client side
    if (event.player != Minecraft.getMinecraft().thePlayer) { return; } // Only for THIS player, that belongs to the client

    boolean holdingWeapon = false;
    boolean isSneaking = event.player.isSneaking();
    float zoomFOV = 0;

    if (event.player.getHeldItem() == null)
    {
        // Whelp.
    }
    else if (event.player.getHeldItem().getItem() instanceof FrostLancer)
    {
        holdingWeapon = true;
        zoomFOV = ((FrostLancer)event.player.getHeldItem().getItem()).ZoomMax;
    }
    else if (event.player.getHeldItem().getItem() instanceof EnderRifle)
    {
        holdingWeapon = true;
        zoomFOV = ((EnderRifle)event.player.getHeldItem().getItem()).ZoomMax;
    }

    if (this.wasZoomedLastTick)
    {
        if (!holdingWeapon) { this.zoomOut(); }
        else if (!isSneaking) { this.zoomOut(); }
        else    // else, zoomed, holding the weapon and sneaking. No change there
        {
            if (zoomFOV != this.fovLastTick) // May have switched to another rifle
            {
                net.minecraft.client.Minecraft.getMinecraft().gameSettings.fovSetting =  zoomFOV;
            }
        }
    }
    else
    {
        if (holdingWeapon && isSneaking) { this.zoomIn(zoomFOV); }
        // else, not zoomed in and either not holding the weapon or not sneaking
    }
}
项目:NoteblockTweak    文件:CreditNotifer.java   
@SubscribeEvent
public void world(PlayerTickEvent event){
    event.player.addChatComponentMessage(new ChatComponentText("NoteblockTweak " + NoteblockTweak.VERSION + " by CharlieJiang"));
    event.player.addChatComponentMessage(new ChatComponentText("RealPiano ResourcePack by lkrb"));
    cpw.mods.fml.common.FMLCommonHandler.instance().bus().unregister(this);
}
项目:Electrometrics    文件:UpdateManager.java   
@SubscribeEvent
public void onTick(PlayerTickEvent event) {
    if (event.phase == Phase.END) {
        if (lastPoll > 0) {
            --lastPoll;
        } else {
            lastPoll = 400;

            if (!isNotificationDisplayed && updateThread.isCheckCompleted()) {
                isNotificationDisplayed = true;
                FMLCommonHandler.instance().bus().unregister(this);

                if (updateThread.isNewVersionAvailable()) {
                    if (!General.enableUpdateNotice && !updateThread.isCriticalUpdate()) {
                        return;
                    }

                    ModVersion newModVersion = updateThread.getNewModVersion();
                    EntityPlayer player = event.player;

                    // Display notification message.
                    ChatStyle modData = modname.createShallowCopy();
                    modData.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(newModVersion.getModVersion().toString()).setChatStyle(version)));

                    IChatComponent notificationChatMessage = new ChatComponentText("");
                    notificationChatMessage.appendText("[");
                    notificationChatMessage.appendSibling(new ChatComponentText(mod.getModName()).setChatStyle(modData));
                    notificationChatMessage.appendText("] ");
                    notificationChatMessage.appendSibling(new ChatComponentTranslation("tooltip.newVersionAvailable").setChatStyle(white));
                    notificationChatMessage.appendText(":");

                    // Display description.
                    IChatComponent descriptionChatMessage = new ChatComponentText("");

                    if (!StringUtils.isNullOrEmpty(downloadUrl)) {
                        ChatStyle downloadData = download.createShallowCopy();
                        downloadData.setChatClickEvent(new ClickEvent(Action.OPEN_URL, downloadUrl));

                        descriptionChatMessage.appendText("[");
                        descriptionChatMessage.appendSibling(new ChatComponentTranslation("tooltip.download").setChatStyle(downloadData));
                        descriptionChatMessage.appendText("] ");
                    }

                    descriptionChatMessage.appendSibling(new ChatComponentText(newModVersion.getDescription()).setChatStyle(description));

                    // Send the chat messages to the player.
                    player.addChatMessage(notificationChatMessage);
                    player.addChatMessage(descriptionChatMessage);
                }
            }
        }
    }
}
项目:AdvancedRocketry    文件:SpaceObjectManager.java   
/**
 * Event designed to teleport a player to the spawn point for the station if he'she falls out of the world in space
 * TODO: prevent inf loop if nowhere to fall!
 */
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event) {
    if(event.player.worldObj.provider.dimensionId == Configuration.spaceDimId) {

        if(event.player.posY < 0 && !event.player.worldObj.isRemote) {
            ISpaceObject object = getSpaceStationFromBlockCoords((int)event.player.posX, (int)event.player.posZ);
            if(object != null) {

                BlockPosition loc = object.getSpawnLocation();

                event.player.fallDistance=0;
                event.player.motionY = 0;
                event.player.setPositionAndUpdate(loc.x, loc.y, loc.z);
                event.player.addChatComponentMessage(new ChatComponentText("You wake up finding yourself back on the station"));
            }
        }

        int result = Math.abs(2*(((int)event.player.posZ + Configuration.stationSize/2) % (2*Configuration.stationSize) )/Configuration.stationSize);
        if(result == 0 || result == 3) {
            event.player.motionZ = -event.player.motionZ;
            if(result == 0) {
                event.player.setPosition(event.player.posX, event.player.posY, event.player.posZ + (event.player.posZ < 0 ? Math.abs(event.player.posZ % 16) : (16 - event.player.posZ % 16)));
            }
            else
                event.player.setPosition(event.player.posX, event.player.posY, event.player.posZ - (event.player.posZ < 0 ? 16 - Math.abs(event.player.posZ % 16) : (event.player.posZ % 16)));

        }

        //double posX = event.player.posX < 0 ? -event.player.posX - Configuration.stationSize : event.player.posX;

        result = Math.abs(2*(((int)event.player.posX + Configuration.stationSize/2) % (2*Configuration.stationSize) )/Configuration.stationSize);

        if(event.player.posX < -Configuration.stationSize/2)
            if(result == 3)
                result = 0;
            else if(result == 0)
                result = 3;

        if(result == 0 || result == 3) {
            event.player.motionX = -event.player.motionX;
            if(result == 0) {
                event.player.setPosition(event.player.posX + (event.player.posX < 0 ? Math.abs(event.player.posX % 16) : (16 - event.player.posX % 16)), event.player.posY, event.player.posZ);
            }
            else
                event.player.setPosition(event.player.posX - (event.player.posX < 0 ? 16 - Math.abs(event.player.posX % 16) : (event.player.posX % 16)), event.player.posY, event.player.posZ);

        }
    }
}