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


Java LivingUpdateEvent类代码示例

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


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

示例1: livingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event) {
	World world = event.getEntity().getEntityWorld();

	if (world.isRemote) {
		return;
	}

	if (world.getTotalWorldTime() % 20 != 0) {
		return;
	}

	if (!(event.getEntity() instanceof EntityLiving)) {
		return;
	}

	if (event.getEntity().getTags().contains(NemesisSystem.TAG_BODY_GUARD)) {
		handleBodyGuardUpdate(event);
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:21,代码来源:UpdateHandler.java

示例2: livingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event)
{
	/*if (!event.entityLiving.worldObj.isRemote)
	{
		if (event.entityLiving instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer) event.entityLiving;
			if (player.dimension == ModDimensions.CUBE_ID)
			{
				CubeManager manager;

				if ((manager = CubeManager.getInstance()) != null)
				{
					manager.checkPosition((EntityPlayerMP) player);
				}
			}
		}
	}*/
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:21,代码来源:WorldTickHandler.java

示例3: 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

示例4: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {

}

if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion2)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {

}
}
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion3)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {

}
}
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion4)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {

}
}
}
}
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:25,代码来源:Potioneventhandlers.java

示例5: onZombieVillagerDeath

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onZombieVillagerDeath(LivingUpdateEvent event) {
	if (!event.getEntity().getEntityWorld().isRemote && event.getEntity().isDead && event.getEntity() instanceof EntityZombieVillager) {

		EntityLiving convertTo = null;

		if (hasRoyalEffect(event)) {
			convertTo = new EntityVillageLord(event.getEntity().world);
		} else if (hasLoyalEffect(event)) {
			convertTo = new EntityGuard(event.getEntity().world);
		}

		if (convertTo == null) {
			return;
		}

		if (handlePossibleConversion((EntityLiving) event.getEntity(), convertTo)) {
			removeVillager(event);
		}
	}
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:22,代码来源:EntitySpawning.java

示例6: 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

示例7: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
	if (!(event.entityLiving instanceof EntityPlayer)) {
		return;
	}

	EntityPlayer player = (EntityPlayer) event.entityLiving;

	int i = 0;
	for (int j = 0; j < player.inventory.armorInventory.length; ++j) {
		if (player.inventory.armorInventory[j] != null && player.inventory.armorInventory[j].getItem() instanceof ItemTeambattleArmor) {
			int k = ((ItemTeambattleArmor) player.inventory.armorInventory[j].getItem()).damageReduceAmount;
			i += k;
		}
	}

	player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0F + i);
	if (player.getHealth() > player.getMaxHealth()) {
		player.setHealth(player.getMaxHealth());
	}

}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:23,代码来源:CommonEventHandler.java

示例8: 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

示例9: onPlayerUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
/** Handle all player updates */
@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent e) {
	if(e.getEntity() instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer)e.getEntity();
		
		// serverside things
		if (!player.worldObj.isRemote) {
			EntityPlayerMP mp = (EntityPlayerMP)player;
			
			// repair tools and armor
			handleRepair(mp);		
			
			// handle potion things
			handleServerPotionEffects(mp);
			
			// handle portal things
			handleTeleportation(mp);
		}
		
		// common things
		onStepBootsWear(player);
	}
}
 
开发者ID:sblectric,项目名称:LightningCraft,代码行数:25,代码来源:PlayerEvents.java

示例10: onLivingUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event)
{
	if (event.entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)event.entity;
		ItemStack itemstack = player.getHeldItem();
		
		if (player.ticksExisted % 2 == 0)
		{
			if (mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic) && !(mc.currentScreen instanceof GuiGameOver))
			{
				mc.getSoundHandler().stopSound(FNAFSoundHandler.deathStatic);
			}
		}
	}
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:18,代码来源:ClientEventHandler.java

示例11: onLivingUpdateEvent

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
	// Previously had event.entityLiving (uses EntityLivingBase) instead of Entity
	public void onLivingUpdateEvent(LivingUpdateEvent event) {
//		if (event.entity != null && event.entity instanceof EntityPlayer) {
//			EntityPlayer player = (EntityPlayer) event.entity;
		if (event.entityLiving != null && event.entityLiving instanceof EntityPlayer) {
			EntityPlayer player = (EntityPlayer) event.entityLiving;
			if (DragonPlayer.get(player).isDragon()) {
				if (!event.entityLiving.worldObj.isRemote) {  
		    		player.capabilities.allowFlying = true;
		    		ItemDragonEgg.applyAbilities(player, false);
//		    		player.sendPlayerAbilities(); // 7/2/15 Removed as a test, don't think this is needed!
		        }
				else {
		    		player.capabilities.allowFlying = true;
					ItemDragonEgg.applyAbilities(player, true);				
				}
			}
		}
    }
 
开发者ID:DracoAnimus,项目名称:Coding,代码行数:21,代码来源:DragonPlayerEventHandler.java

示例12: onLivingUpdate

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

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

  long despawnTime = ent.getEntityData().getLong(KEY_DESPAWN_TIME);    
  if(despawnTime <= livingUpdate.entity.worldObj.getTotalWorldTime() ) {
    try {
      fieldpersistenceRequired.setBoolean(livingUpdate.entityLiving, false);
      ent.getEntityData().removeTag(KEY_DESPAWN_TIME);
    } catch (Exception e) {
      Log.warn("BlockPoweredSpawner.onLivingUpdate: Error occured allowing entity to despawn: " + e);
      ent.getEntityData().removeTag(KEY_DESPAWN_TIME);
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:Structures,代码行数:24,代码来源:DespawnController.java

示例13: 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

示例14: 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

示例15: 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


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