SimpleShapedRecipe.java 文件源码

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

项目:CustomRecipes 作者:
private boolean matrixMatch(CraftingInventory craftingInventory, int maxColumns, int maxRows, boolean mirrored) {
    for (int c = 0; c < 3; c++) {
        for (int r = 0; r < 3; r++) {
            int colNum = c - maxColumns;
            int rowNum = r - maxRows;
            CraftingIngredient choiceIngredient = InventoryUtils::isEmptyStack;
            if (colNum >= 0 && rowNum >= 0 && colNum < width && rowNum < heigth) {
                if (mirrored) {
                    choiceIngredient = ingredients.get(width - 1 - colNum + rowNum * width);
                } else {
                    choiceIngredient = ingredients.get(colNum + rowNum * width);
                }
            }

            if (!choiceIngredient.isIngredient(craftingInventory.getItem(colNum + rowNum * width))) {
                return false;
            }
        }
    }
    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号