本文整理汇总了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;
}
}
}
}
}
示例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());
}
示例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()});
}
示例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());
}
示例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()});
}
示例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);
}