Dye's for recipe

Discussion in 'Plugin Development' started by omnija, Jun 11, 2012.

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

    omnija

    I'm having a problem creating recipe's using Dye or the item that creates the dye such as Dandelion or in some cases DyeYellow.

    Code:
    goldDISK.setIngredient('A', Material.DANDELION); -> Dandelion or Rose does not work.
    goldDISK.setIngredient('A', DyeColor.YELLOW); -> Error with setIngredient. 
    What i'm trying to achieve is make recipe's for the disc, but i can't seem to figure this line out. I tried other blocks like rose and bonemeal but noticed they would not work either? Assuming i'm missing alot?

    Thanks
     
  2. Offline

    omnija

    Bumping thread since i still need help with this.
     
  3. Offline

    imjake9

    What exactly doesn't work? Does it give an error message? Also, post a little bit more of your code so we can see how you actually set up the shaped recipe.
     
  4. Offline

    omnija

    Code:
    ShapedRecipe blackDISC = new ShapedRecipe(new ItemStack(2263, 1));
    blackDISC.shape(new String[]{"CBC", "BAB", "CBC"});
    blackDISC.setIngredient('A', Material.INK_SACK);
    blackDISC.setIngredient('B', Material.OBSIDIAN);
     
    getServer().addRecipe(blackDISC);
    
    What i'm trying to do is replace the INK_SACK with a dye colour, so i can make different Discs. For instance it won't allow me to compile if i put in dye ID's or the item ID name.
     
  5. Offline

    imjake9

    Thanks. Keep in mind that you don't need the new String[] since the method uses varargs (aka String...). Even so, that wouldn't affect the outcome of your code.

    Are you getting any errors? What exactly doesn't work?
     
  6. Offline

    omnija

    i edited my post, but i want to change INK_SAC and use either the DYE ID numbers or Dye Name. It just won't allow me to compile. if i change the material line for dyecolor.Yellow it then give me a random error for setingredient.
     
  7. Offline

    imjake9

    Oh, I get it now, it's not working because all the dyes are the same item. So you need to specify the data as an additional argument, like this:
    Code:java
    1. blackDISC.setIngredient('A', Material.INK_SAC, DyeColor.YELLOW.getData());
    Repeat with the other colors for the other discs. Simple as that.
     
  8. Offline

    omnija

    Thanks a lot :)

    edit: after trying the recipe, it didn't show.
     
  9. Offline

    Njol

    DyeColor.getData() returns the data for wool blocks, i.e. the inverse of the dye colors (don't ask me why...). You'll have to invert it yourself:
    Code:java
    1. blackDISC.setIngredient('A', Material.INK_SAC, 15 - DyeColor.YELLOW.getData());
     
    PDKnight likes this.
  10. Offline

    omnija

    thanks both of you for the help.
     
Thread Status:
Not open for further replies.

Share This Page