package net.minecraft.world.item; import it.unimi.dsi.fastutil.Hash.Strategy; import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenCustomHashSet; import java.util.Set; import org.jspecify.annotations.Nullable; public class ItemStackLinkedSet { private static final Strategy TYPE_AND_TAG = new Strategy() { public int hashCode(@Nullable final ItemStack item) { return ItemStack.hashItemAndComponents(item); } public boolean equals(@Nullable final ItemStack a, @Nullable final ItemStack b) { return a == b || a != null && b != null && a.isEmpty() == b.isEmpty() && ItemStack.isSameItemSameComponents(a, b); } }; public static Set createTypeAndComponentsSet() { return new ObjectLinkedOpenCustomHashSet<>(TYPE_AND_TAG); } }