mojira.dev
MC-44944

"0" is not handled as a valid seed

If you enter the digit "0" as seed code, it's handled as if there is no seed chosen, so a random one is picked. The seed can be set to "0" be deleting all generated chunks and changing the seed inside of the level.dat file.

Comments 19

Still present in 1.8.1-pre5

Limitation of how seeds work, setting it to 0 doesn't work so nicely 😃

Confirmed for

  • 15w49b

Grum, that is not correct it should rather be "Limitation of how we made seeds to work"

In /Client/src/net/minecraft/client/gui/GuiCreateWorld.java (MCP 1.8 name) you can clearly see that the reason for this is if (var5 != 0L) and there is very likely no reason for that, instead it creates other bugs like MC-94025

long var2 = (new Random()).nextLong();
String var4 = this.field_146335_h.getText();

if (!StringUtils.isEmpty(var4))
{
	try
	{
		long var5 = Long.parseLong(var4);

		if (var5 != 0L)
		{
			var2 = var5;
		}
	}
	catch (NumberFormatException var7)
	{
		var2 = (long)var4.hashCode();
	}
}

So is there any reason for that?

Did you look for where the seed value is actually used, and how it is used? It's fed directly to Java.util.Random.Random() in net.minecraft.world.gen.ChunkProviderGenerate.ChunkProviderGenerate(), and looking at the algorithm it uses, that probably doesn't produce a useful sequence.

9 more comments

Are you sure you really want to leave it this way?

You can still get 0 as seed value with for example the string "tainsntoh". People will only complain and create new reports. Additionally new Random().nextLong() could produce 0 as well.

MC-94025 has been reopened to deal with the consequences of strings that hash to 0 such as "tainsntoh".

Can you please create a "relates to" link to MC-94025

This no longer happens (MC-209001).

Does 22w03a "fix" this?

Lukas Spanier

Erik Broes

Confirmed

world

Minecraft 1.7.4, Minecraft 14w02c, Minecraft 1.7.9, Minecraft 14w21b, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 1.8.1-pre5, Minecraft 15w33b, Minecraft 15w33c

Retrieved