From 8387d21124640f31d15a140281371aff92009482 Mon Sep 17 00:00:00 2001 From: youyihj Date: Tue, 10 May 2022 22:30:16 +0800 Subject: [PATCH] match item nbt --- .../api/recipe/ItemsIngredient.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cleanroommc/multiblocked/api/recipe/ItemsIngredient.java b/src/main/java/com/cleanroommc/multiblocked/api/recipe/ItemsIngredient.java index 397140a7..7ad53ff9 100644 --- a/src/main/java/com/cleanroommc/multiblocked/api/recipe/ItemsIngredient.java +++ b/src/main/java/com/cleanroommc/multiblocked/api/recipe/ItemsIngredient.java @@ -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;