我对改装还很陌生。
我想创造一把剑,让暴徒或玩家着火。我正在使用该hitEntity
方法,我注意到该功能甚至没有运行。我使用控制台对其进行了测试。当我@Override
在方法之前使用符号时,hitEntity
它会给我一个错误:
BlazeSword 类型的方法 hitEntity(ItemStack, EntityLiving, EntityLiving) 必须重写或实现超类型方法
这是我的代码:
package com.example.firstMod.tools;
import com.example.firstMod.FirstMod;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
public class BlazeSword extends ItemSword {
public BlazeSword(int id, ToolMaterial blaze) {
super(blaze);
this.setCreativeTab(FirstMod.blazingMod);
this.setUnlocalizedName("blazeSword");
this.setTextureName(FirstMod.MODID+":"+"blaze_sword");
}
public boolean hitEntity(ItemStack par1itemstack, EntityLiving par2entityliving, EntityLiving par3entityliving){
par2entityliving.setFire(20);
return true;
}
}