SimpleShapedRecipe.java 文件源码

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

项目:CustomRecipes 作者:
/**
 * {@inheritDoc}
 */
@Override
public boolean matches(CraftingInventory craftingInventory, World world) {
    int width, heigth;

    //check boundaries for the crafting inventory
    InventoryType type = craftingInventory.getType();
    switch(type) {
        case CRAFTING:
            width = heigth = 2;
            break;
        case WORKBENCH:
            width = heigth = 3;
            break;
        default: return false; //unknown crafting inventory type.
    }

    for (int w = 0; w <= width - this.width; w++) {
        for (int h = 0; h <= heigth - this.heigth; h++) {
            if (matrixMatch(craftingInventory, w, h, true)) {
                return true;
            }
            if (matrixMatch(craftingInventory, w, h, false)) {
                return true;
            }
        }
    }

       return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号