Example usage for net.minecraftforge.registries RegistryManager ACTIVE

List of usage examples for net.minecraftforge.registries RegistryManager ACTIVE

Introduction

In this page you can find the example usage for net.minecraftforge.registries RegistryManager ACTIVE.

Prototype

RegistryManager ACTIVE

To view the source code for net.minecraftforge.registries RegistryManager ACTIVE.

Click Source Link

Usage

From source file:robmart.rpgmode.common.helper.RegistryHelper.java

License:MIT License

/**
 * Get an entry from the provided registry.
 *
 * @param registry The registry//  w  ww  . ja v a  2s.com
 * @param name     The NAME of the entry
 * @param <T>      The registry type
 *
 * @return The registry entry
 *
 * @throws NullPointerException When the entry doesn't exist
 */
public static <T extends IForgeRegistryEntry<T>> T getRegistryEntry(final IForgeRegistry<T> registry,
        final String name) {
    final ResourceLocation key = new ResourceLocation(name);
    final T registryEntry = registry.getValue(key);
    return Preconditions.checkNotNull(registryEntry, "%s doesn't exist in registry %s", key,
            RegistryManager.ACTIVE.getName(registry));
}