【发布时间】:2019-08-17 21:49:58
【问题描述】:
我正在尝试制作一本魔法书的制作配方,你可以将它应用到锋利的剑上。我做了 .addEnchantment ,但它就像一把剑一样附魔。
package com.mcrm.uhccm.handlers;
import com.mcrm.uhccm.init.UHCCItems;
import com.mcrm.uhccm.items.EnchantmentBooks;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class RecipeHandler {
static ItemStack vorpal_sword = new ItemStack(UHCCItems.vorpal_sword);
public static void registerCraftingRecipes() {
ItemStack sharp1 = new ItemStack(Items.enchanted_book);
sharp1.addEnchantment(Enchantment.sharpness, 1);
vorpal_sword.addEnchantment(Enchantment.smite, 2);
vorpal_sword.addEnchantment(Enchantment.baneOfArthropods, 2);
GameRegistry.addRecipe(sharp1, new Object[] {"F ", " PP", " PI", 'F',Items.flint,'P',Items.paper,'I',Items.iron_sword});
GameRegistry.addRecipe(vorpal_sword, new Object[] { " B ", " I ", " R ", 'B',Items.bone,'I',Items.iron_sword,'R',Items.rotten_flesh});
GameRegistry.addRecipe(new ItemStack(UHCCItems.golden_head), new Object[] { "GGG", "GHG", "GGG", 'G',Items.gold_ingot,'H',Items.skull});
}
public static void registerFurnaceRecipes() {
}
}
这是我正在使用的代码。
【问题讨论】:
-
请将代码行格式化为代码。它可以帮助我们回答您的问题。只有极少数人会费心阅读没有格式的文字墙。
-
EliteRaceElephant,我已经介绍了整个课程,包括尝试制作锐度书的配方。当我这样做时,它将附魔应用于 ench:[{id: enchantment, lvl: x}] 的 nbt 点,对于附魔书,它应该在 StoredEnchantments 的 nbt 点中:[{id: enchantment, lvl :x}]。