From b58d5d944cf0a827382909b3a31b76cd9522a3ca Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Sun, 11 May 2025 15:55:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9F=93=E8=89=B2=E9=85=8D?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/recipe/RecipeEventListener.java | 30 ++++--------------- .../craftengine/core/item/ItemSettings.java | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/RecipeEventListener.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/RecipeEventListener.java index 8fa4cdf02..469cb7e1e 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/RecipeEventListener.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/recipe/RecipeEventListener.java @@ -755,31 +755,13 @@ public class RecipeEventListener implements Listener { inventory.setResult(newItem.load()); } else if (Reflections.clazz$ArmorDyeRecipe.isInstance(mcRecipe)) { ItemStack[] itemStacks = inventory.getMatrix(); - Pair onlyTwoItems = getTheOnlyTwoItem(itemStacks); - if (onlyTwoItems.left() == null || onlyTwoItems.right() == null) { - inventory.setResult(null); - return; - } - - Item left = plugin.itemManager().wrap(onlyTwoItems.left()); - Item right = plugin.itemManager().wrap(onlyTwoItems.right()); - // can't be two custom items - if (left.isCustomItem() && right.isCustomItem()) { - inventory.setResult(null); - return; - } - - Optional> customLeftItem = left.getCustomItem(); - if (customLeftItem.isPresent()) { - if (!customLeftItem.get().settings().dyeable()) { + for (ItemStack itemStack : itemStacks) { + if (itemStack == null) continue; + Item item = plugin.itemManager().wrap(itemStack); + Optional> optionalCustomItem = item.getCustomItem(); + if (optionalCustomItem.isPresent() && !optionalCustomItem.get().settings().dyeable()) { inventory.setResult(null); - } - } else { - Optional> customRightItem = right.getCustomItem(); - if (customRightItem.isPresent()) { - if (!customRightItem.get().settings().dyeable()) { - inventory.setResult(null); - } + return; } } } else { diff --git a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java index b16dcf2a0..bc8f9960f 100644 --- a/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java +++ b/core/src/main/java/net/momirealms/craftengine/core/item/ItemSettings.java @@ -27,7 +27,7 @@ public class ItemSettings { boolean renameable = true; boolean canPlaceRelatedVanillaBlock = false; ProjectileMeta projectileMeta; - boolean dyeable = false; + boolean dyeable = true; private ItemSettings() {}