当前位置: 首页>>代码示例>>Java>>正文


Java CraftShapedRecipe类代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.inventory.CraftShapedRecipe的典型用法代码示例。如果您正苦于以下问题:Java CraftShapedRecipe类的具体用法?Java CraftShapedRecipe怎么用?Java CraftShapedRecipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CraftShapedRecipe类属于org.bukkit.craftbukkit.inventory包,在下文中一共展示了CraftShapedRecipe类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toBukkitRecipe

import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
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;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:54,代码来源:ShapedRecipes.java

示例2: toBukkitRecipe

import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
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;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:54,代码来源:ShapedRecipes.java

示例3: toBukkitRecipe

import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; //导入依赖的package包/类
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;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:69,代码来源:ShapedRecipes.java


注:本文中的org.bukkit.craftbukkit.inventory.CraftShapedRecipe类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。