Named Items in Crafting Recipes

Discussion in 'Plugin Development' started by TheChugBug, May 11, 2014.

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

    TheChugBug

    I want to know if there is a way to make crafting recipes based on the item's name.
    For example, if I put a dirt block in a crafting table, it won't do anything. But if I put a dirt block named "Super Dirt" it will give me a diamond.

    I really need this solved soon, it's really important.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  2. Offline

    CarPet

    Get the Display name and check if it super dirt...
     
  3. Offline

    TheChugBug


    So how would I do that? Please be more specific.

    BUMP

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  4. I doubt it's that important. Check the JavaDocs and use this event.
     
  5. Offline

    TGRHavoc

    He was being specific. Item.getItemMeta().getDisplayName() will return the name of the item. Check that with a simple "IF" statement.
     
  6. Offline

    TheChugBug

    But you can't do that code inside a crafting recipe.
     
  7. Offline

    TGRHavoc

    TheChugBug
     
    AdamQpzm likes this.
  8. Offline

    TheChugBug

    Would this same thing work with furnace recipes? Because I need that too.
     
  9. TheChugBug You would have to make your own logic using InventoryClickEvent I believe, as there's no furnace equivalent to PrepareItemCraftEvent.
     
  10. Offline

    desht

  11. Offline

    Coopah

    TheChugBug
    If I was you I would check after you've made the crafting recipe.
    Then check what ever the recipe is called and the shapes you've used. Check if the symbols you've used are equal to a item with a custom crafting name?
     
  12. Offline

    desht

    You can actually use the FurnaceBurnEvent for this; I do it here: https://github.com/desht/sensibleto...letoolbox/listeners/GeneralListener.java#L247

    The CustomRecipeManager.validateCustomSmelt() call there can be replaced with any test to see if the item is OK to be cooked. My code spits the item out on the ground if it isn't - while that's not essential, I'd recommend it for efficiency; otherwise a FurnaceBurnEvent will be thrown every tick when the furnace tries to cook the item.
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page