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

项目:FirstAid    文件:EventHandler.java   
@SubscribeEvent(priority = EventPriority.LOW)
public static void onHeal(LivingHealEvent event) {
    EntityLivingBase entity = event.getEntityLiving();
    if (!entity.hasCapability(CapabilityExtendedHealthSystem.INSTANCE, null))
        return;
    event.setCanceled(true);
    if (!FirstAid.activeHealingConfig.allowOtherHealingItems)
        return;
    float amount = event.getAmount();
    //Hacky shit to reduce vanilla regen
    if (FirstAid.activeHealingConfig.allowNaturalRegeneration && Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(stackTraceElement -> stackTraceElement.getClassName().equals(FoodStats.class.getName())))
        amount = amount * (float) FirstAid.activeHealingConfig.naturalRegenMultiplier;
    else
        amount = amount * (float) FirstAid.activeHealingConfig.otherRegenMultiplier;
    HealthDistribution.distributeHealth(amount, (EntityPlayer) entity, true);
}
项目:DynamicSurroundings    文件:HealthEffectService.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void onLivingHeal(@Nonnull final LivingHealEvent event) {
    if (!ModOptions.enableDamagePopoffs)
        return;

    if (event == null || event.getEntity() == null || event.getEntity().world == null
            || event.getEntity().world.isRemote)
        return;

    // Just in case
    if (event.getAmount() <= 0 || event.getEntityLiving() == null
            || event.getEntityLiving().getHealth() == event.getEntityLiving().getMaxHealth())
        return;

    final Entity entity = event.getEntityLiving();
    final Locus point = new Locus(entity, RANGE);
    final PacketHealthChange packet = new PacketHealthChange(entity.getEntityId(), (float) entity.posX,
            (float) entity.posY + (entity.height / 2.0F), (float) entity.posZ, false, -(int) event.getAmount());
    Network.sendToAllAround(point, packet);
}
项目:ToughExpansion    文件:ModEvents.java   
@SubscribeEvent
public void onHeal(LivingHealEvent e) {
    if (e.getEntityLiving() instanceof EntityPlayer && Options.THIRST_HEALTH_REGEN_FIX) {
        EntityPlayer player = (EntityPlayer) e.getEntityLiving();
        ThirstHandler thirstHandler = (ThirstHandler) ThirstHelper.getThirstData(player);
        int currentThirst = thirstHandler.getThirst();
        if (currentThirst < 19) {
            e.setCanceled(true);
        }
    }
}
项目:Possessed    文件:ServerEventHandler.java   
@SubscribeEvent
public void onLivingHeal(LivingHealEvent event) {
    if (event.getEntityLiving() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntityLiving();
        PossessivePlayer possessivePlayer = PossessHandler.get(player);
        if (possessivePlayer != null) {
            possessivePlayer.getPossessing().heal(event.getAmount());
            event.setCanceled(true);
        }
    }
}
项目:TerrafirmaPunk-Tweaks    文件:PlayerDamageHandler.java   
/**
 * TFC scaled healing handler
 * @param event
 */
@SubscribeEvent
public void onHeal(LivingHealEvent event)
{
    if(event.amount > 1 && event.amount < 9 && ConfigSettings.InstantHealingScaling)
        event.amount = event.amount * ConfigSettings.VanillaHealingMultipier;
}
项目:Kingdom-Keys-Re-Coded    文件:DriveFormAnti.java   
@SubscribeEvent
public static void healEvent(LivingHealEvent event) {
    if (event.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getEntity();

           DriveStateCapability.IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);

        if(DRIVE.getActiveDriveName().equals(Strings.Form_Anti)) {
            event.setCanceled(true);
        }
    }
}
项目:CustomWorldGen    文件:ForgeEventFactory.java   
public static float onLivingHeal(EntityLivingBase entity, float amount)
{
    LivingHealEvent event = new LivingHealEvent(entity, amount);
    return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount());
}
项目:TRHS_Club_Mod_2016    文件:ForgeEventFactory.java   
public static float onLivingHeal(EntityLivingBase entity, float amount)
{
    LivingHealEvent event = new LivingHealEvent(entity, amount);
    return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.amount);
}
项目:Alchemy    文件:ExPotion.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onLivingHeal(LivingHealEvent event) {
    if (event.getEntityLiving().isPotionActive(MobEffects.WITHER))
        AlchemyEventSystem.markEventCanceled(event);
}
项目:Alchemy    文件:ItemAmuletHeal.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void onLivingHeal(LivingHealEvent event) {
    if (isEquipmented(event.getEntityLiving()))
        event.setAmount(event.getAmount() * (1 + AMPLIFY));
}
项目:Bewitchment    文件:IBrewHeal.java   
void onHeal(LivingHealEvent event, EntityLivingBase healed, int amplifier);