当前位置: 首页>>代码示例>>Java>>正文


Java LivingUpdateEvent.getEntityLiving方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent.getEntityLiving方法的典型用法代码示例。如果您正苦于以下问题:Java LivingUpdateEvent.getEntityLiving方法的具体用法?Java LivingUpdateEvent.getEntityLiving怎么用?Java LivingUpdateEvent.getEntityLiving使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent的用法示例。


在下文中一共展示了LivingUpdateEvent.getEntityLiving方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: entityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityUpdate(LivingUpdateEvent event){
	if(event.getEntityLiving() !=null){
		if(event.getEntityLiving() instanceof EntityPlayer){
			EntityPlayer player = (EntityPlayer)event.getEntityLiving();
			updateWings(player);
			ExtendedPlayer exPlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
			if(exPlayer !=null){
				if(exPlayer.hasFailed && player.isEntityAlive()){
					ItemUtil.givePlayerItem(player, new ItemStack(ModBlocks.failureBlock));
					exPlayer.hasFailed = false;
				}
			}
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:EventHandler.java

示例2: onLivingTick

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingTick(LivingUpdateEvent event)
{
	PotionEffect effect = event.getEntityLiving().getActivePotionEffect(PotionRegistry.REDSTONE_NEEDLE);
	if (effect == null)
		return;
	if (effect.getAmplifier() >= 4)
	{
		if (event.getEntityLiving() instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer) event.getEntityLiving();
			if (player.capabilities.isFlying && !player.isCreative())
				player.capabilities.isFlying = false;
		}
	}
}
 
开发者ID:murapix,项目名称:Inhuman-Resources,代码行数:17,代码来源:PotionRedstoneNeedle.java

示例3: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate (LivingUpdateEvent event) {

    final EntityLivingBase entity = event.getEntityLiving();

    if (entity instanceof EntitySheep) {

        final ModifiableAttributeInstance instance = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.ARMOR);
        final boolean hasModifier = instance.hasModifier(sheepArmor);
        final boolean isSheared = ((EntitySheep) entity).getSheared();

        if (!isSheared && !hasModifier) {
            instance.applyModifier(sheepArmor);
        }
        else if (isSheared && hasModifier) {
            instance.removeModifier(sheepArmor);
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:20,代码来源:FeatureSheepArmor.java

示例4: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  if (event.getEntityLiving() instanceof EntityPlayer) {//some of the items need an off switch
    EntityPlayer player = (EntityPlayer) event.getEntityLiving();
    final IPlayerExtendedProperties data = CapabilityRegistry.getPlayerProperties(player);
    if (data.isStepHeightOn()) {
      if (player.isSneaking()) {
        //make sure that, when sneaking, dont fall off!!
        player.stepHeight = 0.9F;
      }
      else {
        player.stepHeight = 1.0F + (1F / 16F);//PATH BLOCKS etc are 1/16th downif MY feature turns this on, then do it
      }
    }
    else if (data.doForceStepOff()) {
      //otherwise, dont automatically force it off. only force it off the once if player is toggling FROM on TO off with my feature
      player.stepHeight = 0.5F;
    }
    //else leave it alone (allows other mods to turn it on without me disrupting)
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:22,代码来源:ItemAppleStep.java

示例5: onPlayerUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent event) {
  if (event.getEntityLiving() instanceof EntityPlayer == false) {
    return;
  }
  EntityPlayer player = (EntityPlayer) event.getEntityLiving();
  IPlayerExtendedProperties props = CapabilityRegistry.getPlayerProperties(player);
  int flyingTicks = props.getFlyingTimer();//TICKS NOT SECONDS
  if (flyingTicks > 1) {//it decays at 1 not zero so that we only set flying False once, not constantly. avoids having boolean flag
    props.setFlyingTimer(props.getFlyingTimer() - 1);
    setFlying(player);
  }
  else if (flyingTicks == 1) { //times up! only 1/20 of a second left
    props.setFlyingTimer(0);//skip ahead to zero
    setNonFlying(player);
  }
  //else it is zero. so this is the same as null/undefined/ so player has never eaten or it wore off.
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:19,代码来源:ItemChorusGlowing.java

示例6: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  EntityLivingBase playerRider = event.getEntityLiving();
  if (playerRider != null && playerRider instanceof EntityPlayer && playerRider.getEntityData().hasKey(KEY_MOUNTENTITY)
      && playerRider.isRiding() == false) {
    World world = playerRider.getEntityWorld();
    int eid = playerRider.getEntityData().getInteger(KEY_MOUNTENTITY);
    if (eid >= 0) {
      Entity maybeHorse = world.getEntityByID(eid);
      if (maybeHorse != null && maybeHorse.isDead == false) {
        //if we were dismounted from an ender pearl, get and consume this entity id, wiping it out for next time
        if (playerRider.startRiding(maybeHorse, true)) {
          playerRider.getEntityData().removeTag(KEY_MOUNTENTITY);//.setInteger(KEY_MOUNTENTITY, -1);
        }
      }
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:19,代码来源:MountedTweaksModule.java

示例7: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  //check if NOT holding this harm
  if (event.getEntityLiving() instanceof EntityPlayer == false) {
    return;
  }
  EntityPlayer player = (EntityPlayer) event.getEntityLiving();
  //Ticking
  ItemStack armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
  int level = 0;
  if (armor.isEmpty() == false && EnchantmentHelper.getEnchantments(armor) != null
      && EnchantmentHelper.getEnchantments(armor).containsKey(this)) {
    //todo: maybe any armor?
    level = EnchantmentHelper.getEnchantments(armor).get(this);
  }
  if (level > 0) {
    turnReachOn(player);
  }
  else {
    //was it on before, do we need to do an off hit
    if (player.getEntityData().hasKey(NBT_REACH_ON) && player.getEntityData().getBoolean(NBT_REACH_ON)) {
      turnReachOff(player);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:26,代码来源:EnchantReach.java

示例8: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
    if (event.getEntityLiving() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntityLiving();
        float step = PlayerTracker.getPlayerData(player).getAbilities().getStepAssist();
        float steps = 0.5F * (step + 1);
        if (steps > player.stepHeight) {
            player.stepHeight = steps;
            player.getEntityData().setBoolean("HasRewardStepAssist", true);
        }

        if (step == 0.5F && player.getEntityData().hasKey("HasRewardStepAssist")) {
            player.getEntityData().removeTag("HasRewardStepAssist");
            player.stepHeight = 0.5F;
        }
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:18,代码来源:RewardStepAssist.java

示例9: darkRealm

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void darkRealm(LivingUpdateEvent event){
	if(event.getEntityLiving() instanceof EntityPlayerMP){
		WorldServer worldServer = (WorldServer)event.getEntityLiving().world;
		EntityPlayerMP player = (EntityPlayerMP)event.getEntityLiving();
		if(player.dimension == ACLib.omothol_id && player.posY <= 0){
			player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 80, 255));
			player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 20));
			player.mcServer.getPlayerList().transferPlayerToDimension(player, ACLib.dark_realm_id, new TeleporterDarkRealm(worldServer));
			//				player.addStat(ACAchievements.enter_dark_realm, 1);
		}
	}
	if(event.getEntityLiving().dimension == ACLib.dark_realm_id && !(event.getEntityLiving() instanceof EntityPlayer)){
		Random rand = new Random();
		if(ACConfig.particleEntity)
			event.getEntityLiving().world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, event.getEntityLiving().posX + (rand.nextDouble() - 0.5D) * event.getEntityLiving().width,
					event.getEntityLiving().posY + rand.nextDouble() * event.getEntityLiving().height,
					event.getEntityLiving().posZ + (rand.nextDouble() - 0.5D) * event.getEntityLiving().width, 0,0,0);
	}
}
 
开发者ID:Shinoow,项目名称:AbyssalCraft,代码行数:21,代码来源:AbyssalCraftEventHooks.java

示例10: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent livingUpdate) {

  Entity ent = livingUpdate.getEntityLiving();
  if (!ent.getEntityData().hasKey(KEY_SPAWNED_BY_POWERED_SPAWNER)) {
    return;
  }
  if (fieldpersistenceRequired == null) {
    ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
    return;
  }

  long spawnTime = ent.getEntityData().getLong(KEY_SPAWNED_BY_POWERED_SPAWNER);
  long livedFor = livingUpdate.getEntity().world.getTotalWorldTime() - spawnTime;
  if (livedFor > SpawnerConfig.poweredSpawnerDespawnTimeSeconds.get() * 20) {
    try {
      fieldpersistenceRequired.setBoolean(livingUpdate.getEntityLiving(), false);

      ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
    } catch (Exception e) {
      Log.warn("BlockPoweredSpawner.onLivingUpdate: Error occured allowing entity to despawn: " + e);
      ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:26,代码来源:BlockPoweredSpawner.java

示例11: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
	EntityLivingBase living = event.getEntityLiving();
	if(living instanceof IBurnInDay && living.world.isDaytime() && !living.world.isRemote && !living.isChild() && ((IBurnInDay)living).shouldBurn() && living.getBrightness() > 0.5F && 
			living.getRNG().nextFloat() * 30.0F < (living.getBrightness() - 0.4F) * 2.0F && living.world.canSeeSky(new BlockPos(living.posX, living.posY + (double)living.getEyeHeight(), living.posZ)))
	{
		boolean flag = true;
           ItemStack itemstack = living.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
           if (!itemstack.isEmpty())
           {
               if (itemstack.isItemStackDamageable())
               {
                   itemstack.setItemDamage(itemstack.getItemDamage() + living.getRNG().nextInt(2));

                   if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
                   {
                   	living.renderBrokenItemStack(itemstack);
                   	living.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
                   }
               }

               flag = false;
           }

           if (flag)
           {
           	living.setFire(8);
           }
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:32,代码来源:HandlerBurnInDaylight.java

示例12: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent e) {
	EntityLivingBase entity = e.getEntityLiving();
	if(!entity.world.isRemote && ObsidianAPIUtil.isAnimatedEntity(entity)) {
		EntityAnimationProperties animationProps = EntityAnimationProperties.get(entity);
		if(animationProps != null) {	
			animationProps.updateActiveAnimation();
			animationProps.runAnimationTick();
		}
	}
	
	if(entity.world.isRemote && entity instanceof EntityPlayer)
		AnimationNetworkHandler.network.sendToServer(new MessagePlayerLimbSwing(entity));	
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:15,代码来源:ObsidianEventHandler.java

示例13: onEntityTick

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityTick(LivingUpdateEvent e) {
	EntityLivingBase entity = e.getEntityLiving();
	if (entity.hasCapability(CAPABILITY_WEAPONSKILL, null)) {
		IWeaponSkillInfo skillInfo = entity.getCapability(CAPABILITY_WEAPONSKILL, null);
		skillInfo.setCooldown(Math.max(skillInfo.getCooldown()-1,0));
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:9,代码来源:Thermionics.java

示例14: livingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event) {
	EntityLivingBase living = event.getEntityLiving();
	if(living.hasCapability(RIG.RIG_ITEM, null)) {
		ItemStack rig = living.getCapability(RIG.RIG_ITEM, null).getStackInSlot(0);
		if(rig.hasTagCompound() && living.isInWater()) {
			int extraair = 100 + RIGUpgrade.upgradesMap.get("Air").getAttributeValue(rig) * 100;
			if (living.getRNG().nextInt(300+extraair)>=300) {
				living.setAir(living.getAir()+1);
			}
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:14,代码来源:RIGEvents.java

示例15: resetStatus

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
/** Reset some stuff every tick */
@SubscribeEvent
public void resetStatus(LivingUpdateEvent e) {
	EntityLivingBase guy = e.getEntityLiving();
	if(!guy.world.isRemote) {

		// nether fortress stuff
		IAttributeInstance inst = guy.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
		if(inst.getModifier(knockbackID) != null) inst.removeModifier(knockbackID);

	}
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:13,代码来源:ArmorHandler.java


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