Java 类org.bukkit.craftbukkit.inventory.CraftShapedRecipe 实例源码

项目:CraftBukkit    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
    CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
    switch (this.height) {
    case 1:
        switch (this.width) {
        case 1:
            recipe.shape("a");
            break;
        case 2:
            recipe.shape("ab");
            break;
        case 3:
            recipe.shape("abc");
            break;
        }
        break;
    case 2:
        switch (this.width) {
        case 1:
            recipe.shape("a","b");
            break;
        case 2:
            recipe.shape("ab","cd");
            break;
        case 3:
            recipe.shape("abc","def");
            break;
        }
        break;
    case 3:
        switch (this.width) {
        case 1:
            recipe.shape("a","b","c");
            break;
        case 2:
            recipe.shape("ab","cd","ef");
            break;
        case 3:
            recipe.shape("abc","def","ghi");
            break;
        }
        break;
    }
    char c = 'a';
    for (ItemStack stack : this.items) {
        if (stack != null) {
            recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
        }
        c++;
    }
    return recipe;
}
项目:Almura-Server    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
    CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
    switch (this.height) {
    case 1:
        switch (this.width) {
        case 1:
            recipe.shape("a");
            break;
        case 2:
            recipe.shape("ab");
            break;
        case 3:
            recipe.shape("abc");
            break;
        }
        break;
    case 2:
        switch (this.width) {
        case 1:
            recipe.shape("a","b");
            break;
        case 2:
            recipe.shape("ab","cd");
            break;
        case 3:
            recipe.shape("abc","def");
            break;
        }
        break;
    case 3:
        switch (this.width) {
        case 1:
            recipe.shape("a","b","c");
            break;
        case 2:
            recipe.shape("ab","cd","ef");
            break;
        case 3:
            recipe.shape("abc","def","ghi");
            break;
        }
        break;
    }
    char c = 'a';
    for (ItemStack stack : this.items) {
        if (stack != null) {
            recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
        }
        c++;
    }
    return recipe;
}
项目:Tweakkit-Server    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
    CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
    switch (this.height) {
    case 1:
        switch (this.width) {
        case 1:
            recipe.shape("a");
            break;
        case 2:
            recipe.shape("ab");
            break;
        case 3:
            recipe.shape("abc");
            break;
        }
        break;
    case 2:
        switch (this.width) {
        case 1:
            recipe.shape("a","b");
            break;
        case 2:
            recipe.shape("ab","cd");
            break;
        case 3:
            recipe.shape("abc","def");
            break;
        }
        break;
    case 3:
        switch (this.width) {
        case 1:
            recipe.shape("a","b","c");
            break;
        case 2:
            recipe.shape("ab","cd","ef");
            break;
        case 3:
            recipe.shape("abc","def","ghi");
            break;
        }
        break;
    }
    char c = 'a';
    for (ItemStack stack : this.items) {
        if (stack != null) {
            recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
        }
        c++;
    }
    return recipe;
}
项目:Cauldron    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe()
{
    CraftItemStack result = CraftItemStack.asCraftMirror(this.recipeOutput);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);

    switch (this.recipeHeight)
    {
        case 1:
            switch (this.recipeWidth)
            {
                case 1:
                    recipe.shape("a");
                    break;
                case 2:
                    recipe.shape("ab");
                    break;
                case 3:
                    recipe.shape("abc");
                    break;
            }

            break;
        case 2:
            switch (this.recipeWidth)
            {
                case 1:
                    recipe.shape("a", "b");
                    break;
                case 2:
                    recipe.shape("ab", "cd");
                    break;
                case 3:
                    recipe.shape("abc", "def");
                    break;
            }

            break;
        case 3:
            switch (this.recipeWidth)
            {
                case 1:
                    recipe.shape("a", "b", "c");
                    break;
                case 2:
                    recipe.shape("ab", "cd", "ef");
                    break;
                case 3:
                    recipe.shape("abc", "def", "ghi");
                    break;
            }

            break;
    }

    char c = 'a';

    for (ItemStack stack : this.recipeItems)
    {
        if (stack != null)
        {
            recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getItemDamage());
        }

        c++;
    }

    return recipe;
}
项目:SpigotSource    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
    CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
    switch (this.height) {
    case 1:
        switch (this.width) {
        case 1:
            recipe.shape("a");
            break;
        case 2:
            recipe.shape("ab");
            break;
        case 3:
            recipe.shape("abc");
            break;
        }
        break;
    case 2:
        switch (this.width) {
        case 1:
            recipe.shape("a","b");
            break;
        case 2:
            recipe.shape("ab","cd");
            break;
        case 3:
            recipe.shape("abc","def");
            break;
        }
        break;
    case 3:
        switch (this.width) {
        case 1:
            recipe.shape("a","b","c");
            break;
        case 2:
            recipe.shape("ab","cd","ef");
            break;
        case 3:
            recipe.shape("abc","def","ghi");
            break;
        }
        break;
    }
    char c = 'a';
    for (ItemStack stack : this.items) {
        if (stack != null) {
            recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
        }
        c++;
    }
    return recipe;
}
项目:Craft-city    文件:ShapedRecipes.java   
public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
    CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
    CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
    switch (this.height) {
    case 1:
        switch (this.width) {
        case 1:
            recipe.shape("a");
            break;
        case 2:
            recipe.shape("ab");
            break;
        case 3:
            recipe.shape("abc");
            break;
        }
        break;
    case 2:
        switch (this.width) {
        case 1:
            recipe.shape("a","b");
            break;
        case 2:
            recipe.shape("ab","cd");
            break;
        case 3:
            recipe.shape("abc","def");
            break;
        }
        break;
    case 3:
        switch (this.width) {
        case 1:
            recipe.shape("a","b","c");
            break;
        case 2:
            recipe.shape("ab","cd","ef");
            break;
        case 3:
            recipe.shape("abc","def","ghi");
            break;
        }
        break;
    }
    char c = 'a';
    for (ItemStack stack : this.items) {
        if (stack != null) {
            recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
        }
        c++;
    }
    return recipe;
}