Use ConcurrentHashMap inside RegistryAttributeImpl (#3970)

(cherry picked from commit a5d6675361)
This commit is contained in:
apple502j
2024-07-29 22:35:03 +09:00
committed by modmuss50
parent 29c642ab01
commit c7d49fa1f0

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());