// Path: src/main/java/org/cyclops/everlastingabilities/ability/AbilityTypePotionEffectRadius.java
// public class AbilityTypePotionEffectRadius extends AbilityTypeDefault {
// 
//     private static final int TICK_MODULUS = MinecraftHelpers.SECOND_IN_TICKS / 2;
// 
//     private final Effect potion;
//     private boolean hostile;
// 
//     public AbilityTypePotionEffectRadius(String id, Supplier<Integer> rarity, Supplier<Integer> maxLevel,
//                                          Supplier<Integer> baseXpPerLevel, Supplier<Boolean> obtainableOnPlayerSpawn, Supplier<Boolean> obtainableOnMobSpawn,
//                                          Supplier<Boolean> obtainableOnCraft, Supplier<Boolean> obtainableOnLoot, Effect potion, boolean isHostile) {
//         super(id, rarity, maxLevel, baseXpPerLevel, obtainableOnPlayerSpawn, obtainableOnMobSpawn, obtainableOnCraft, obtainableOnLoot);
//         this.potion = potion;
//         this.hostile = isHostile;
//         if (this.potion == null) {
//             EverlastingAbilities.clog(Level.WARN, "Tried to register a null potion for ability " + id + ". This is possibly caused by a mod forcefully removing the potion effect for this ability.");
//         }
//     }
//     public AbilityTypePotionEffectRadius(String id, Supplier<Integer> rarity, Supplier<Integer> maxLevel,
//                                          Supplier<Integer> baseXpPerLevel, Supplier<Boolean> obtainableOnPlayerSpawn, Supplier<Boolean> obtainableOnMobSpawn,
//                                          Supplier<Boolean> obtainableOnCraft, Supplier<Boolean> obtainableOnLoot, Effect potion) {
//         this(id, rarity, maxLevel, baseXpPerLevel, obtainableOnPlayerSpawn, obtainableOnMobSpawn, obtainableOnCraft, obtainableOnLoot, potion, true);
//     }
// 
//     protected int getDuration(int tickModulus, int level) {
//         return tickModulus * 6;
//     }
// 
//     protected int getTickModulus(int level) {
//         return TICK_MODULUS;
//     }
// 
//     protected int getAmplifier(int level) {
//         return level - 1;
//     }
// 
//     @Override
//     public void onTick(PlayerEntity player, int level) {
//         World world = player.world;
//         if (potion != null && !world.isRemote && player.world.getGameTime() % getTickModulus(level) == 0) {
//             int radius = level * 2;
//             List<LivingEntity> mobs = world.getEntitiesWithinAABB(LivingEntity.class,
//                     player.getBoundingBox().grow(radius, radius, radius), EntityPredicates.NOT_SPECTATING);
//             for (LivingEntity mob : mobs) {
//                 if (!(this.hostile && isFriendlyMob(mob, player))) {
//                     mob.addPotionEffect(new EffectInstance(potion, getDuration(getTickModulus(level), level), getAmplifier(level), true, GeneralConfig.showPotionEffectParticles));
//                 }
//             }
//         }
//     }
// 
//     static boolean isFriendlyMob(LivingEntity mob, PlayerEntity player) {
//         ResourceLocation resourceLocation = mob instanceof PlayerEntity
//                 ? new ResourceLocation("player") : ForgeRegistries.ENTITIES.getKey(mob.getType());
//         String mobName = resourceLocation == null ? "null" : resourceLocation.toString();
//         return (mob == player ||
//                 player.isOnSameTeam(mob) ||
//                 // TODO TameableEntity was IEntityOwnable
//                 (mob instanceof TameableEntity && ((TameableEntity) mob).getOwner() == player) ||
//                 GeneralConfig.friendlyMobs.stream().anyMatch(mobName::matches));
//     }
// 
// }
// 
// Path: src/main/java/org/cyclops/everlastingabilities/core/config/extendedconfig/AbilityConfig.java
// public abstract class AbilityConfig<T> extends ExtendedConfigForge<AbilityConfig<T>, IAbilityType> {
// 
//     public AbilityConfig(String namedId, Function<AbilityConfig<T>, ? extends IAbilityType> elementConstructor) {
//         super(EverlastingAbilities._instance, namedId, elementConstructor);
//     }
//     
//     @Override
// 	public String getTranslationKey() {
// 		return "ability." + getNamedId();
// 	}
// 
//     @Override
//     public String getFullTranslationKey() {
//         return "ability.abilities." + getMod().getModId()  + "." +getNamedId() + ".name";
//     }
// 
//     @Override
//     public ConfigurableType getConfigurableType() {
//         return ExtendedConfigurableType.ABILITY;
//     }
// 
//     @Override
//     public IForgeRegistry<? super IAbilityType> getRegistry() {
//         return AbilityTypes.REGISTRY;
//     }
// }


import net.minecraft.item.Rarity;
import net.minecraft.potion.Effects;
import net.minecraftforge.fml.config.ModConfig;
import org.cyclops.cyclopscore.config.ConfigurableProperty;
import org.cyclops.everlastingabilities.ability.AbilityTypePotionEffectRadius;
import org.cyclops.everlastingabilities.core.config.extendedconfig.AbilityConfig;
package org.cyclops.everlastingabilities.ability.config;


/**
 * Config for an ability.
 * @author rubensworks
 *
 */
public class AbilityMiningFatigueConfig extends AbilityConfig<AbilityTypePotionEffectRadius> {

