Java 类net.minecraftforge.event.entity.living.LivingExperienceDropEvent 实例源码

项目:CustomWorldGen    文件:ForgeEventFactory.java   
public static int getExperienceDrop(EntityLivingBase entity, EntityPlayer attackingPlayer, int originalExperience)
{
   LivingExperienceDropEvent event = new LivingExperienceDropEvent(entity, attackingPlayer, originalExperience);
   if (MinecraftForge.EVENT_BUS.post(event))
   {
       return 0;
   }
   return event.getDroppedExperience();
}
项目:NemesisSystem    文件:DeathHandler.java   
@SubscribeEvent
public void dropExperience(LivingExperienceDropEvent event) {
    if (!event.getEntity().getTags().contains(NemesisSystem.TAG_NEMESIS)) {
        return;
    }
    NemesisEntry nemesis = NemesisUtil.loadNemesisFromEntity(event.getEntity());
    if (nemesis == null) {
        return;
    }
    event.setDroppedExperience(10 + (5 * (nemesis.getLevel() - 1)));
}
项目:CrystalMod    文件:ArmorEventHandler.java   
@SubscribeEvent
public void addMoreMobXP(LivingExperienceDropEvent event){
    if(event.getAttackingPlayer() == null)return;
    EntityPlayer player = event.getAttackingPlayer();
    if(getArmorCount(player, "green") == 4 || getArmorCount(player, "pure") == 4){
        final int oldXP = event.getDroppedExperience();
        float dev = (float)EntityUtil.rand.nextInt(50) / (float)50;
        int add = (int) (oldXP * dev);
        //ModLogger.info("Added Mob XP: "+add+" / "+dev+" "+oldXP);
        event.setDroppedExperience(add + oldXP);
    }
}
项目:TAIGA    文件:TraitAnalysing.java   
@SubscribeEvent
public void onXpDrop(LivingExperienceDropEvent event) {
    EntityPlayer player = event.getAttackingPlayer();
    if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier) && event.getDroppedExperience() > 0) {
        event.setDroppedExperience(this.getUpdateXP(event.getDroppedExperience()));
    }
}
项目:TAIGA    文件:TraitDissolving.java   
@SubscribeEvent
public void onXpDrop(LivingExperienceDropEvent event) {
    if (!event.getEntity().getEntityWorld().isRemote) {
        EntityPlayer player = event.getAttackingPlayer();
        float r = random.nextFloat();
        if (player != null && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), this.identifier)) {
            if (r <= 0.80) {
                event.setDroppedExperience(0);
            } else {
                event.setDroppedExperience(event.getDroppedExperience() * (random.nextInt(3) + 2));
            }
        }
    }
}