|
|
|
@@ -7,6 +7,7 @@ import com.willfp.eco.core.Prerequisite;
|
|
|
|
import com.willfp.eco.core.items.TestableItem;
|
|
|
|
import com.willfp.eco.core.items.TestableItem;
|
|
|
|
import com.willfp.eco.core.recipe.Recipes;
|
|
|
|
import com.willfp.eco.core.recipe.Recipes;
|
|
|
|
import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
|
|
|
|
import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
|
|
|
|
|
|
|
|
import com.willfp.eco.core.recipe.parts.GroupedTestableItems;
|
|
|
|
import com.willfp.eco.core.recipe.parts.TestableStack;
|
|
|
|
import com.willfp.eco.core.recipe.parts.TestableStack;
|
|
|
|
import com.willfp.eco.util.ListUtils;
|
|
|
|
import com.willfp.eco.util.ListUtils;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
@@ -104,23 +105,38 @@ public final class ShapedCraftingRecipe extends PluginDependent<EcoPlugin> imple
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char character = String.valueOf(i).toCharArray()[0];
|
|
|
|
char character = String.valueOf(i).toCharArray()[0];
|
|
|
|
ItemStack item = parts.get(i).getItem();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parts.get(i) instanceof TestableStack) {
|
|
|
|
List<TestableItem> items = new ArrayList<>();
|
|
|
|
ItemMeta meta = item.getItemMeta();
|
|
|
|
if (parts.get(i) instanceof GroupedTestableItems group) {
|
|
|
|
assert meta != null;
|
|
|
|
items.addAll(group.getChildren());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
|
|
|
items.add(parts.get(i));
|
|
|
|
assert lore != null;
|
|
|
|
|
|
|
|
lore.add("");
|
|
|
|
|
|
|
|
String add = Eco.getHandler().getEcoPlugin().getLangYml().getFormattedString("multiple-in-craft");
|
|
|
|
|
|
|
|
add = add.replace("%amount%", String.valueOf(item.getAmount()));
|
|
|
|
|
|
|
|
lore.add(add);
|
|
|
|
|
|
|
|
meta.setLore(lore);
|
|
|
|
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
displayedRecipe.setIngredient(character, new RecipeChoice.ExactChoice(item));
|
|
|
|
List<ItemStack> displayedItems = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (TestableItem testableItem : items) {
|
|
|
|
|
|
|
|
if (testableItem instanceof TestableStack) {
|
|
|
|
|
|
|
|
ItemStack item = testableItem.getItem().clone();
|
|
|
|
|
|
|
|
ItemMeta meta = item.getItemMeta();
|
|
|
|
|
|
|
|
assert meta != null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
|
|
|
|
|
|
|
assert lore != null;
|
|
|
|
|
|
|
|
lore.add("");
|
|
|
|
|
|
|
|
String add = Eco.getHandler().getEcoPlugin().getLangYml().getFormattedString("multiple-in-craft");
|
|
|
|
|
|
|
|
add = add.replace("%amount%", String.valueOf(item.getAmount()));
|
|
|
|
|
|
|
|
lore.add(add);
|
|
|
|
|
|
|
|
meta.setLore(lore);
|
|
|
|
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
displayedItems.add(item);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
displayedItems.add(testableItem.getItem());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
displayedRecipe.setIngredient(character, new RecipeChoice.ExactChoice(displayedItems));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Prerequisite.HAS_1_18.isMet() && !Prerequisite.HAS_PAPER.isMet()) {
|
|
|
|
if (Prerequisite.HAS_1_18.isMet() && !Prerequisite.HAS_PAPER.isMet()) {
|
|
|
|
|