From 5315d808590e41478dc9c3cdc1ca6fdf983cf98d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:01:18 -0400 Subject: [PATCH] Use synchronized HashMap instead of CHM to permit null keys for buggy mods Related: #157 --- .../modernfix/common/mixin/safety/ItemPropertiesMixin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/safety/ItemPropertiesMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/safety/ItemPropertiesMixin.java index 7429ea3d..883b5dab 100644 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/safety/ItemPropertiesMixin.java +++ b/common/src/main/java/org/embeddedt/modernfix/common/mixin/safety/ItemPropertiesMixin.java @@ -13,8 +13,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Collections; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; @Mixin(value = ItemProperties.class, priority = 700) @ClientOnlyMixin @@ -24,7 +24,7 @@ public class ItemPropertiesMixin { @Inject(method = "", at = @At("RETURN")) private static void useConcurrentMaps(CallbackInfo ci) { - GENERIC_PROPERTIES = new ConcurrentHashMap<>(GENERIC_PROPERTIES); - PROPERTIES = new ConcurrentHashMap<>(PROPERTIES); + GENERIC_PROPERTIES = Collections.synchronizedMap(GENERIC_PROPERTIES); + PROPERTIES = Collections.synchronizedMap(PROPERTIES); } }