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

Feeding golden carrot to breed horse works if InLove is greater than 0

XMLWordPrintable

    • Unconfirmed

      The bug

      When you try to breed a horse you can still feed it golden carrots even if the InLove value is greater than 0. This is different compared to other animals which can only be fed once and to golden apples which can only be used if the horse is not in love.

      The reason

      The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

      The reason for this is that the method net.minecraft.entity.passive.EntityHorse.func_184645_a(EntityPlayer, EnumHand, ItemStack) tests for golden carrots only if the horse is tamed and an adult horse.

      public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_, ItemStack p_184645_3_)
      {
          if (p_184645_3_ != null && p_184645_3_.getItem() == Items.spawn_egg)
          //...
          else
          {
              if (p_184645_3_ != null)
              {
                  //...
      
                  boolean flag = false;
      
                  if (!this.getType().func_188602_h())
                  {
                      float f = 0.0F;
                      int i = 0;
                      int j = 0;
      
                      if (p_184645_3_.getItem() == Items.wheat)
                      //...
                      else if (p_184645_3_.getItem() == Items.golden_carrot)
                      {
                          f = 4.0F;
                          i = 60;
                          j = 5;
      
                          // Should test as well if the horse is not in love (see golden apple test)
                          if (this.isTame() && this.getGrowingAge() == 0)
                          {
                              flag = true;
                              this.setInLove(p_184645_1_);
                          }
                      }
                      else if (p_184645_3_.getItem() == Items.golden_apple)
                      {
                          f = 10.0F;
                          i = 240;
                          j = 10;
      
                          if (this.isTame() && this.getGrowingAge() == 0 && !this.isInLove())
                          {
                              flag = true;
                              this.setInLove(p_184645_1_);
                          }
                      }
      
                      //...
                  }
      
                  //...
              }
              
              //...
          }
      }
      

            FruBasilicum [Mojang] Agnes Larsson
            marcono1234 Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: