Why not? I want my item behavies like a vanilla instant health potion. The only thing I want is somebody help
Here's my code extending ItemFood working:
public class ItemCustomDrink extends ItemFood implements IHasModel
{
public ItemCustomDrink(String name, int amount, boolean isWolfFood)
{
super(amount, isWolfFood);
setUnlocalizedName(name);
setRegistryName(name);
setCreativeTab(CreativeTabs.BREWING);
setAlwaysEdible();
setMaxStackSize(20);
ModItems.ITEMS.add(this);
}
@Override
public void registerModels()
{
Main.proxy.registerItemRenderer(this, 0, "inventory");
}
@Override
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.DRINK;
}
}
And this is my Item:
public class ItemEstusFlask extends ItemCustomDrink
{
public ItemEstusFlask(String name, int amount, boolean isWolfFood)
{
super(name, amount, isWolfFood);
}
@Override
protected void onFoodEaten(ItemStack itemStack, World worldIn, EntityPlayer player)
{
if (!worldIn.isRemote)
{
player.addPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH, 100, 1));
}
}
}