[MC-2788] Sheep wool color doesn't generate/randomize properly; generating villages resets world RNG Created: 11/Nov/12 Updated: 19/Feb/21 Resolved: 19/Sep/19 |
|
| Status: | Resolved |
| Project: | Minecraft: Java Edition |
| Component/s: | None |
| Affects Version/s: | Minecraft 1.4.2, Minecraft 1.4.4, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w02a, Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w09a, Snapshot 13w09b, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w17a, Snapshot 13w18a, Snapshot 13w18b, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w38c, Minecraft 13w42a, Minecraft 13w42b, Minecraft 13w43a, Minecraft 1.7, Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 14w17a, Minecraft 14w19a, Minecraft 14w21b, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 15w41b, Minecraft 15w47b, Minecraft 1.9.4, Minecraft 1.10.2, Minecraft 1.11.2 |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Jonathan Haas | Assignee: | Unassigned |
| Resolution: | Awaiting Response | Votes: | 18 |
| Labels: | color, group, mob, sheep, wool, world-generation | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| CHK: | |||||||||||||||||||||||||||||||||||||
| Confirmation Status: | Confirmed | ||||||||||||||||||||||||||||||||||||
| Category: |
World generation
|
||||||||||||||||||||||||||||||||||||
| Description |
|
Sheep groups spawning at world generation or otherwise when structures are generated at the same time will spawn the same sheep colors. Steps to reproduce:
Actual results:
Expected result:
The code that generates groups of sheep (and possibly other mobs) doesn't seem to use the random generator properly so all the sheep groups are generated the same. See comments for details and attachments for debug output. Note: This bug probably applies only to mobs spawning while structures are generated at the same time, if you search long enough, you may/will find different sheep groups. PS: Additionally, some seeds like "135" spawn huge amounts of pigs but no sheep, so it may be possible that the random generator fails to be random even earlier: At determining which mobs to spawn. Code analysisSee this comment by bugi74 |
| Comments |
| Comment by [Bot] Arisa [ 09/Feb/21 ] |
|
This report is currently missing crucial information. Please take a look at the other comments to find out what we are looking for. |
| Comment by [Mojang] slicedlime [ 19/Sep/19 ] |
|
Is this still an issue in 1.14.4 or above? |
| Comment by Fabian Röling [ 28/Jun/18 ] |
|
You don't have to find the sheep, just give them the glowing effect. I found one group with a dark grey sheep, like in the report, and another one without a grey sheep. |
| Comment by Markku [ 28/Jun/18 ] |
|
White is too common color, so that can not be used to check this one. It is best to check the seeds and locations already mentioned, but also note that world generation changes can make the earlier seeds/locations to no longer give the same results. The best indication is to find a group with sheep(s) of rarer color(s), and see if the same color distribution is found in other groups nearby. E.g. if multiple groups all have 3 whites and one black, it could be an indication of this bug still being in effect. Typically, one would first find a world with a nice amount of sheep groups close together, then recreate the world with the same seed, but teleport right in the middle of those sheep groups (so they get generated in the same generation "run"). But just flying around in creative might do the trick, too. |
| Comment by Fabian Röling [ 28/Jun/18 ] |
|
I'm not too familiar with this bug, but I just found a pack of four white sheep in the "136" seed. Does that mean it's fixed? |
| Comment by Matthew [ 28/Jun/18 ] |
|
Is this still an issue in 1.13-pre5? Please keep the ticket updated. |
| Comment by jonathan2520 [ 29/Jun/16 ] |
|
This is seed 136 in 1.10.2. At spawn I didn't immediately discern a pattern although many groups were the same. Near a village ALL groups were 2 white + 2 black. The debug screen shows these coordinates: 634, 118, 112. Generating a new world and teleporting there reproduces it. I also disassembled the game using javap and found the mechanism is still in place. Village generator sets the world's RNG to a particular value. Sheep uses the world's RNG to pick a color. ??? Profit! |
| Comment by Jonathan Haas [ 29/Jun/16 ] |
|
Try a more recent seed and try to find sheep groups that are near each other (ie generate at the same time). I'd try the seed and coordinates by Vitold but I'm curently away from home so I can't try reproducing this. |
| Comment by Fabian Röling [ 29/Jun/16 ] |
|
Just opened seed 136 in 1.10.2. First group of 4 sheep I found was two white, one light grey, one dark grey. Second group of 4 sheep I found was three white and one light grey. These groups were far away from each other and I made sure (with glowing effect) that I didn't confuse sheep of different groups. Does that mean fixed for 1.10.2? |
| Comment by Vitold Chernatinski [ 17/May/16 ] |
|
Still Reproducible in 1.9.4 |
| Comment by [Helper] clam lol [ 20/Nov/15 ] |
|
Still in 15w47b, I spawned next to a village and half the sheep nearby were pink... |
| Comment by Galaxy_2Alex [ 25/Oct/14 ] |
|
Reopened, thanks. |
| Comment by Jonathan Haas [ 25/Oct/14 ] |
|
It's difficult to find good seeds to reproduce this, bit it seems to be still present in 1.8.1-pre3. Seed 8807133522892241494 at X=75, Z=320 seems to spawn purely white sheeps for example now. |
| Comment by Galaxy_2Alex [ 24/Oct/14 ] |
|
Is this still a concern in the current Minecraft version 1.8.1 Prerelease 3 / Launcher version 1.5.3 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. |
| Comment by Jonathan Haas [ 22/Feb/14 ] |
|
Still reproducible in 14w08a using the seed Tails posted above. |
| Comment by [Mod] Ezekiel (ezfe) [ 21/Feb/14 ] |
|
Is this still a concern in the latest Minecraft version 14w08a? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. |
| Comment by Tails [ 22/Oct/13 ] |
|
Example with pink sheep: 8807133522892241494 at X=75, Z=320 |
| Comment by Jonathan Haas [ 22/Sep/13 ] |
|
Still reproducible in latest snapshot. Example Seed: 12. Will only spawn groups of 3 white and one brown sheep. |
| Comment by Jonathan Haas [ 06/Jul/13 ] |
|
Still reproducible in the latest version (1.6.2 prerelease). The seed is indeed very nice, one pink sheep in every group. |
| Comment by Markku [ 21/Mar/13 ] |
|
Affects 1.5.1. |
| Comment by Markku [ 28/Feb/13 ] |
|
Affects 13w09b. |
| Comment by Jonathan Haas [ 18/Feb/13 ] |
|
Thanks for your fix, Markku. Makes sense to me. I hope the developers will include this in the main source. |
| Comment by Markku [ 16/Feb/13 ] |
|
Fix World public Random setRandomSeed(int par1, int par2, int par3) { long var4 = (long)par1 * 341873128712L + (long)par2 * 132897987541L + this.getWorldInfo().getSeed() + (long)par3; //this.rand.setSeed(var4); //return this.rand; return new Random(var4); // <-- Makes things better? } That is, instead of resetting the world random generator, just return a new generator with the same end state. There are two callers to this method. I didn't study their behaviour thoroughly after this change, but at least the other caller (village generator) seemed to still generate a valid looking village in a place where I knew a village was supposed to be. I leave the rest as an exercise to Mojang (or anyone else with interest). After fix, sheep colors are random, even when regenerating the world with the same seed. (There is a way to get same random sequence of colors each time the world is generated, but if Mojang wants that, they need to implement that separately.) (Edit: the proposed fix is "bad coding", at least if keep using that method name; that method name indicates that the seed is indeed being set, and since it is aimed at the world instance, natural interpretation would be that the seed of the RNG of the world is to be set, which is not happening after the fix. Perhaps change the method name to something like "getRNGWithState"?) Bug There are other things resetting the world RNG (sets its seed), too, but the other calls are very few, like 4 resets in the same span the two feature generators make hundres of resets. Sample data |
| Comment by Jonathan Haas [ 20/Dec/12 ] |
|
I decompiled minecraft using MCP and modified the function generating sheep color like this: EntitySheep.java public static int getRandomFleeceColor(Random par0Random) { int var1 = par0Random.nextInt(100); System.out.println("Random " + var1); return var1 < 5 ? 15 : (var1 < 10 ? 7 : (var1 < 15 ? 8 : (var1 < 18 ? 12 : (par0Random.nextInt(500) == 0 ? 6 : 0)))); } so it prints the generated "random" value to the console. As you can see by looking at the attached file, the values are not random at all and instead repeat every 4 values, so the color repeats for every 4 sheep generated. |
| Comment by Jonathan Haas [ 20/Dec/12 ] |
|
The issue is still present in 1.4.6. Sheep spawning is unchanged. The problem is not that sheeps spawn more in pink, grey and and brown colors, the issue is that all sheep groups spawn the same. |
| Comment by Mustek [ 20/Dec/12 ] |
|
Seems like the colored sheep spawning rates have increased, I see more pink, brown and grey sheep now. Is this still an issue for you or can this be resolved? |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
Some more screenshots of quarry seed with spawn groups highlighted |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
No, all seeds do this, this is just a random example. Other seeds just spawn different sheep groups; there are seeds that spawn only white sheep and there is the other seed that spawns groups of one pink sheep and three brown sheep, although I don't know if I have the save file/seed still. |
| Comment by GrygrFlzr [ 11/Nov/12 ] |
|
Ah, yeah, the seed quarry seems to generate groups of 3 white and 1 brown sheep. In fact looking around it's all 3 white and 1 brown sheep. That's definitely not random enough, but is this the only seed that does this? Using a seed removes the randomness, after all. Spawning during world generation is controlled by the world seed, not sure about post-worldgen spawning. |
| Comment by Kumasasa [ 11/Nov/12 ] |
|
Have attached the screenshot of seed "quarry". Seeing white and brown sheep at given coordinates. |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
Martin: I'm not categorizing randomness as a bug, but I ended up having several completely improbable results, so I'm just asking if the random generator is working correctly. While it could be possible that these events were all random, the devs could and probably should just check the internal seeds of each sheep group generator and make sure that they are indeed random. If they are, I'm happy with it, but I strongly suspect a bug here. |
| Comment by GrygrFlzr [ 11/Nov/12 ] |
|
I don't think anything with randomness in it can be categorized as a bug. We can only calculate the chance of a certain result appearing, so the actual results can be quite different. For example, I can roll 6 dice simultaneously and end up with six 6s. Probability states that it should only have a 1/46656 chance of happening, and yet it can happen. If you ended up with the expected results (nearly no dice having the same number, or in this case mostly white sheep with barely any brown sheep) all the time, it would mean the random number generator is too predictable. This is a sign the randomizer is working. |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
@Kumasasa 1/6 obviously, but if you roll a 6 thousand times in a row, you might question if the dice is working correctly, although it could still be random of course. The probablillity for that is just incredibly low. |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
Just a quick example: generate a new world with seed "quarry" in creative mode. Go/Fly to the plains biome x=0, z=190, observe sheep groups. All groups consist of 1 brown sheep and 3 white ones. This is just a completely random seed I use and is not specially choosen to spawn exactly these sheep. If I find a way/screenshot to reprocude the pink sheeps, I will post it here, but this should do for now. |
| Comment by Kumasasa [ 11/Nov/12 ] |
|
Random is random. The probability for a pink sheep to spawn is always 0.164%, regardless how many pink sheep are running around yet. |
| Comment by GrygrFlzr [ 11/Nov/12 ] |
|
Are you saying that the issue is that supposedly rare sheep (brown and pink) are spawning a bit too frequently? I don't really understand the issue from the description. |
| Comment by Jonathan Haas [ 11/Nov/12 ] |
|
Yes, I know, but try to calculate the probablity of of 6 sheep groups with each 1 pink sheep and 3 brown sheep in it. (In plains biome) I'm no expert in statistics, but the probablity for that is extremely low, around 1×10^-50, so I'm pretty sure this is an issue in the game. At least the devs should take a look at the code. |
| Comment by Kumasasa [ 11/Nov/12 ] |
|
The spawning rates of the colours are not equally distributed: For doing a real statistics a sample of 6 groups á 4 sheep is way too less. |