Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-204760

You cannot tempt or tame cats or ocelots using cooked cod or salmon

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w08b, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 3, 1.17 Pre-release 4, 1.17 Pre-release 5, 1.17 Release Candidate 1, 1.17 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1 Pre-release 3, 1.17.1 Release Candidate 1, 1.17.1, 21w37a, 21w38a, 21w39a, 21w41a, 21w43a, 1.18, 1.18.1, 22w03a, 22w05a, 22w06a, 1.18.2, 22w17a, 22w19a, 1.19, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.5, 1.21
    • Confirmed
    • Mob behaviour

      The Bug:

      You cannot tempt or tame cats or ocelots using cooked cod or salmon.

      Since you can tempt/tame cats and ocelots using raw cod and raw salmon, it seems quite illogical that this same concept cannot be seen with the cooked variants of these items.

      Steps to Reproduce:

      1. Summon a cat or ocelot and obtain some cooked cod or salmon.
      2. Attempt to tame the cat or ocelot using the cooked item.
      3. Take note as to whether or not you can tempt or tame cats or ocelots using cooked cod or salmon.

      Observed Behavior:

      You cannot tempt or tame cats or ocelots using cooked cod or salmon.

      Expected Behavior:

      You would be able to tempt and tame cats and ocelots using cooked cod and salmon.

      Code Analysis:

      Code analysis by Avoma can be found below.

      The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.

      net.minecraft.world.entity.animal.Cat.java
      public class Cat extends TamableAnimal {
         ...
         private static final Ingredient TEMPT_INGREDIENT = Ingredient.of(Items.COD, Items.SALMON);
         ...
      net.minecraft.world.entity.animal.Ocelot.java
      public class Ocelot extends Animal {
         ...
         private static final Ingredient TEMPT_INGREDIENT = Ingredient.of(Items.COD, Items.SALMON);
         ...

      If we look at the above classes, we can see that the only items that cats and ocelots are tempted by are cod and salmon. Because of this, both cooked cod and cooked salmon cannot be used to tempt/tame cats and ocelots, therefore resulting in this problem occurring.

      Fix:

      Simply adding both cooked cod and cooked salmon to the list of items that cats and ocelots are tempted by, will resolve this problem.

      net.minecraft.world.entity.animal.Cat.java
         ...
         private static final Ingredient TEMPT_INGREDIENT = Ingredient.of(Items.COD, Items.SALMON, Items.COOKED_COD, Items.COOKED_SALMON);
         ...
      net.minecraft.world.entity.animal.Ocelot.java
         ...
         private static final Ingredient TEMPT_INGREDIENT = Ingredient.of(Items.COD, Items.SALMON, Items.COOKED_COD, Items.COOKED_SALMON);
         ...

        1. MC-204760.mp4
          5.71 MB
        2. MC-204760.png
          MC-204760.png
          719 kB
        3. MC-204760 - Current Code.png
          MC-204760 - Current Code.png
          208 kB
        4. MC-204760 - Fixed Code.png
          MC-204760 - Fixed Code.png
          158 kB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            15 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: