Use ConcurrentHashMap inside RegistryAttributeImpl ()

This commit is contained in:
apple502j 2024-07-29 22:35:03 +09:00 committed by GitHub
parent f9000df732
commit a5d6675361
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,8 +17,8 @@
package net.fabricmc.fabric.impl.registry.sync;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.registry.RegistryKey;
@ -26,7 +26,7 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute;
import net.fabricmc.fabric.api.event.registry.RegistryAttributeHolder;
public final class RegistryAttributeImpl implements RegistryAttributeHolder {
private static final Map<RegistryKey<?>, RegistryAttributeHolder> HOLDER_MAP = new HashMap<>();
private static final Map<RegistryKey<?>, RegistryAttributeHolder> HOLDER_MAP = new ConcurrentHashMap<>();
public static RegistryAttributeHolder getHolder(RegistryKey<?> registryKey) {
return HOLDER_MAP.computeIfAbsent(registryKey, key -> new RegistryAttributeImpl());