mojira.dev
MC-94025

A world with seed 0 cannot be copied using the "Re-Create" option

The bug

When you have a world with seed zero, i.e. when

/seed

outputs 0, then it cannot be recreated using the "Re-Create" option, because it will be interpreted as a random seed. To be clear, I know that putting "0" in the seed option is supposed to create a random world. However, I would expect that copying an existing world with seed 0 would also generate a world with seed 0.

How to reproduce

As mentioned, putting '0' in the seed option on the "Create New World" screen will be interpreted as a random seed (Personally I find this unintuitive behavior, but this has been resolved as intended: MC-1820). However, a world with the seed 0 can be generated either through external tools, or by choosing the seed text very carefully. Here are some options for the text, that will generate a world with seed 0:

tainsntoh
f5a5a608
af4e962cd

Comments 18

marcono1234

Confirmed for

  • 15w49b However I would conside MC-1820 rather as a bug. If the user wants a random seed he should leave the text field empty

migrated

[Mojang] Grum (Erik Broes) resolved MC-44944 - "0" is not handled as a valid seed as 'Works As Intended'

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

migrated

I agree. The seed text should be left empty for a random seed. If I specify that I want my seed to be '0' then it should be zero. I found it a little irritating that I couldn't even copy the world once I actually had one with seed zero.

migrated

this works as intended as of MC-44944

marcono1234

The would probably need to be changed to test if the parsed long or the hash code is 0. This would not fix the problem for already existing worlds with the seed 0.

long i = (new Random()).nextLong();
String s = this.worldSeedField.getText();

if (!StringUtils.isEmpty(s))
{
    long j;
    
    try
    {
        j = Long.parseLong(s);
    }
    catch (NumberFormatException var7)
    {
        j = (long)s.hashCode();
    }
    
    if (j != 0L)
    {
        i = j;
    }
}

Note: If this is really the planned fix, a message in the world creation GUI should indicate that 0 or Strings that have 0 as hash code result in a random seed.

This whole situation shows that defining 0 as special is problematic.

8 more comments
migrated

Affects 1.16.5 and 20w51a.

Creeper Juice

Can confirm in 1.17.1.

muzikbike

Does 22w03a resolve this issue?

muzikbike

22w03a does, in fact, seem to resolve this

ampolive

Can confirm fixed in 22w03a.

migrated

(Unassigned)

Confirmed

(Unassigned)

Minecraft 1.8.8, Minecraft 15w49b, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 1.12.1, ..., Minecraft 19w03c, 20w21a, 20w51a, 1.16.5, 1.17.1

22w03a

Retrieved