1.15.2 武器与工具无法修复耐久

How.050228


你使用的系统:macOS High Sierra
你是用的JDK: 1.8.0_251
你使用的IDE: IntelliJ IDEA
你使用的IDE版本: 2020.1.1
Forge版本: 31.2.0
Minecraft版本: 1.15.2!

Screen Shot 2020-07-06 at 10.22.55 PM|536x500

如图,物品无法被铁砧或砂轮修复。。
这只是一个用于学习写的一个mod,所以有些名称可能看起来很怪。。
望解答,谢谢!

SwordItemTier.java

package com.authorname.modname.tools;
import com.authorname.modname.utility.RegistryHandler;
import net.minecraft.item.IItemTier;
import net.minecraft.item.crafting.Ingredient;
import java.util.function.Supplier;
public enum SwordItemTier implements IItemTier
{
    SWORD(3, 10, 10.0F, 11.0F, 12, () -> {
        return Ingredient.fromItems(RegistryHandler.SWORD_SWORD.get());
    });
    private final int harvestLevel;
    private final int maxUses;
    private final float efficiency;
    private final float attackDamage;
    private final int enchantability;
    private final Supplier<Ingredient> repairMaterial;
    SwordItemTier(int harvestLevel, int maxUses, float efficiency, float attackDamage, int enchantability, Supplier<Ingredient> repairMaterial)
    {
        this.harvestLevel = harvestLevel;
        this.maxUses = maxUses;
        this.efficiency = efficiency;
        this.attackDamage = attackDamage;
        this.enchantability = enchantability;
        this.repairMaterial = repairMaterial;
    }
    @Override
    public int getMaxUses()
    {
        return maxUses;
    }
    @Override
    public float getEfficiency()
    {
        return efficiency;
    }
    @Override
    public float getAttackDamage()
    {
        return attackDamage;
    }
    @Override
    public int getHarvestLevel()
    {
        return harvestLevel;
    }
    @Override
    public int getEnchantability()
    {
        return enchantability;
    }
    @Override
    public Ingredient getRepairMaterial()
    {
        return repairMaterial.get();
    }
}

RegistryHandler.java

    public static final RegistryObject<SwordItem> SWORD_SWORD = ITEMS.register("sword_sword", () ->
            new SwordItem(SwordItemTier.SWORD, 2, -2.4F, new Item.Properties().group(modname.TAB)));

How.050228


emmm…
我不知道这个图片为什么会变成一个下载链接。。


RoitoLeonine


我觉得是你 repairMaterial 的问题。

SWORD(3, 10, 10.0F, 11.0F, 12, () -> {
return Ingredient.fromItems(RegistryHandler.SWORD_SWORD.get());
});

看起来你是需要用 SWORD_SWORD 这个物品才能修


How.050228


非常感谢:pray:
没想到是这种错误。。


system


该主题在最后一个回复创建后7天后自动关闭。不再允许新的回复。