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