Example usage for net.minecraftforge.registries ForgeRegistries ENCHANTMENTS

List of usage examples for net.minecraftforge.registries ForgeRegistries ENCHANTMENTS

Introduction

In this page you can find the example usage for net.minecraftforge.registries ForgeRegistries ENCHANTMENTS.

Prototype

IForgeRegistry ENCHANTMENTS

To view the source code for net.minecraftforge.registries ForgeRegistries ENCHANTMENTS.

Click Source Link

Usage

From source file:com.teambrmodding.assistedprogression.common.commands.GetEnchantmentList.java

License:Creative Commons License

/**
 * List all enchants that are registered. Outputs to console
 *
 * @param dispatcher {@link CommandDispatcher}
 *//*from   w  ww .j av  a  2s  . c  om*/
public GetEnchantmentList(CommandDispatcher<CommandSource> dispatcher) {
    dispatcher.register(literal("listEnchants").requires(cs -> cs.hasPermissionLevel(0)).executes(ctx -> {
        for (Enchantment enchantment : ForgeRegistries.ENCHANTMENTS.getValues()) {
            ResourceLocation enchant = enchantment.getRegistryName();
            LogManager.getLogger(Reference.MOD_ID).warn(enchant.getNamespace() + "-" + enchant.getPath());
        }
        return 0;
    }));
}