Transaction collect(ShapedRecipe recipe) {
List<ItemStack> collected = new ArrayList<ItemStack>(rows * columns);
String[] shape = recipe.getShape();
Map<Character, ItemStack> map = recipe.getIngredientMap();
for (String s : shape)
INGREDIENTS: for (int i = 0; i < s.length(); i++) {
ItemStack ingredient = map.get(s.charAt(i));
if (ingredient == null)
continue;
for (ItemStack item : collected) {
if (ItemUtils.itemEqualsTypeAndData(item, ingredient)) {
item.setAmount(item.getAmount() + ingredient.getAmount());
continue INGREDIENTS;
}
}
collected.add(ingredient);
}
return new Transaction(collected, recipe.getResult());
}
RecipeVerifier.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:StarQuestCode
作者:
评论列表
文章目录