Adding a Smithing Recipe doesn't set item meta to the result...

Discussion in 'Plugin Development' started by BlaSfaiMe, Jun 18, 2021.

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

    BlaSfaiMe

    Hi,

    I'm doing a plugin for me and my friends, and i'm trying to add a new type of armor for us.

    The thing is i've already create a Smithing Recipe, and the result item has his item meta. But when I'm trying to make another one, the result is here... But without any custom name or else ! I want to add some custom item in, which I did, but even with base items, no meta... here is some screens, showing the problem and the pieces of code that I made.
    Capture d’écran du 2021-06-18 09-07-12.png Capture d’écran du 2021-06-18 09-07-41.png
    Code:
        @Override
        public void onEnable() {
    
    SmithingRecipe smithingRecipe = new SmithingRecipe(new NamespacedKey(this, "nethered_obsidian"), getReinforcedObi(), new RecipeChoice.MaterialChoice(Material.CRYING_OBSIDIAN), new RecipeChoice.MaterialChoice(Material.NETHERITE_INGOT));this.getServer().addRecipe(smithingRecipe);
    
    SmithingRecipe enderiumHelmet = new SmithingRecipe(new NamespacedKey(this, "enderium_helmet"), getEnderiumIngot2(), new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET), new RecipeChoice.MaterialChoice(Material.NETHERITE_INGOT));
            this.getServer().addRecipe(enderiumHelmet);
    
        }
    
         public ItemStack getEnderiumIngot(){
               ItemStack it = new ItemStack(Material.IRON_INGOT);
               ItemMeta tm = it.getItemMeta();
               tm.setDisplayName(ChatColor.LIGHT_PURPLE + "Enderium Ingot");
               it.setItemMeta(tm);
               return it;
          }
    
        public ItemStack getEnderiumIngot2(){
            ItemStack it = new ItemStack(Material.IRON_INGOT);
            ItemMeta im = it.getItemMeta();
            try {
                im.setDisplayName(ChatColor.YELLOW + "cesssss");
            }catch (NullPointerException e) {
                e.printStackTrace();
            }
            it.setItemMeta(im);
            return it;
        }
     
  2. Offline

    Theztc

    I copy and pasted your code and it seems to be working fine
    https://prnt.sc/15u1dvc

    EDIT: I think I misunderstood you, are you trying to make your custom iron ingot the product?
    [​IMG]
     
  3. Offline

    BlaSfaiMe

    Yes, but you got the cessss, this is what I want, and I don't get it...
     
Thread Status:
Not open for further replies.

Share This Page