// Path: src/main/java/org/cyclops/everlastingabilities/api/AbilityTypes.java
// @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
// public class AbilityTypes {
// 
//     public static IForgeRegistry<IAbilityType> REGISTRY;
// 
//     @SubscribeEvent
//     public static void onRegistriesCreate(RegistryEvent.NewRegistry event) {
//         REGISTRY = new RegistryBuilder<IAbilityType>()
//                 .setName(new ResourceLocation("everlastingabilities", "abilities"))
//                 .setType(IAbilityType.class)
//                 .create();
//     }
// 
// }
// 
// Path: src/main/java/org/cyclops/everlastingabilities/api/IAbilityType.java
// public interface IAbilityType extends IForgeRegistryEntry<IAbilityType> {
// 
//     public String getTranslationKey();
//     public String getUnlocalizedDescription();
//     public Rarity getRarity();
//     public int getMaxLevel();
//     public default int getMaxLevelInfinitySafe() {
//         return getMaxLevel() < 0 ? Integer.MAX_VALUE : getMaxLevel();
//     }
//     public int getBaseXpPerLevel();
//     public boolean isObtainableOnPlayerSpawn();
//     public boolean isObtainableOnMobSpawn();
//     public boolean isObtainableOnCraft();
//     public boolean isObtainableOnLoot();
// 
//     public void onTick(PlayerEntity player, int level);
//     public void onChangedLevel(PlayerEntity player, int oldLevel, int newLevel);
// 
// }


import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.ISuggestionProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.cyclops.everlastingabilities.api.AbilityTypes;
import org.cyclops.everlastingabilities.api.IAbilityType;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
package org.cyclops.everlastingabilities.command.argument;



/**
 * An argument type for an ability.
 * @author rubensworks
 */
public class ArgumentTypeAbility implements ArgumentType<IAbilityType> {

    @Override
    public IAbilityType parse(StringReader reader) throws CommandSyntaxException {
        ResourceLocation id = ResourceLocation.read(reader);
        IAbilityType abilityType = AbilityTypes.REGISTRY.getValue(id);
        if (abilityType == null) {
            throw new SimpleCommandExceptionType(new TranslationTextComponent("chat.everlastingabilities.command.invalidAbility", id)).create();
        }
        return abilityType;
    }

    @Override
    public Collection<String> getExamples() {
        return AbilityTypes.REGISTRY.getValues().stream()
                .map(IForgeRegistryEntry::getRegistryName)
                .map(ResourceLocation::toString)
                .collect(Collectors.toList());
    }

    @Override
// Path: src/main/java/org/cyclops/everlastingabilities/api/AbilityTypes.java
// @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
// public class AbilityTypes {
// 
//     public static IForgeRegistry<IAbilityType> REGISTRY;
// 
//     @SubscribeEvent
//     public static void onRegistriesCreate(RegistryEvent.NewRegistry event) {
//         REGISTRY = new RegistryBuilder<IAbilityType>()
//                 .setName(new ResourceLocation("everlastingabilities", "abilities"))
//                 .setType(IAbilityType.class)
//                 .create();
//     }
// 
// }
// 
// Path: src/main/java/org/cyclops/everlastingabilities/api/IAbilityType.java
// public interface IAbilityType extends IForgeRegistryEntry<IAbilityType> {
// 
//     public String getTranslationKey();
//     public String getUnlocalizedDescription();
//     public Rarity getRarity();
//     public int getMaxLevel();
//     public default int getMaxLevelInfinitySafe() {
//         return getMaxLevel() < 0 ? Integer.MAX_VALUE : getMaxLevel();
//     }
//     public int getBaseXpPerLevel();
//     public boolean isObtainableOnPlayerSpawn();
//     public boolean isObtainableOnMobSpawn();
//     public boolean isObtainableOnCraft();
//     public boolean isObtainableOnLoot();
// 
//     public void onTick(PlayerEntity player, int level);
//     public void onChangedLevel(PlayerEntity player, int oldLevel, int newLevel);
// 
// }


// Path: src/main/java/org/cyclops/everlastingabilities/command/argument/ArgumentTypeAbility.java
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.command.ISuggestionProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.registries.IForgeRegistryEntry;
import org.cyclops.everlastingabilities.api.AbilityTypes;
import org.cyclops.everlastingabilities.api.IAbilityType;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

package org.cyclops.everlastingabilities.command.argument;



/**
 * An argument type for an ability.
 * @author rubensworks
 */
public class ArgumentTypeAbility implements ArgumentType<IAbilityType> {

    @Override
    public IAbilityType parse(StringReader reader) throws CommandSyntaxException {
        ResourceLocation id = ResourceLocation.read(reader);
        IAbilityType abilityType = AbilityTypes.REGISTRY.getValue(id);
        if (abilityType == null) {
            throw new SimpleCommandExceptionType(new TranslationTextComponent("chat.everlastingabilities.command.invalidAbility", id)).create();
        }
        return abilityType;
    }

    @Override
    public Collection<String> getExamples() {
        return AbilityTypes.REGISTRY.getValues().stream()
                .map(IForgeRegistryEntry::getRegistryName)
                .map(ResourceLocation::toString)
                .collect(Collectors.toList());
    }

    @Override
    public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {