# Pet Food

{% hint style="info" %}
MCPets 4.0.0 introduced the **in-game editor** to simply implement pet food in game, so make sure to check it out using `/mcpets editor`

That will save you some time not diving in configurations anymore!
{% endhint %}

When you are using **living pets**, you can make a good use of food for both **healing your pet** or **taming one**.

There are two possibilities regarding items for the pet food:

#### 1 - Vanilla items

You can use vanilla items as food for your pets.

To achieve that, you will need to put the `ItemId` field to the [material](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html) of your liking. To find out the [material name](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html) of the vanilla item you're looking for, you can check [Spigot API page here](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html).

```yaml
# Example vanilla food item in the petFood.yml config
CarrotFood:
  ItemId: CARROT
  # ... other fields here that'll see down below
```

#### 2 - Custom items

You can use custom items to feed your pets.

What you wanna do first is to make sure you have added the items you want to use as pet food into MCPets through the [command](https://mcpets.gitbook.io/mcpets/tutorials/plugin-features/commands) "*/mcpets item add \<petFoodId>"* with the food item in your hand.

Then, within the `petFood.yml` file, you would use `petFoodId` as the reference for the `ItemId` field.

<pre class="language-yaml"><code class="lang-yaml"># Example vanilla food item in the petFood.yml config
<strong>CustomItemFood:
</strong>  ItemId: petFoodId
  # ... other fields here that'll see down below
</code></pre>

**Items Adder** custom items are also supported as `ItemId` by using the following format (MCPets 4.1.5+ only):

```yaml
# Example ItemsAdder food item in the petFood.yml config
CustomItemFood-UsingItemsAdder:
  ItemId: itemsadder-namespace:item_name
  # ... other fields here that'll see down below
```

**Nexo** is also supported (MCPets 4.1.6+ only):

```yaml
# Example ItemsAdder food item in the petFood.yml config
CustomItemFood-UsingNexo:
  ItemId: nexo_nexoitemid
  # ... other fields here that'll see down below
```

#### Various types of foods

<table><thead><tr><th width="195">Type</th><th width="212">Compatible operators</th><th>Description</th></tr></thead><tbody><tr><td>HEALTH</td><td>add, multiply</td><td>Affect the pet's health</td></tr><tr><td>TAME</td><td>add, multiply</td><td>Affect the taming progress of the pet</td></tr><tr><td>EXP</td><td>add</td><td>Affect the experience of the pet</td></tr><tr><td>EVOLUTION</td><td></td><td>Evolves the pet into another pet</td></tr><tr><td>UNLOCK</td><td></td><td>Gives the permission of the pet to the player consuming the pet food (<em>LuckPerms required</em>)</td></tr><tr><td>BUFF_DAMAGE</td><td>add, multiply</td><td>Gives a damage bonus for a given duration.</td></tr><tr><td>BUFF_RESISTANCE</td><td>add, multiply</td><td>Gives a resistance bonus for a given duration.</td></tr><tr><td>BUFF_POWER</td><td>add, multiply</td><td>Gives a power bonus for a given duration.</td></tr></tbody></table>

When you have added the items into mcpets using the previous command, or that you have chosen a vanilla item to go with, you can go into *"./plugins/MCPets/petFood.yml"* and add your pet food according to the following examples.

### Pet food example: Taming & Health

```yaml
# Here is an example for taming food with a custom item
# Put any key you want here for your pet food (it must be unique)
TamingBerries:
  # Put the item id corresponding to your pet food when you added it with /mcpets items
  ItemId: taming_berries
  # Select the type of food : 
  # - TAME for taming purposes
  # - HEALTH for healing purposes
  Type: TAME
  # Set how much it should affect the feature you chose with type
  # NOTE : the taming progress is between 0 and 1, when it reaches 1 the pet is said to be tamed
  Power: 0.25
  # Choose the operation type :
  # - ADD for addition to the current value
  # - MULTIPLY for multiplication with the current value
  Operator: ADD
  # | Optional |
  # This will send the given Signal to the pet
  # If the pet is listening to it then you can trigger any MythicMobs skill from here
  # Check out MythicMobs wiki for more information : https://git.mythiccraft.io/mythiccraft/MythicMobs/-/wikis/skills/mechanics/signal
  Signal: TAMING
  # | Optional |
  # You can define a list of pets for which this pet food should only be compatible with
  # If you leave that field empty or that you do not provide this field,
  # the pet food will assume that it's compatible with every pets
  Pets:
  - Nocsy_Yokibird-Dark
  - Nocsy_Yokibird-Orange

# Here is an example for healing food with a vanilla item
# Note that you can't have CARROT twice in that file, since we can not distinguish
# different types of vanilla carrots.
FeedingCarrots:
  ItemId: CARROT
  Type: HEALTH
  Power: 20
  Operator: ADD
```

### Pet Food example: Evolution

The evolution items enable you to turn given pets into another evolution. This basically enables you to create evolution trees for instance.

<pre class="language-yaml"><code class="lang-yaml"><strong># Here is an example for evolution food with a custom item
</strong>EvolutionItem:
  ItemId: evolution_crystal
  Type: EVOLUTION
  # Id of the pet that corresponds to the evolution
  Evolution: Nocsy_Drakonin_Adult-Fire
  # (Optional) Define an experience threshold before the item is consumable by the pet
  ExperienceThreshold: 300
  # (Optional) Define a delay before the evolution actually happens, 
  # which is useful if you have an evolving animation triggered through the signal section
  DelayBeforeEvolution: 60
  # | Optional |
  # This will send the given Signal to the pet
  # If the pet is listening to it then you can trigger any MythicMobs skill from here, like an evolving animation
  # Check out MythicMobs wiki for more information : https://git.mythiccraft.io/mythiccraft/MythicMobs/-/wikis/skills/mechanics/signal
  Signal: EVOLVE
  # Make sure to precise the pets that are compatible with that evolution
  # Otherwise any pet would be turned into that evolution using the item!
  Pets:
  - Nocsy_Drakonin_Baby-Fire
</code></pre>

### Pet Food example: Unlock pet

You can create pet food that is consumable by players to unlock a pet.

These items automatically check that the players do not already own the pet.&#x20;

You also get access to a permission to use the said item, to prevent all players from using it for instance.

<pre class="language-yaml"><code class="lang-yaml"><strong># Here is an example for the unlocking pet food
</strong>UnlockItem:
  ItemId: evolution_crystal
  Type: UNLOCK
  # (Optional) you can force the user to have a permission to use the item, it's not a requirement
  Permission: perm.to_use_the_item
  # Id of the pet that corresponds to the evolution
  UnlockPet: Nocsy_Yokibird_Orange
</code></pre>

### Pet Food example: Buffs

You can create temporary buffs using pet foods, like damage increase, power or resistance buffs, or alternatively debuffs.

The following YAML snippet sets up a damage buff for instance

<pre class="language-yaml"><code class="lang-yaml"><strong># Here is an example for the unlocking pet food
</strong>DamageBuffFood:
  ItemId: power_buff_lollipop
  # Can be either BUFF_DAMAGE, BUFF_RESISTANCE or BUFF_POWER
  Type: BUFF_DAMAGE
  # Set how much it should buff the pet.
  Power: 10
  # Choose the operation type :
  # - ADD for addition to the current value
  # - MULTIPLY for multiplication with the current value
  Operator: ADD
  # Define a duration (in ticks) of the effect
  # 1 second is 20 ticks, so 600 ticks means 30 seconds.
  Duration: 600
</code></pre>