    @ConfigurableProperty(category = "ability", comment = "Rarity of this ability.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
    public static int rarity = Rarity.UNCOMMON.ordinal();

// Path: src/main/java/org/cyclops/everlastingabilities/ability/AbilityTypePotionEffectRadius.java
// public class AbilityTypePotionEffectRadius extends AbilityTypeDefault {
// 
//     private static final int TICK_MODULUS = MinecraftHelpers.SECOND_IN_TICKS / 2;
// 
//     private final Effect potion;
//     private boolean hostile;
// 
//     public AbilityTypePotionEffectRadius(String id, Supplier<Integer> rarity, Supplier<Integer> maxLevel,
//                                          Supplier<Integer> baseXpPerLevel, Supplier<Boolean> obtainableOnPlayerSpawn, Supplier<Boolean> obtainableOnMobSpawn,
//                                          Supplier<Boolean> obtainableOnCraft, Supplier<Boolean> obtainableOnLoot, Effect potion, boolean isHostile) {
//         super(id, rarity, maxLevel, baseXpPerLevel, obtainableOnPlayerSpawn, obtainableOnMobSpawn, obtainableOnCraft, obtainableOnLoot);
//         this.potion = potion;
//         this.hostile = isHostile;
//         if (this.potion == null) {
//             EverlastingAbilities.clog(Level.WARN, "Tried to register a null potion for ability " + id + ". This is possibly caused by a mod forcefully removing the potion effect for this ability.");
//         }
//     }
//     public AbilityTypePotionEffectRadius(String id, Supplier<Integer> rarity, Supplier<Integer> maxLevel,
//                                          Supplier<Integer> baseXpPerLevel, Supplier<Boolean> obtainableOnPlayerSpawn, Supplier<Boolean> obtainableOnMobSpawn,
//                                          Supplier<Boolean> obtainableOnCraft, Supplier<Boolean> obtainableOnLoot, Effect potion) {
//         this(id, rarity, maxLevel, baseXpPerLevel, obtainableOnPlayerSpawn, obtainableOnMobSpawn, obtainableOnCraft, obtainableOnLoot, potion, true);
//     }
// 
//     protected int getDuration(int tickModulus, int level) {
//         return tickModulus * 6;
//     }
// 
//     protected int getTickModulus(int level) {
//         return TICK_MODULUS;
//     }
// 
//     protected int getAmplifier(int level) {
//         return level - 1;
//     }
// 
//     @Override
//     public void onTick(PlayerEntity player, int level) {
//         World world = player.world;
//         if (potion != null && !world.isRemote && player.world.getGameTime() % getTickModulus(level) == 0) {
//             int radius = level * 2;
//             List<LivingEntity> mobs = world.getEntitiesWithinAABB(LivingEntity.class,
//                     player.getBoundingBox().grow(radius, radius, radius), EntityPredicates.NOT_SPECTATING);
//             for (LivingEntity mob : mobs) {
//                 if (!(this.hostile && isFriendlyMob(mob, player))) {
//                     mob.addPotionEffect(new EffectInstance(potion, getDuration(getTickModulus(level), level), getAmplifier(level), true, GeneralConfig.showPotionEffectParticles));
//                 }
//             }
//         }
//     }
// 
//     static boolean isFriendlyMob(LivingEntity mob, PlayerEntity player) {
//         ResourceLocation resourceLocation = mob instanceof PlayerEntity
//                 ? new ResourceLocation("player") : ForgeRegistries.ENTITIES.getKey(mob.getType());
//         String mobName = resourceLocation == null ? "null" : resourceLocation.toString();
//         return (mob == player ||
//                 player.isOnSameTeam(mob) ||
//                 // TODO TameableEntity was IEntityOwnable
//                 (mob instanceof TameableEntity && ((TameableEntity) mob).getOwner() == player) ||
//                 GeneralConfig.friendlyMobs.stream().anyMatch(mobName::matches));
//     }
// 
// }
// 
// Path: src/main/java/org/cyclops/everlastingabilities/core/config/extendedconfig/AbilityConfig.java
// public abstract class AbilityConfig<T> extends ExtendedConfigForge<AbilityConfig<T>, IAbilityType> {
// 
//     public AbilityConfig(String namedId, Function<AbilityConfig<T>, ? extends IAbilityType> elementConstructor) {
//         super(EverlastingAbilities._instance, namedId, elementConstructor);
//     }
//     
//     @Override
// 	public String getTranslationKey() {
// 		return "ability." + getNamedId();
// 	}
// 
//     @Override
//     public String getFullTranslationKey() {
//         return "ability.abilities." + getMod().getModId()  + "." +getNamedId() + ".name";
//     }
// 
//     @Override
//     public ConfigurableType getConfigurableType() {
//         return ExtendedConfigurableType.ABILITY;
//     }
// 
//     @Override
//     public IForgeRegistry<? super IAbilityType> getRegistry() {
//         return AbilityTypes.REGISTRY;
//     }
// }


// Path: src/main/java/org/cyclops/everlastingabilities/ability/config/AbilityMiningFatigueConfig.java
import net.minecraft.item.Rarity;
import net.minecraft.potion.Effects;
import net.minecraftforge.fml.config.ModConfig;
import org.cyclops.cyclopscore.config.ConfigurableProperty;
import org.cyclops.everlastingabilities.ability.AbilityTypePotionEffectRadius;
import org.cyclops.everlastingabilities.core.config.extendedconfig.AbilityConfig;

package org.cyclops.everlastingabilities.ability.config;


/**
 * Config for an ability.
 * @author rubensworks
 *
 */
public class AbilityMiningFatigueConfig extends AbilityConfig<AbilityTypePotionEffectRadius> {

    @ConfigurableProperty(category = "ability", comment = "Rarity of this ability.", isCommandable = true, configLocation = ModConfig.Type.SERVER)
    public static int rarity = Rarity.UNCOMMON.ordinal();

    @ConfigurableProperty(category = "ability", comment = "The maximum ability level.", isCommandable = true, configLocation = ModConfig.Type.SERVER)