From 28f5f47d9d6e4deddd2696c0f15c562f9b282410 Mon Sep 17 00:00:00 2001 From: Leo Pham Date: Sat, 29 Apr 2023 17:43:35 +1000 Subject: [PATCH] Try to fix ConcurrentModificationException (#107) --- src/main/java/com/yyon/grapplinghook/client/ClientSetup.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/yyon/grapplinghook/client/ClientSetup.java b/src/main/java/com/yyon/grapplinghook/client/ClientSetup.java index 41c44ce..b85a983 100644 --- a/src/main/java/com/yyon/grapplinghook/client/ClientSetup.java +++ b/src/main/java/com/yyon/grapplinghook/client/ClientSetup.java @@ -62,7 +62,9 @@ public static KeyMapping createKeyBinding(KeyMapping k) { @SubscribeEvent public static void clientSetup(final FMLClientSetupEvent event) { instance = new ClientSetup(); - instance.onClientSetup(); + // The onclientSetup method calls ItemProperties::register which is + // not thread-safe, so enqueue it. + event.enqueueWork(instance::onClientSetup); } private static class GrapplehookEntityRenderFactory implements EntityRendererProvider {