/effect fails with durations larger than 107374182 seconds
The bug
Effects applied with a duration longer than 107374182 seconds simply fail for no reason. This is probably because translating it to ticks ends up just below the integer size limit, and an increase of one overflows and makes the value negative.
How to reproduce
- /effect @a speed 107374182
→
It works - /effect @a clear
- /effect @a speed 107374183
→
FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless of the chosen limit, all legal values should function properly.
Created Issue:
/effect fails with durations larger than 966367641 seconds
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant.
How to reproduce
1. /effect @a speed 966367641
→It works
2. /effect @a clear
3. /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant.
How to reproduce
1. /effect @a speed 966367641
→It works
2. /effect @a clear
3. /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant.
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant.
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition.
But regardless, all legal values should function properly.The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant.
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant
.How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant (translated to ticks, it's 0x47FFFFFF4, one additional second pushes us past 0x480000008
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant (translated to ticks, it's 0x47FFFFFF4, one additional second pushes us past 0x480000008)
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant (translated to ticks, it's 0x47FFFFFF4, one additional second pushes us past 0x48000000
8)How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant (translated to ticks, it's 0x47FFFFFF4, one additional second pushes us past 0x480000000)
How to reproduce
- /effect @a speed 966367641
→It works
- /effect @a clear
- /effect @a speed 966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.
/effect fails with durations larger than966367641seconds/effect fails with durations larger than 107374182 seconds
The bug
Effects applied with a duration longer than 966367641 seconds simply fail for no reason. This value is hex 0x39999999, which is probably relevant (translated to ticks, it's 0x47FFFFFF4, one additional second pushes us past 0x480000000)
How to reproduce
- /effect @a speed
966367641
→It works
- /effect @a clear
- /effect @a speed
966367642
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition.
The current enforced limit is 2147483647, meaning 55% of possible values fail. Regardless of the chosen limit, all legal values should function properly.The bug
Effects applied with a duration longer than 107374182 seconds simply fail for no reason. This is probably because translating it to ticks ends up just below the integer size limit, and an increase of one overflows and makes the value negative.
How to reproduce
- /effect @a speed 107374182
→It works
- /effect @a clear
- /effect @a speed 107374183
→FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless of the chosen limit, all legal values should function properly.
It seems that it has to do with the maximum amount of an Int32.
but for gameticks instead of seconds. So calculated back from that the maximum amount of seconds is: 107,374,182 you can fill in and have it work.
Any more and there will be a overflow in calculations.
Fun fact: if you gives yourself /effect @s night_vision 214748366 0
it results in an overflow that only provides 24 gameticks of night vision.
I suggest either giving a message back that the maximum filled in time cannot be bigger than 107,374,182, or increase the integer for effects and duration to Int64.
Ah, thank you! I did not consider that large enough numbers would wrap around to legal values again. I'll update the report