9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-31 12:56:28 +00:00

修正染色配方

This commit is contained in:
XiaoMoMi
2025-05-11 15:55:20 +08:00
parent e253c31e93
commit b58d5d944c
2 changed files with 7 additions and 25 deletions

View File

@@ -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<ItemStack, ItemStack> onlyTwoItems = getTheOnlyTwoItem(itemStacks);
if (onlyTwoItems.left() == null || onlyTwoItems.right() == null) {
inventory.setResult(null);
return;
}
Item<ItemStack> left = plugin.itemManager().wrap(onlyTwoItems.left());
Item<ItemStack> right = plugin.itemManager().wrap(onlyTwoItems.right());
// can't be two custom items
if (left.isCustomItem() && right.isCustomItem()) {
inventory.setResult(null);
return;
}
Optional<CustomItem<ItemStack>> customLeftItem = left.getCustomItem();
if (customLeftItem.isPresent()) {
if (!customLeftItem.get().settings().dyeable()) {
for (ItemStack itemStack : itemStacks) {
if (itemStack == null) continue;
Item<ItemStack> item = plugin.itemManager().wrap(itemStack);
Optional<CustomItem<ItemStack>> optionalCustomItem = item.getCustomItem();
if (optionalCustomItem.isPresent() && !optionalCustomItem.get().settings().dyeable()) {
inventory.setResult(null);
}
} else {
Optional<CustomItem<ItemStack>> customRightItem = right.getCustomItem();
if (customRightItem.isPresent()) {
if (!customRightItem.get().settings().dyeable()) {
inventory.setResult(null);
}
return;
}
}
} else {