當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityLivingBase.getAttackingEntity方法代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityLivingBase.getAttackingEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLivingBase.getAttackingEntity方法的具體用法?Java EntityLivingBase.getAttackingEntity怎麽用?Java EntityLivingBase.getAttackingEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.EntityLivingBase的用法示例。


在下文中一共展示了EntityLivingBase.getAttackingEntity方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleBounty

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@SubscribeEvent
public void handleBounty(LootingLevelEvent event) {
	EntityLivingBase target = event.getEntityLiving();
	EntityLivingBase attacker = target.getAttackingEntity();
	if (attacker instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) attacker;
		Collection<PotionEffect> potions = player.getActivePotionEffects();
		for (PotionEffect potion : potions) {
			if (potion.getPotion() instanceof PotionHunt) {
				PotionHunt huntPotion = (PotionHunt) potion.getPotion();
				if (huntPotion.appliesTo(target)) {
					event.setLootingLevel(event.getLootingLevel() + 2);

					return;
				}
			}
		}
	}
}
 
開發者ID:TeamMelodium,項目名稱:Melodium,代碼行數:20,代碼來源:SongHunt.java

示例2: getDeathMessage

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
/**
 * Returns the message to be displayed on player death.
 */
@Override
public ITextComponent getDeathMessage(EntityLivingBase par1EntityLivingBase) {
    String messageMeta = "";
    int messageNumber = par1EntityLivingBase.getRNG().nextInt(deathMessages) + 1;
    messageMeta = messageNumber + "";

    EntityLivingBase entitylivingbase1 = par1EntityLivingBase.getAttackingEntity();
    String s = "death.attack." + damageType + messageMeta;
    String s1 = s + ".player";
    return entitylivingbase1 != null && I18n.hasKey(s1) ?
            new TextComponentTranslation(s1, par1EntityLivingBase.getDisplayName(), entitylivingbase1.getDisplayName()) :
            new TextComponentTranslation(s, par1EntityLivingBase.getDisplayName());
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:17,代碼來源:DamageSourcePneumaticCraft.java

示例3: getDeathMessage

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn) {
	
       EntityLivingBase entitylivingbase = entityLivingBaseIn.getAttackingEntity();
       String s = "death.attack." + this.damageType;
       String s1 = s + ".player";
       return entitylivingbase != null && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), entitylivingbase.getDisplayName()}) : new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName()});
  
}
 
開發者ID:Bedrockbreaker,項目名稱:rtap,代碼行數:9,代碼來源:ModDeath.java

示例4: getDeathMessage

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
@Nonnull
public ITextComponent getDeathMessage(EntityLivingBase entity) {
	EntityLivingBase entitylivingbase = entity.getAttackingEntity();
	String s = "solar.death." + this.damageType;
	String s1 = s + ".player";
	return entitylivingbase != null && I18n.canTranslate(s1)
			? new TextComponentTranslation(s1, entity.getDisplayName(), entitylivingbase.getDisplayName())
			: new TextComponentTranslation(s, entity.getDisplayName());
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:11,代碼來源:FixedDamage.java

示例5: getDeathMessage

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
/**
 * Gets the death message that is displayed when the player dies
 */
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)
{
    EntityLivingBase entitylivingbase = entityLivingBaseIn.getAttackingEntity();
    String s = "death.attack." + this.damageType;
    String s1 = s + ".player";
    return entitylivingbase != null && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), entitylivingbase.getDisplayName()}): new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName()});
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:DamageSource.java

示例6: onLivingAttack

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@SubscribeEvent
public void onLivingAttack(LivingAttackEvent e)
{
    EntityLivingBase attacked = e.getEntityLiving();
    EntityLivingBase attacker = attacked.getAttackingEntity();
    if(attacker == null) return;
    damageShield(attacked, attacker, e.getAmount());
    doAxeStuff(attacked, attacker);
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:10,代碼來源:ItemWickerShield.java


注:本文中的net.minecraft.entity.EntityLivingBase.getAttackingEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。