Custom mob spawners?

Discussion in 'Plugin Development' started by ItsLeoFTW, Feb 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ItsLeoFTW

    Hey there!

    I'm working on a plugin that allows you to mine & craft mob spawners. I got that down pat along with the crafting, but I can't figure out how to make a new crafting recipe for each type of spawner! So basically, what I want it to do would be something like:
    To craft a pig spawner = 8 iron ingots and 1 cooked pork in the middle
    To craft a zombie spawner = 8 gold ingots and 1 zombie egg in the middle
    and so on.
    Here's the code for the pig spawner:
    Code:java
    1. ItemStack pig_spawner = new ItemStack(Material.MOB_SPAWNER);
    2. ItemMeta meta = pig_spawner.getItemMeta();
    3. meta.setDisplayName(ChatColor.GREEN + "Spawner");
    4. pig_spawner.setItemMeta(meta);
    5. ShapedRecipe pigrecipe = new ShapedRecipe(new ItemStack(pig_spawner)).shape("###", "#%#", "###").setIngredient('#', Material.IRON_INGOT).setIngredient('%', Material.PORK);
    6. getServer().addRecipe(pigrecipe);

    Please help!
     
Thread Status:
Not open for further replies.

Share This Page