// Path: src/main/java/derpatiel/progressivediff/api/DifficultyModifier.java
// public abstract class DifficultyModifier {
// 
//     public abstract int getMaxInstances();
//     public void handleUpkeepEvent(int numInstances, EntityLiving entity){}
//     public void handleDamageEvent(LivingAttackEvent event){}
//     public void handleSpawnEvent(int numInstances, EntityLiving entity){}
//     public abstract int costPerChange();
//     public abstract double getWeight();
//     public abstract String getIdentifier();
//     public boolean validForEntity(EntityLiving entity){
//         return true;
//     }
// }
// 
// Path: src/main/java/derpatiel/progressivediff/MobUpkeepController.java
// public class MobUpkeepController {
// 
//     public static final int UPKEEP_INTERVAL = 10;//upkeep every half second
//     public static final int POTION_EFFECT_LENGTH = 15;//.75 second potion effect length (a tiny bit longer than the upkeep, in case of lag or something)
// 
//     private static int upkeepCount=0;
// 
//     public static void tick(World world){
//         upkeepCount++;
//         if(upkeepCount>=UPKEEP_INTERVAL){
//             upkeepCount=0;
//             doUpkeep(world);
//         }
//     }
// 
//     private static void doUpkeep(World world){
//         List<EntityLiving> modifiedEntities = MobNBTHandler.getModifiedEntities(world);
// 
//         for(EntityLiving entity : modifiedEntities){
//             String regionName = MobNBTHandler.getEntityRegion(entity);
//             Map<String,Integer> changes = MobNBTHandler.getChangeMap(entity);
//             Region region = DifficultyManager.getRegionByName(regionName);
//             String mobId = EntityList.getEntityString(entity);
//             for(String change : changes.keySet()){
//                 try {
//                     DifficultyModifier modifier = region.getModifierForMobById(mobId,change);
//                     if (modifier != null) {
//                         modifier.handleUpkeepEvent(changes.get(change), entity);
//                     }
//                 }catch(Exception e){
//                     LOG.warn("Error applying modifier at upkeep.  Mob was "+entity.getName()+", Modifier was "+change+".  Please report to Progressive Difficulty Developer!");
//                     LOG.warn("\tCaught Exception had message "+e.getMessage());
//                 }
//             }
//         }
//     }
// }


import com.google.common.collect.Lists;
import derpatiel.progressivediff.api.DifficultyModifier;
import derpatiel.progressivediff.MobUpkeepController;
import net.minecraft.entity.EntityLiving;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import java.util.List;
import java.util.function.Function;
        this.diffCostPerLevelResistance = diffCostPerLevelResistance;
        this.selectionWeight = selectionWeight;
    }

    @Override
    public int getMaxInstances() {
        return maxResistanceLevel;
    }

    @Override
    public void handleUpkeepEvent(int numChanges, EntityLiving entity) {
        entity.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, MobUpkeepController.POTION_EFFECT_LENGTH,numChanges,false,true));

    }

    @Override
    public int costPerChange() {
        return diffCostPerLevelResistance;
    }

    @Override
    public double getWeight() {
        return selectionWeight;
    }

    @Override
    public String getIdentifier() {
        return IDENTIFIER;
    }

// Path: src/main/java/derpatiel/progressivediff/api/DifficultyModifier.java
// public abstract class DifficultyModifier {
// 
//     public abstract int getMaxInstances();
//     public void handleUpkeepEvent(int numInstances, EntityLiving entity){}
//     public void handleDamageEvent(LivingAttackEvent event){}
//     public void handleSpawnEvent(int numInstances, EntityLiving entity){}
//     public abstract int costPerChange();
//     public abstract double getWeight();
//     public abstract String getIdentifier();
//     public boolean validForEntity(EntityLiving entity){
//         return true;
//     }
// }
// 
// Path: src/main/java/derpatiel/progressivediff/MobUpkeepController.java
// public class MobUpkeepController {
// 
//     public static final int UPKEEP_INTERVAL = 10;//upkeep every half second
//     public static final int POTION_EFFECT_LENGTH = 15;//.75 second potion effect length (a tiny bit longer than the upkeep, in case of lag or something)
// 
//     private static int upkeepCount=0;
// 
//     public static void tick(World world){
//         upkeepCount++;
//         if(upkeepCount>=UPKEEP_INTERVAL){
//             upkeepCount=0;
//             doUpkeep(world);
//         }
//     }
// 
//     private static void doUpkeep(World world){
//         List<EntityLiving> modifiedEntities = MobNBTHandler.getModifiedEntities(world);
// 
//         for(EntityLiving entity : modifiedEntities){
//             String regionName = MobNBTHandler.getEntityRegion(entity);
//             Map<String,Integer> changes = MobNBTHandler.getChangeMap(entity);
//             Region region = DifficultyManager.getRegionByName(regionName);
//             String mobId = EntityList.getEntityString(entity);
//             for(String change : changes.keySet()){
//                 try {
//                     DifficultyModifier modifier = region.getModifierForMobById(mobId,change);
//                     if (modifier != null) {
//                         modifier.handleUpkeepEvent(changes.get(change), entity);
//                     }
//                 }catch(Exception e){
//                     LOG.warn("Error applying modifier at upkeep.  Mob was "+entity.getName()+", Modifier was "+change+".  Please report to Progressive Difficulty Developer!");
//                     LOG.warn("\tCaught Exception had message "+e.getMessage());
//                 }
//             }
//         }
//     }
// }


// Path: src/main/java/derpatiel/progressivediff/modifiers/AddResistanceModifier.java
import com.google.common.collect.Lists;
import derpatiel.progressivediff.api.DifficultyModifier;
import derpatiel.progressivediff.MobUpkeepController;
import net.minecraft.entity.EntityLiving;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import java.util.List;
import java.util.function.Function;

        this.diffCostPerLevelResistance = diffCostPerLevelResistance;
        this.selectionWeight = selectionWeight;
    }

    @Override
    public int getMaxInstances() {
        return maxResistanceLevel;
    }

    @Override
    public void handleUpkeepEvent(int numChanges, EntityLiving entity) {
        entity.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, MobUpkeepController.POTION_EFFECT_LENGTH,numChanges,false,true));

    }

    @Override
    public int costPerChange() {
        return diffCostPerLevelResistance;
    }

    @Override
    public double getWeight() {
        return selectionWeight;
    }

    @Override
    public String getIdentifier() {
        return IDENTIFIER;
    }

    public static Function<Configuration, List<DifficultyModifier>> getFromConfig = config -> {