From ded18c4ee6989cb9926c8f626861c7ddf5c5e84f Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 29 Apr 2024 12:15:30 -0400 Subject: [PATCH 1/3] Fix concurrency issue in IdentityHashMap --- .../com/simibubi/create/foundation/data/CreateRegistrate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index b50e38bd3..1eda3db41 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.data; import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly; +import java.util.Collections; import java.util.IdentityHashMap; import java.util.Map; import java.util.function.BiConsumer; @@ -52,7 +53,7 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.registries.RegistryObject; public class CreateRegistrate extends AbstractRegistrate { - private static final Map, RegistryObject> TAB_LOOKUP = new IdentityHashMap<>(); + private static final Map, RegistryObject> TAB_LOOKUP = Collections.synchronizedMap(new IdentityHashMap<>()); @Nullable protected Function currentTooltipModifierFactory; From 4f4b21c0a5d67379214e78f72781dfbc3e2696b4 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 29 Apr 2024 15:18:13 -0400 Subject: [PATCH 2/3] modify fix --- .../simibubi/create/foundation/data/CreateRegistrate.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 1eda3db41..51a3ba4d3 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -2,9 +2,8 @@ package com.simibubi.create.foundation.data; import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly; -import java.util.Collections; -import java.util.IdentityHashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; @@ -53,7 +52,7 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.registries.RegistryObject; public class CreateRegistrate extends AbstractRegistrate { - private static final Map, RegistryObject> TAB_LOOKUP = Collections.synchronizedMap(new IdentityHashMap<>()); + private static final Map, RegistryObject> TAB_LOOKUP = new ConcurrentHashMap<>(); @Nullable protected Function currentTooltipModifierFactory; From 600fdb674e859122c9073bc4aea006726329edfd Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 1 May 2024 09:11:07 -0400 Subject: [PATCH 3/3] switch back to IHM --- .../simibubi/create/foundation/data/CreateRegistrate.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 51a3ba4d3..1eda3db41 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -2,8 +2,9 @@ package com.simibubi.create.foundation.data; import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly; +import java.util.Collections; +import java.util.IdentityHashMap; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; @@ -52,7 +53,7 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.registries.RegistryObject; public class CreateRegistrate extends AbstractRegistrate { - private static final Map, RegistryObject> TAB_LOOKUP = new ConcurrentHashMap<>(); + private static final Map, RegistryObject> TAB_LOOKUP = Collections.synchronizedMap(new IdentityHashMap<>()); @Nullable protected Function currentTooltipModifierFactory;