aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java/me/shedaniel/rei/impl/common
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-10-22 22:39:04 +0800
committershedaniel <daniel@shedaniel.me>2022-10-22 22:39:04 +0800
commit83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e (patch)
treedb95f347f2e784c4adf17e7ce0acd9a1fe239f08 /runtime/src/main/java/me/shedaniel/rei/impl/common
parent438d2387f330ffe8b328c4990498efa175b88a68 (diff)
downloadRoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.tar.gz
RoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.tar.bz2
RoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.zip
Support 22w42a
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/impl/common')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java28
1 files changed, 2 insertions, 26 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java
index 293f3bc3e..ab01910f1 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java
@@ -33,17 +33,13 @@ import me.shedaniel.rei.api.client.overlay.ScreenOverlay;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.entry.EntryRegistry;
import me.shedaniel.rei.api.common.entry.EntryStack;
-import me.shedaniel.rei.api.common.entry.comparison.ComparisonContext;
-import me.shedaniel.rei.api.common.entry.type.EntryDefinition;
-import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes;
import me.shedaniel.rei.api.common.registry.ReloadStage;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.impl.common.InternalLogger;
+import me.shedaniel.rei.impl.VersionAdapter;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.core.NonNullList;
-import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.ApiStatus;
@@ -135,27 +131,7 @@ public class EntryRegistryImpl implements EntryRegistry {
@Override
public List<ItemStack> appendStacksForItem(Item item) {
- NonNullList<ItemStack> list = NonNullList.create();
- LongSet set = new LongOpenHashSet();
- EntryDefinition<ItemStack> itemDefinition = VanillaEntryTypes.ITEM.getDefinition();
- for (CreativeModeTab tab : CreativeModeTab.TABS) {
- if (tab != CreativeModeTab.TAB_HOTBAR && tab != CreativeModeTab.TAB_INVENTORY) {
- NonNullList<ItemStack> tabList = NonNullList.create();
- item.fillItemCategory(tab, tabList);
- for (ItemStack stack : tabList) {
- if (set.add(itemDefinition.hash(null, stack, ComparisonContext.EXACT))) {
- list.add(stack);
- }
- }
- }
- }
- if (list.isEmpty()) {
- return Collections.singletonList(item.getDefaultInstance());
- }
- if (list.size() > 1) {
- list.sort(STACK_COMPARATOR);
- }
- return list;
+ return VersionAdapter.INSTANCE.appendStacksForItem(item, STACK_COMPARATOR);
}
@ApiStatus.Internal