當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。