diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 6b0e29a6..c008352b 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -16,12 +16,14 @@ Changes - Added Liquid XP (Open Blocks compatible) - Added Spoon upgrade for Dark Steel Pick - Added Travel upgrade for Dark Steel Pick and The Ender +- Added Goggles of Revealing upgrade for Dark Steel Helmet - Conduit probe now has a 'copy/paste' mode to copy conduit settings. - Improved Staff of Travelling and Yeta Wrench rendering - FarmStation: crops other than trees now require a hoe to be harvested, and the hoe takes 1 damage point per harvest - Farm now supports fertilized dirt - Many changes to recipes - Right mouse button now goes 'back' on the color and redstone mode buttons. +- Added TE 'Hammer' support to Yeta Wrench so it works on TE machines Config @@ -31,6 +33,7 @@ Config - Added config option for painter power use - Added config option to disable tinker's XP bushes in farming station - Added black list for Soul Vial and Powered Spawners +- Added per mob type power use config for powered spawner - Added block black list for teleporting using staff / travel upgrade Bugs diff --git a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java index 69a4139a..5fc3e394 100644 --- a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java +++ b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java @@ -1,5 +1,6 @@ package crazypants.enderio.conduit.item.filter; +import java.io.FilterInputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -35,7 +36,7 @@ public class ItemFilter implements IInventory, IItemFilter { ItemStack[] items; - int[] oreIds; + final List oreIds; private boolean isAdvanced; @@ -50,8 +51,10 @@ public class ItemFilter implements IInventory, IItemFilter { private ItemFilter(int numItems, boolean isAdvanced) { this.isAdvanced = isAdvanced; items = new ItemStack[numItems]; - oreIds = new int[numItems]; - Arrays.fill(oreIds, -99); + oreIds = new ArrayList(numItems); + for(int i=0;i 0) { - if(getOreIdForStack(i) == oreId) { - matched = true; - } - } - if(!matched && it != null && Item.getIdFromItem(item.getItem()) == Item.getIdFromItem(it.getItem())) { + if(it != null && Item.getIdFromItem(item.getItem()) == Item.getIdFromItem(it.getItem())) { matched = true; if(matchMeta && item.getItemDamage() != it.getItemDamage()) { matched = false; } else if(matchNBT && !ItemStack.areItemStackTagsEqual(item, it)) { matched = false; - } + } + } + if(!matched && isOreDicMatch(i, item)) { + matched = true; } if(matched) { break; @@ -98,15 +97,41 @@ public class ItemFilter implements IInventory, IItemFilter { return matched; } - private int getOreIdForStack(int i) { - ItemStack item = items[i]; - if(item == null) { - return -1; + private boolean isOreDicMatch(int filterItemIndex, ItemStack item) { + if(!useOreDict || item == null) { + return false; } - int res = oreIds[i]; - if(res == -99) { - res = OreDictionary.getOreID(item); - oreIds[i] = res; + int[] ids1 = getCachedIds(filterItemIndex); + if(ids1 == null || ids1.length == 0) { + return false; + } + int[] ids2 = OreDictionary.getOreIDs(item); + if(ids2 == null || ids2.length == 0) { + return false; + } + for(int id1 : ids1) { + for(int id2 : ids2) { + if(id1 == id2) { + return true; + } + } + } + return false; + } + + private int[] getCachedIds(int filterItemIndex) { + int[] res = oreIds.get(filterItemIndex); + if(res == null) { + ItemStack item = items[filterItemIndex]; + if(item == null) { + res = new int[0]; + } else { + res = OreDictionary.getOreIDs(item); + if(res == null) { + res = new int[0]; + } + } + oreIds.set(filterItemIndex, res); } return res; } @@ -194,9 +219,11 @@ public class ItemFilter implements IInventory, IItemFilter { int numItems = isAdvanced ? 10 : 5; items = new ItemStack[numItems]; - oreIds = new int[numItems]; - for (int i = 0; i < numItems; i++) { - oreIds[i] = -99; + oreIds.clear(); + for(int i=0;i