first exact search underlying list in oredicted list
This commit is contained in:
@@ -76,24 +76,27 @@ public class ItemStackListOredicted implements IItemStackList {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
public ItemStack get(@Nonnull ItemStack stack, int flags) {
|
||||||
if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
|
// Check the underlying list but don't do oredict things for exact match
|
||||||
int[] ids = OreDictionary.getOreIDs(stack);
|
ItemStack exact = underlyingList.get(stack, flags & ~IComparer.COMPARE_OREDICT);
|
||||||
for (int id : ids) {
|
if (exact == null) {
|
||||||
List<ItemStack> stacks = this.stacks.get(id);
|
if ((flags & IComparer.COMPARE_OREDICT) == IComparer.COMPARE_OREDICT) {
|
||||||
if (stacks != null && !stacks.isEmpty()) {
|
int[] ids = OreDictionary.getOreIDs(stack);
|
||||||
int i = 0;
|
for (int id : ids) {
|
||||||
ItemStack returnStack = stacks.get(i++);
|
List<ItemStack> stacks = this.stacks.get(id);
|
||||||
while (returnStack.stackSize == 0 && i < stacks.size()) {
|
if (stacks != null && !stacks.isEmpty()) {
|
||||||
returnStack = stacks.get(i++);
|
int i = 0;
|
||||||
}
|
ItemStack returnStack = stacks.get(i++);
|
||||||
if (returnStack.stackSize != 0) {
|
while (returnStack.stackSize == 0 && i < stacks.size()) {
|
||||||
return returnStack;
|
returnStack = stacks.get(i++);
|
||||||
|
}
|
||||||
|
if (returnStack.stackSize != 0) {
|
||||||
|
return returnStack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check the underlying list but don't do oredict things, as that has been tried before
|
return exact;
|
||||||
return underlyingList.get(stack, flags & ~IComparer.COMPARE_OREDICT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
Reference in New Issue
Block a user