Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MerchantPug committed May 18, 2023
1 parent 16181a2 commit 78094a5
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class CalioDynamicRegistryManager implements ICalioDynamicRegistryManager
private final List<ResourceKey<?>> validatorOrder;

public CalioDynamicRegistryManager() {
this.registries = new HashMap<>();
this.registries = new ConcurrentHashMap<>();
this.definitions = new HashMap<>();
this.factories = new HashMap<>();
this.validators = new HashMap<>();
Expand Down Expand Up @@ -264,11 +264,9 @@ public <T> WritableRegistry<T> reset(ResourceKey<Registry<T>> key) {
}

@Override
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
public @NotNull <T> WritableRegistry<T> get(@NotNull ResourceKey<Registry<T>> key) {
MappedRegistry<?> registry = this.registries.get(key);
if (registry == null)
throw new IllegalArgumentException("Registry " + key + " was missing.");
MappedRegistry<?> registry = this.registries.computeIfAbsent(key, k -> this.definitions.get(k).newRegistry((ResourceKey)k));
return (MappedRegistry<T>) registry;
}

Expand Down

0 comments on commit 78094a5

Please sign in to comment.