Am having trouble adding custom recipes

Discussion in 'Plugin Development' started by Shadow_Excalibur, Sep 26, 2012.

Thread Status:
Not open for further replies.
  1. I'm fairly new to bukkit programming and have had a crack at adding some custom recipes to make redstone dust more useful and add some alchemy into the game. However even though everything looks ok in Eclipse when I run bukkit to test it throws these errors:

    EDIT: Whoops I found the problem, I checked again and I put a "C" instead of an "R" for redstone in the iron2gold recipe.

    Code:
    15:35:18 [INFO] [RedstoneAlchemy] Enabling RedstoneAlchemy v1.1
    15:35:18 [SEVERE] Error occurred while enabling RedstoneAlchemy v1.1 (Is it up t
    o date?)
    java.lang.IllegalArgumentException: Symbol does not appear in the shape:67
            at org.apache.commons.lang.Validate.isTrue(Validate.java:103)
            at org.bukkit.inventory.ShapedRecipe.setIngredient(ShapedRecipe.java:96)
     
            at org.bukkit.inventory.ShapedRecipe.setIngredient(ShapedRecipe.java:84)
     
            at me.ShadowExcalibur.RedstoneAlchemy.Recipes.onEnable(Recipes.java:37)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:365)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:381)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247
    )
            at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
            at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    I really don't know what I've done wrong. The plugin's code is here if it helps:


    Code:
    package me.ShadowExcalibur.RedstoneAlchemy;
     
    import org.bukkit.plugin.java.JavaPlugin;
    import java.util.logging.Logger;
     
    import org.bukkit.Material;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.ShapedRecipe;
    import org.bukkit.plugin.PluginDescriptionFile;
     
    public class Recipes extends JavaPlugin{
        public final Logger logger = Logger.getLogger("Minecraft");
        public static Recipes plugin;
     
     
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this .getDescription();
            this.logger.info(pdfFile.getName() + " Has been disabled! Alchemy will no longer work!");
         
            getServer().clearRecipes();
        }
     
        @Override
        public void onEnable() {
         
            ShapedRecipe gold2diamond = new ShapedRecipe(new ItemStack(Material.DIAMOND, 1));
            gold2diamond.shape("GCG", "RIR", "GCG");
            gold2diamond.setIngredient('I', Material.GOLD_BLOCK);
            gold2diamond.setIngredient('G', Material.GLOWSTONE);
            gold2diamond.setIngredient('R', Material.REDSTONE);
            gold2diamond.setIngredient('C', Material.COAL);
         
            ShapedRecipe diamond2gold = new ShapedRecipe(new ItemStack(Material.GOLD_BLOCK, 1));
            diamond2gold.shape("RRR", "RDR", "RRR");
            diamond2gold.setIngredient('D', Material.DIAMOND);
            diamond2gold.setIngredient('R', Material.REDSTONE);
         
            ShapedRecipe iron2gold = new ShapedRecipe(new ItemStack(Material.GOLD_INGOT, 1));
            iron2gold.shape("RRR", "RIR", "RRR");
            iron2gold.setIngredient('I', Material.IRON_BLOCK);
            iron2gold.setIngredient('C', Material.REDSTONE);
         
            ShapedRecipe ice = new ShapedRecipe(new ItemStack(Material.ICE, 1));
            ice.shape("RRR", "RWR" , "RRR");
            ice.setIngredient('W', Material.WATER_BUCKET);
            ice.setIngredient('R', Material.REDSTONE);
     
            getServer().addRecipe(iron2gold);
            getServer().addRecipe(gold2diamond);
            getServer().addRecipe(ice);
            getServer().addRecipe(diamond2gold);
     
         
            PluginDescriptionFile pdfFile = this .getDescription();
            this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has been enabled! Redstone dust now has alchemic properties!");
         
        }
    }
    
     
  2. Code:
    iron2gold.shape("RRR", "RIR", "RRR");
    iron2gold.setIngredient('I', Material.IRON_BLOCK);
    iron2gold.setIngredient('C', Material.REDSTONE);
    Well, you try to set the ingredient for 'I' and 'C' but you only used 'I' and 'R' in the recipe.
     
Thread Status:
Not open for further replies.

Share This Page