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

Horse Breeding Doesn't Produce Markings Correctly on Foal

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.6.2
    • Fix Version/s: Minecraft 13w37a
    • Labels:
    • Environment:

      Minecraft 1.6.2, Java 1.6.0_51, Mac OS X 10.8.4

    • Confirmation Status:
      Confirmed

      Description

      There appears to be a problem in how the markings is selected for foal when breeding. The horse color works fine: it has about a 50-50 chance of taking either parent's color with a small chance of producing a new color. With the markings, however, it has a much higher chance of taking the mother's markings (the mother being the one the horse spawns under) than the fathers. It also will never produce a new type of marking like how it can have a new color.

      The following comes from the Mod Coder Pack, so the accuracy will vary

      The problem seems to be in the EntityHorse class in the createChild method (It will most likely be differently named in the official code). The code for choosing the horse's color looks like this:

      int i = this.rand.nextInt(9);

      if (i < 4) //Use Mother's Color
      else if (i < 8) //Use Father's Color
      else //Use Random Color

      This gives the foal a 4/9 chance of having his mother's color, 4/9 chance of having his father's color, and a 1/9 chance of having a random color.

      However, the code for selecting the markings on the horse looks like this:

      int i = this.rand.nextInt(5);

      if (i < 4) //Use Mother's Markings
      else if (i < 8) //Use Father's Markings
      else //Use Random Markings

      The if statements looks like it's trying to make another 4-4-1 probability, but because it uses rand.nextInt(5); instead of rand.nextInt(9);, the probability is actually 4/5 chance of having his mother's markings, 1/5 chance of having his father's markings, and no chance of getting random markings.

      It seems like the problem is just a simple typo that could easily be patched in the next minecraft version.

        Attachments

          Activity

            People

            • Assignee:
              evilseph EvilSeph (Warren Loo)
              Reporter:
              lrflew LRFLEW
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: