Item IDs

Discussion in 'Plugin Development' started by wklock, Aug 23, 2012.

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

    wklock

    So I've started a new plugin and I want to be able to use an unlisted block with the id 44:6 but I'm not sure how to implement it with Materials because it requires and integer.
     
  2. Are you trying to generate 44:6 using Bukkit?
     
  3. Offline

    wklock

    I'm trying to create a new recipe that gives the user 44:6
     
  4. Well, you can us getTypeId() == 44
     
  5. Offline

    wklock

    But it's a specific data type of item 44
     
  6. Or == 44.6)

    What is the code you have so far?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  7. Offline

    wklock

    Code:
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled.");
            ShapedRecipe recipe1 = new ShapedRecipe(new ItemStack(Material("This is where the 44:6 needs to be") , 1));
            recipe1.shape(new String[] { "AAA", "ABA", "AAA" });
            recipe1.setIngredient('A', Material.SMOOTH_BRICK);
            recipe1.setIngredient('B', Material.SMOOTH_BRICK);
            getServer().addRecipe(recipe1);
    I haven't tested it yet.
     
  8. Here's the ItemStack you'll want to use for giving 44:6

    Code:
    new ItemStack(Material.getMaterial(44), 1, (short) 0, (byte) 6)
     
    calebbfmv likes this.
  9. Grr I deleted my post because I had a typo, then you come in and say the same thing -____-
     
  10. Offline

    wklock

    Can you explain how that works please?
     
  11. Lol anyway, basically it says: Use the type 44, then add the subtype of 6 Right? or f***ed up?
     
  12. In that example, you're using the ItemStack costructor: ItemStack(Material type, Int amount, short damage, byte data)

    Basically:
    • Type: 44
    • Amount: 1
    • Damage: 0 (null)
    • data: 6 (The type)
    Put it all together, and you have 44:6
     
  13. Offline

    wklock

    Genius
     
Thread Status:
Not open for further replies.

Share This Page