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 6bed614af..a553023d5 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 @@ -14,8 +14,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; @@ -142,7 +142,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); @@ -362,7 +362,7 @@ public Set findUniqueExtraIds(ScriptType type) { return Set.of(); } - var set = new HashSet<>(); + var set = new LinkedHashSet<>(); forEachListener(type, c -> { if (c.extraId != null) {