From e293687fce4727737143d3b98885004f259ae9cb Mon Sep 17 00:00:00 2001 From: pietro-lopes <97140255+pietro-lopes@users.noreply.github.com> Date: Mon, 20 May 2024 16:54:02 -0300 Subject: [PATCH] fix registry to persist script order (#810) --- .../java/dev/latvian/mods/kubejs/event/EventHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java b/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java index 47cf3d4db..f98e8fe6a 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java @@ -13,8 +13,8 @@ import org.jetbrains.annotations.Nullable; import java.util.HashMap; -import java.util.HashSet; -import java.util.IdentityHashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.function.Consumer; @@ -141,7 +141,7 @@ public void listen(ScriptType type, @Nullable Object extraId, IEventHandler hand map = eventContainers; } else { if (extraEventContainers == null) { - extraEventContainers = extra.identity ? new IdentityHashMap<>() : new HashMap<>(); + extraEventContainers = extra.identity ? new LinkedHashMap<>() : new HashMap<>(); } map = extraEventContainers.get(extraId); @@ -359,7 +359,7 @@ public Set findUniqueExtraIds(ScriptType type) { return Set.of(); } - var set = new HashSet<>(); + var set = new LinkedHashSet<>(); forEachListener(type, c -> { if (c.extraId != null) {