Search in sources :

Example 1 with SpongeRegistryHolder

use of org.spongepowered.common.registry.SpongeRegistryHolder in project SpongeCommon by SpongePowered.

the class AbstractRegisterRegistryEvent method register.

@Override
public <T> RegistryType<T> register(final ResourceKey key, final boolean isDynamic) throws DuplicateRegistrationException {
    Objects.requireNonNull(key, "key");
    final SpongeRegistryHolder holder = this.getHolder();
    final RegistryType<T> type = RegistryType.of(RegistryRoots.SPONGE, key);
    holder.createRegistry(type, (RegistryLoader<T>) null, isDynamic);
    return type;
}
Also used : SpongeRegistryHolder(org.spongepowered.common.registry.SpongeRegistryHolder)

Example 2 with SpongeRegistryHolder

use of org.spongepowered.common.registry.SpongeRegistryHolder in project SpongeCommon by SpongePowered.

the class AbstractRegisterRegistryEvent method register.

@Override
public <T> RegistryType<T> register(final ResourceKey key, final boolean isDynamic, final Supplier<Map<ResourceKey, T>> defaultValues) throws DuplicateRegistrationException {
    Objects.requireNonNull(key, "key");
    Objects.requireNonNull(defaultValues, "defaultValues");
    final SpongeRegistryHolder holder = this.getHolder();
    final RegistryType<T> type = RegistryType.of(RegistryRoots.SPONGE, key);
    holder.createRegistry(type, defaultValues, isDynamic);
    return type;
}
Also used : SpongeRegistryHolder(org.spongepowered.common.registry.SpongeRegistryHolder)

Aggregations

SpongeRegistryHolder (org.spongepowered.common.registry.SpongeRegistryHolder)2