aboutsummaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-06-11 01:06:08 +0800
committershedaniel <daniel@shedaniel.me>2022-06-11 01:06:08 +0800
commita27be9cf41c39eff119be86c035b7611111610b0 (patch)
tree24c5e4eda83459a1794e23e2cf32cbd3b1931d3f /runtime/src
parent4a8a83a1bfc68eeb80581cde55ef23d16e59f52c (diff)
downloadRoughlyEnoughItems-a27be9cf41c39eff119be86c035b7611111610b0.tar.gz
RoughlyEnoughItems-a27be9cf41c39eff119be86c035b7611111610b0.tar.bz2
RoughlyEnoughItems-a27be9cf41c39eff119be86c035b7611111610b0.zip
Fix #874
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java20
1 files changed, 18 insertions, 2 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 1aa49902b..28baa75c1 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
@@ -36,6 +36,11 @@ 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.EntryType;
+import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry;
+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;
@@ -172,8 +177,19 @@ public class EntryRegistryImpl implements EntryRegistry {
@Override
public List<ItemStack> appendStacksForItem(Item item) {
NonNullList<ItemStack> list = NonNullList.create();
- CreativeModeTab category = item.getItemCategory();
- item.fillItemCategory(MoreObjects.firstNonNull(category, CreativeModeTab.TAB_SEARCH), list);
+ 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());
}