你使用的系统: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)));