Janky thing with Items#getCustomItem

This commit is contained in:
Will FP
2024-12-05 22:23:01 +00:00
parent 2a85c5ae6b
commit 7502355e15

View File

@@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@@ -64,10 +65,11 @@ public final class Items {
// this is a horribly janky fix to a problem that only exists in one third party // this is a horribly janky fix to a problem that only exists in one third party
// plugin that does things the wrong way around. // plugin that does things the wrong way around.
List<TestableItem> reversed = ImmutableList.copyOf(REGISTRY.values()).reversed(); List<TestableItem> copy = new ArrayList<>(REGISTRY.values());
Collections.reverse(copy);
TestableItem match = null; TestableItem match = null;
for (TestableItem item : reversed) { for (TestableItem item : copy) {
if (item.matches(key.getItem())) { if (item.matches(key.getItem())) {
match = item; match = item;
break; break;