Чар на предмете при крафте

Версия Minecraft
1.12.2
10
0
Здравствуйте люди добрые.
Как сделать что бы вещь при крафте имела чар? (Что бы кирка при крафте имела чар на удачу)

Код:
GameRegistry.addShapedRecipe(new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"), new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"),
                new ItemStack(InitItems.EMERALD_DIAMOND_PICKAXE),new Object[]{
                "EDD",
                " S ",
                " S ",
                'E', new ItemStack(InitItems.EMERALD_DIAMOND),
                'D', new ItemStack(Items.DIAMOND),
                'S', new ItemStack(InitItems.IRON_STICK)
                });

Заранее спасибо.
 
Решение
Java:
ItemStack enchStack = new ItemStack(InitItems.EMERALD_DIAMOND_PICKAXE);
enchStack.addEnchantment(Enchantment.efficiency, /*lwl*/ 2)
GameRegistry.addShapedRecipe(new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"), new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"),
                enchStack, new Object[]{
                "EDD",
                " S ",
                " S ",
                'E', new ItemStack(InitItems.EMERALD_DIAMOND),
                'D', new ItemStack(Items.DIAMOND),
                'S', new ItemStack(InitItems.IRON_STICK)
                });
Java:
ItemStack enchStack = new ItemStack(InitItems.EMERALD_DIAMOND_PICKAXE);
enchStack.addEnchantment(Enchantment.efficiency, /*lwl*/ 2)
GameRegistry.addShapedRecipe(new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"), new ResourceLocation(main.MODID + ":" + "vancraft:emerald_diamond_pickaxe"),
                enchStack, new Object[]{
                "EDD",
                " S ",
                " S ",
                'E', new ItemStack(InitItems.EMERALD_DIAMOND),
                'D', new ItemStack(Items.DIAMOND),
                'S', new ItemStack(InitItems.IRON_STICK)
                });
 
  • Like
Реакции: Bs01
2,997
191
584
5,929
211
1,144
Сверху