Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.21.x] Test preserving iteration order in AttributeUtil #1831

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

package net.neoforged.neoforge.common.util;

import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import com.mojang.datafixers.util.Pair;
import it.unimi.dsi.fastutil.objects.Reference2ReferenceLinkedOpenHashMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -153,7 +154,7 @@ public static void applyTextFor(ItemStack stack, Consumer<Component> tooltip, Mu
}

// Collect all the base modifiers
Map<Holder<Attribute>, BaseModifier> baseModifs = new IdentityHashMap<>();
Map<Holder<Attribute>, BaseModifier> baseModifs = new Reference2ReferenceLinkedOpenHashMap<>();

var it = modifierMap.entries().iterator();
while (it.hasNext()) {
Expand Down Expand Up @@ -287,7 +288,8 @@ public static void addPotionTooltip(List<Pair<Holder<Attribute>, AttributeModifi
* Creates a sorted {@link TreeMultimap} used to ensure a stable iteration order of item attribute modifiers.
*/
public static Multimap<Holder<Attribute>, AttributeModifier> sortedMap() {
return TreeMultimap.create(Comparator.comparing(Holder::getKey), ATTRIBUTE_MODIFIER_COMPARATOR);
return LinkedListMultimap.create();
// return TreeMultimap.create(Comparator.comparing(Holder::getKey), ATTRIBUTE_MODIFIER_COMPARATOR);
}

/**
Expand Down
Loading