java类org.bukkit.inventory.ShapedRecipe的实例源码

RecipeManager.java 文件源码 项目:Bags2 阅读 27 收藏 0 点赞 0 评论 0
public static void initRecipes()
{
    for(BagBase bb : Util.getBags())
    {
        String prefix = "recipes." + bb.getName();

        ShapedRecipe sr = bb.getStandardRecipe();
        Map<Character, ItemStack> map = sr.getIngredientMap();
        Material[] matArray = new Material[9];

        setIf(prefix + ".1", map.get(sr.getShape()[0].charAt(0)).getType().toString());
        setIf(prefix + ".2", map.get(sr.getShape()[0].charAt(1)).getType().toString());
        setIf(prefix + ".3", map.get(sr.getShape()[0].charAt(2)).getType().toString());
        setIf(prefix + ".4", map.get(sr.getShape()[1].charAt(0)).getType().toString());
        setIf(prefix + ".5", map.get(sr.getShape()[1].charAt(1)).getType().toString());
        setIf(prefix + ".6", map.get(sr.getShape()[1].charAt(2)).getType().toString());
        setIf(prefix + ".7", map.get(sr.getShape()[2].charAt(0)).getType().toString());
        setIf(prefix + ".8", map.get(sr.getShape()[2].charAt(1)).getType().toString());
        setIf(prefix + ".9", map.get(sr.getShape()[2].charAt(2)).getType().toString());


    }
    try {
        Bags2.recipes.save(Bags2.recipesFile);
    } catch (IOException e)
    {
        e.printStackTrace();
    }
}
SimpleWand.java 文件源码 项目:MystiCraft 阅读 20 收藏 0 点赞 0 评论 0
@Override
public Recipe getRecipe() {
    ShapedRecipe r = new ShapedRecipe(baseItem);
    r.shape("  x", " y ", "x  ");
    r.setIngredient('x', Material.REDSTONE);
    r.setIngredient('y', Material.STICK);
    return r;
}
PokeEgg.java 文件源码 项目:PA 阅读 21 收藏 0 点赞 0 评论 0
public void registerRecipe(){
    ItemStack i = getPokeEgg();

    ShapedRecipe pokeEgg = new ShapedRecipe(i);

    pokeEgg.shape("BAB", "DCD", "BAB");

    pokeEgg.setIngredient('B', Material.WOOL);
    pokeEgg.setIngredient('A', Material.STRING);
    pokeEgg.setIngredient('D', Material.GOLD_NUGGET);
    pokeEgg.setIngredient('C', Material.EGG);

    Bukkit.addRecipe(pokeEgg);
}
PowerCrystal.java 文件源码 项目:SuperiorCraft 阅读 18 收藏 0 点赞 0 评论 0
public PowerCrystal(ItemStack item, String id) {
    super(item, id);

    ShapedRecipe pcrysr = new ShapedRecipe(item);
    pcrysr.shape("=-=",
                 "-#-",
                 "=-=");
    pcrysr.setIngredient('#', Material.DIAMOND);
    pcrysr.setIngredient('-', Material.GOLD_INGOT);
    pcrysr.setIngredient('=', Material.REDSTONE);
    Bukkit.getServer().addRecipe(pcrysr);
}
SpecialItemsPlugin.java 文件源码 项目:world-of-icerealm 阅读 16 收藏 0 点赞 0 评论 0
private void addIronDurabilityRecipe() {
    ItemStack chestStack = new ItemStack(Material.IRON_CHESTPLATE, 1);
    chestStack.setDurability((short)-IronChestplateAugmentedDurability);

    ShapedRecipe chestRecipe = new ShapedRecipe( chestStack );
       chestRecipe.shape("LLL","LIL","LLL");
       chestRecipe.setIngredient('L', Material.LEATHER);
       chestRecipe.setIngredient('I', Material.IRON_CHESTPLATE);
       getServer().addRecipe(chestRecipe);

       ItemStack leggingsStack = new ItemStack(Material.IRON_LEGGINGS, 1);
       leggingsStack.setDurability((short)-IronLeggingsAugmentedDurability);

    ShapedRecipe leggingsRecipe = new ShapedRecipe( leggingsStack );
    leggingsRecipe.shape("LLL","LIL","LLL");
    leggingsRecipe.setIngredient('L', Material.LEATHER);
    leggingsRecipe.setIngredient('I', Material.IRON_LEGGINGS);
       getServer().addRecipe(leggingsRecipe);

       ItemStack bootsStack = new ItemStack(Material.IRON_BOOTS, 1);
       bootsStack.setDurability((short)-IronBootsAugmentedDurability);

    ShapedRecipe bootsRecipe = new ShapedRecipe( bootsStack );
    bootsRecipe.shape("LLL","LIL","LLL");
    bootsRecipe.setIngredient('L', Material.LEATHER);
    bootsRecipe.setIngredient('I', Material.IRON_BOOTS);
       getServer().addRecipe(bootsRecipe);

       ItemStack helmetStack = new ItemStack(Material.IRON_HELMET, 1);
       helmetStack.setDurability((short)-IronHelmetAugmentedDurability);

    ShapedRecipe helmetRecipe = new ShapedRecipe( helmetStack );
    helmetRecipe.shape("LLL","LIL","LLL");
    helmetRecipe.setIngredient('L', Material.LEATHER);
    helmetRecipe.setIngredient('I', Material.IRON_HELMET);
       getServer().addRecipe(helmetRecipe);
}
Gapple.java 文件源码 项目:Aero 阅读 17 收藏 0 点赞 0 评论 0
public static void addRecipe() {
    if(Config.getConfig().getBoolean("Features.CraftableOpGapple")) {
        ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1, (short) 1));
        recipe.shape("ggg", "gag", "ggg");
        recipe.setIngredient('g', Material.GOLD_BLOCK);
        recipe.setIngredient('a', Material.APPLE);
        Bukkit.addRecipe(recipe);
    }
}
EnderBowPlugin.java 文件源码 项目:EnderBow 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void onEnable() {
    if (Settings.isAutoUpdateEnabled()) {
        new Updater(this, 88505, getFile(), Updater.UpdateType.DEFAULT, true);
    }

    try {
        MetricsLite metrics = new MetricsLite(this);
        metrics.start();
    } catch (IOException e) {
        getLogger().info("Failed to submit statistics to MCStats!");
    }

    instance = this;

    // Register the event listener
    getServer().getPluginManager().registerEvents(new EnderBowListener(), this);

    // Register the command
    getCommand("enderbow").setExecutor(new EnderBowCommand());

    // Create the recipe
    ShapedRecipe enderBowRecipe = new ShapedRecipe(getEnderBow());
    enderBowRecipe.shape("eee", "ebe", "eee");
    enderBowRecipe.setIngredient('e', Material.ENDER_PEARL);
    enderBowRecipe.setIngredient('b', Material.BOW);

    // Add the recipe
    getServer().addRecipe(enderBowRecipe);
}
CraftItemHammer.java 文件源码 项目:OmniWorldMCPlugin 阅读 17 收藏 0 点赞 0 评论 0
public void setRecipes() {
    this.DiamondHammerRecipe = new ShapedRecipe(this.DiamondHammer);

    this.DiamondHammerRecipe.shape(new String[] { "mmm", "mim", "mmm" });
    this.DiamondHammerRecipe.setIngredient('m', Material.DIAMOND_BLOCK);
    this.DiamondHammerRecipe.setIngredient('i', Material.DIAMOND_PICKAXE);
}
CraftItemExcavator.java 文件源码 项目:OmniWorldMCPlugin 阅读 15 收藏 0 点赞 0 评论 0
public void setRecipes() {
    this.DiamondExcavatorRecipe = new ShapedRecipe(this.DiamondExcavator);


    this.DiamondExcavatorRecipe.shape(new String[] { "mmm", "mim", "mmm" });
    this.DiamondExcavatorRecipe.setIngredient('m', Material.DIAMOND_BLOCK);
    this.DiamondExcavatorRecipe.setIngredient('i', Material.DIAMOND_SPADE);
}
RecipeAcceptor.java 文件源码 项目:craftinomicon 阅读 26 收藏 0 点赞 0 评论 0
public static <T> T accept(Recipe recipe, RecipeVisitor<T> visitor) {
    if (recipe instanceof ShapedRecipe) {
        ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
        return visitor.visit(shapedRecipe);
    } else if (recipe instanceof ShapelessRecipe) {
        ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
        return visitor.visit(shapelessRecipe);
    } else if (recipe instanceof FurnaceRecipe) {
        FurnaceRecipe furnaceRecipe = (FurnaceRecipe) recipe;
        return visitor.visit(furnaceRecipe);
    }
    return visitor.visitOther(recipe);
}


问题


面经


文章

微信
公众号

扫码关注公众号