Skip to content

Commit

Permalink
match item nbt
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyhj authored and Yefancy committed May 12, 2022
1 parent 9d8a519 commit 8387d21
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,22 @@ public IntList getValidItemStacksPacked() {

@Override
public boolean apply(@Nullable ItemStack input) {
if (ores == null) return super.apply(input);
if (input == null) {
return false;
}
for (ItemStack target : this.ores) {
if (OreDictionary.itemMatches(target, input, false)) {
return true;
if (this.ores == null) {
for (ItemStack matchingStack : this.matchingStacks) {
if (matchingStack.getItem() == input.getItem()) {
int metadata = matchingStack.getMetadata();
return (metadata == OreDictionary.WILDCARD_VALUE || metadata == input.getMetadata()) &&
(!matchingStack.hasTagCompound() || ItemStack.areItemStackShareTagsEqual(matchingStack, input));
}
}
} else {
for (ItemStack target : this.ores) {
if (OreDictionary.itemMatches(target, input, false)) {
return true;
}
}
}
return false;
Expand Down

0 comments on commit 8387d21

Please sign in to comment.