Lightman314 / LightmansCurrency

Lightman's Currency Minecraft Mod
Other
26 stars 16 forks source link

BUG: ATM Balance Overflow #207

Closed ookkoouu closed 6 months ago

ookkoouu commented 6 months ago

Minecraft Version

1.20.1

Forge Version

47.2.20

Lightman's Currency Version

2.2.1.0b

Environment Type

Dedicated Server (Bug/crash happened while connected to a server or while the dedicated server was booting)

Other relevant Mods

No response

Describe the bug

Depositing more than 2147483648 at the ATM will result in a zero balance.

To Reproduce

  1. Rise all exchangeRate to 100
  2. Deposit above 21d47e48g36i48c to ATM

Screenshots/Logs/Crash Reports

lc_overflow

Lightman314 commented 6 months ago

I'll look into it. No clue why it's being limited by the integer maximum when money values are long-based, but I'll do some testing to see if I can figure out why this is happening regardless...

ookkoouu commented 6 months ago

It has been bugged since version 2.2.0.3. I said so for clarity but exchangeRate is irrelevant.

There is a bug related to this where the wallet content tooltip disappears, which seems caused by the same thing. lc_overflow_wallet

Lightman314 commented 6 months ago

I believe I have found the issue, and the issue was annoying enough caused by my coin entry sorters sorting the available entries backwards, meaning all coin values generated from a raw long value (which is done whenever coin values are added to each other) were always compared to the copper coins value first, instead of the netherite coins value. And since each "coin entry" portion of a coin value is stored as an integer instead of a long, it was thus limited to the maximum integer value (as copper coins are always worth 1)

This will be fixed in the next build, and conveniently enough this should also help some of the other lag issues I've been trying to resolve, as now money values will be calculated correctly the first time, instead of being calculated as a large number of copper coins and then rounded again later in a slightly less efficient method.

Lightman314 commented 6 months ago

Fixed for 1.20.1 in v2.2.1.1.