question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Oredict doesn't work in 1.11 anymore

See original GitHub issue

Thanks to my optimization in 69d92c4164dbe3af90a1fb08d7fbaf712282d7ef storages now use a multimap instead of a list. Thanks to that, we no longer have to iterate over every item in the storage.

This has an unintended side-effect that oredict extractions don’t work anymore because when using the oredict the item will differ thus it won’t be found in the multimap.

This only affects the StorageDiskItem class, since all other storage classes have to iterate over every item (for example the item handler external storage handler).

I have this patch laying around, but it appears to show weird behavior (unlimited extractions):

--- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/storage/StorageDiskItem.java
+++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/storage/StorageDiskItem.java
@@ -5,12 +5,14 @@ import com.google.common.collect.Multimap;
 import com.raoulvdberge.refinedstorage.api.storage.AccessType;
 import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
 import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
+import com.raoulvdberge.refinedstorage.api.util.IComparer;
 import com.raoulvdberge.refinedstorage.apiimpl.API;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.nbt.NBTTagList;
 import net.minecraftforge.items.ItemHandlerHelper;
+import net.minecraftforge.oredict.OreDictionary;

 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -190,7 +192,27 @@ public class StorageDiskItem implements IStorageDisk<ItemStack> {
     @Override
     @Nullable
     public synchronized ItemStack extract(@Nonnull ItemStack stack, int size, int flags, boolean simulate) {
-        for (ItemStack otherStack : stacks.get(stack.getItem())) {
+        Collection<ItemStack> toAttempt = null;
+
+        if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
+            for (int id : OreDictionary.getOreIDs(stack)) {
+                Collection<ItemStack> ores = OreDictionary.getOres(OreDictionary.getOreName(id));
+
+                for (ItemStack ore : ores) {
+                    if (toAttempt == null) {
+                        toAttempt = stacks.get(ore.getItem());
+                    } else {
+                        toAttempt.addAll(stacks.get(ore.getItem()));
+                    }
+                }
+            }
+        }
+
+        if (toAttempt == null) {
+            toAttempt = stacks.get(stack.getItem());
+        }
+
+        for (ItemStack otherStack : toAttempt) {
             if (API.instance().getComparer().isEqual(otherStack, stack, flags)) {
                 if (size > otherStack.getCount()) {
                     size = otherStack.getCount();

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
raoulvdbergecommented, Apr 5, 2017

@Dykam Thanks, that was the cause.

getOreIds is the slowdown, but I’m caching it now.

0reactions
raoulvdbergecommented, Apr 5, 2017

Something else, am I seeing correctly that with the change, in case there are two or more stacks of different item types, but same oredict entries, it will stop retrieving them at the first, rather than continue looking for more when size > otherStack.getCount()?

Yes, it has to do that or it will convert stacks of an other type to the equivalent oredict type, which is not allowed

Read more comments on GitHub >

github_iconTop Results From Across the Web

oredict bug? - Support - IC² Forum
Seems, that IC2 is messing with ore dictionary - if loaded, it removes randomly dictionary ... It is not just a graphic glitch,...
Read more >
Update 1.11 rolling out now! Full patch notes inside - Reddit
Update 1.11 for F1 Manager 2022 is now rolling out across all platforms! All changes made in Update 1.11 will apply in existing...
Read more >
Minecraft Modding Tutorial | Ore Dictionary (1.10.2,1.11.2)
Today we are in Minecraft 1.11 and we are using the Ore Dictionary to improve our crafting recipes and compatibility with other mods....
Read more >
TreeOres 1.12.2 - Finally Back? Version 0.1 | 1.11.2
Always wanted to update the mod and I did. Unfortunately, between work and university I don't have much time to continue working on...
Read more >
MCOpts/forge-1.11.2-13.20.0.2304-changelog.txt at master
The new launcher's GUI for logs WILL NOT WORK until they add ... Remove oredict for Bone Block recipe, stop white dye to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found