mojira.dev
MC-15876

Negative Score on Death

The bug

The number of points on the death screen becomes negative with a very large number of experience levels.

How to reproduce

Enter these commands step by step:

/xp add @s 1999999999 points (10 times)
/kill @s

→ The number of points on the death screen now displays a large negative number (about -1474836390)

Linked issues

Attachments

Comments 30

Confirmed.

Eliot Partridge

From what I can see here, this is because of the code behind the /xp command.

1,999,999,999 (What he typed in)
2,147,483,647 (Limit of an int)

Variables initialized in Minecraft 1.5.2's code (may be partially modified, notify me if so)
private int aN;
private int aS;
private aL[][] a;
private boolean t;
private S c;

I don't know if any of that could possibly have anything to do with it, as what he entered is not as big as an int's max value, but I don't know if the command's arguments are stored in an int, possibly a string. It would depend on the command, however.

Honestly, I don't even know what I'm saying, just decided to poke around the code for a bit and see what I could come up with.

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

(Automatic Message)

Confirmed for 14w21b.

Legofan Minifig

Confirmed for 1.8-pre1.

20 more comments

Can confirm in 21w16a.

Can confirm in 21w17a.

Can confirm in 1.16.5 and 21w20a.

Can confirm in 1.17.

Can confirm in 1.17.1.

William Eaton

JUE13

(Unassigned)

Confirmed

(Unassigned)

death-screen, negative, score

Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w19a, Snapshot 13w21b, Snapshot 13w22a, ..., 21w16a, 21w17a, 21w20a, 1.17, 1.17.1

Retrieved