diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ElementCategorizingList.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ElementCategorizingList.java index c88601ac7..b74e17a9d 100644 --- a/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ElementCategorizingList.java +++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ElementCategorizingList.java @@ -33,6 +33,7 @@ protected void initialize() { } abstract Category getCategory(T element); + abstract boolean areSubcategoriesAlwaysEmpty(Category category); abstract boolean isSubCategoryA(T element); abstract boolean isSubCategoryB(T element); abstract void onElementSubcategorized(T element, int index); @@ -96,7 +97,7 @@ public LazyIterationConsumer.NextIteration consumeCategory(LazyIterationConsumer public LazyIterationConsumer.NextIteration consumeCategoryA(LazyIterationConsumer elementConsumer, Category category) { IntArrayList categoryList = this.elementsByTypeA.get(category); - if (categoryList == null) { + if (categoryList == null && !this.areSubcategoriesAlwaysEmpty(category)) { categoryList = this.elementsByType.get(category); } @@ -105,7 +106,7 @@ public LazyIterationConsumer.NextIteration consumeCategoryA(LazyIterationConsume public LazyIterationConsumer.NextIteration consumeCategoryB(LazyIterationConsumer elementConsumer, Category category) { IntArrayList categoryList = this.elementsByTypeB.get(category); - if (categoryList == null) { + if (categoryList == null && !this.areSubcategoriesAlwaysEmpty(category)) { categoryList = this.elementsByType.get(category); } @@ -136,6 +137,10 @@ private LazyIterationConsumer.NextIteration consumeElements(LazyIterationConsume } private void initSubCategories(Category category, IntArrayList source) { + if (this.areSubcategoriesAlwaysEmpty(category)) { + return; + } + IntArrayList categoryListA = new IntArrayList(); IntArrayList categoryListB = new IntArrayList(); this.elementsByTypeA.put(category, categoryListA); diff --git a/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ItemEntityCategorizingList.java b/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ItemEntityCategorizingList.java index d4122c68b..2c7fa28f8 100644 --- a/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ItemEntityCategorizingList.java +++ b/src/main/java/me/jellysquid/mods/lithium/common/entity/item/ItemEntityCategorizingList.java @@ -40,6 +40,11 @@ Item getCategory(ItemStack itemStack) { return ((ItemStackAccessor) (Object) itemStack).lithium$getItem(); } + @Override + boolean areSubcategoriesAlwaysEmpty(Item item) { + return item.getMaxCount() == 1; + } + // If there are enough item entities in one category, divide the item entities into 3 buckets: // Stacks that are more than 50% full can only merge with stacks that are less than 50% full, etc. // Buckets: A B *