当前位置: 首页>>代码示例>>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;未经允许,请勿转载。