MerchantRecipeConverter.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:SimpleEgg 作者:
/**
 * Returns a String representation of a MerchantRecipe. Spaces are used as
 * delimeters between attributes. Utilizes
 * {@link ItemStackConverter ItemStackConverter} for the ItemStacks.
 * </b>
 * @param merchantRecipe - The MerchantRecipe to stringify.
 * @return A String that can be stored and passed in to
 * {@link #fromString(String) fromString(String)} later.
 * @throws IllegalArgumentException If MerchantRecipe is null.
 */
public static String toString(MerchantRecipe merchantRecipe) throws IllegalArgumentException {
    if (merchantRecipe == null) {
        throw new IllegalArgumentException("Cannot stringify a null MerchantRecipe!");
    }

    String ret = new String();
    ret += ItemStackConverter.toString(merchantRecipe.getResult()) + " ";

    for (ItemStack itemStack : merchantRecipe.getIngredients()) {
        ret += ItemStackConverter.toString(itemStack) + ",";
    }

    ret += " " + merchantRecipe.getUses();
    ret += " " + merchantRecipe.getMaxUses();
    ret += " " + merchantRecipe.hasExperienceReward();
    return ret;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号