Modern Industrialization

Modern Industrialization

12M Downloads

Jade shows Air in filled Quantum Tank due to an integer overflow

James103 opened this issue ยท 2 comments

commented

When a Quantum Tank is filled and its fill level, in mB, is congruent to or greater than 2147483648 (modulo 4294967296), Jade reports the fluid is Air despite showing the correct fluid texture. This is probably because some (but not all) of the calculations Jade does cast the fluid amount to a 32-bit signed integer by truncating the most significant bits.

Image

To reproduce, run this command and look at the resulting Quantum Tank:

setblock ~ ~ ~ modern_industrialization:quantum_tank{amt:1000000000000L,fluid:{fk:{id:"modern_industrialization:steam"}},locked:0b}

Last tested and reproduced in: Craftoria 1.20.3, Jade 15.10.0, Modern Industrialization 2.3.4

commented

Damn. The amount is correct though?

commented

The amount is correct though?

Yes, the amount of 1GB represents 1000000000 buckets or 1000000000000 mB, exactly the amount of MB the quantum tank has when placed using the given command. The fill level bar also reflects the true fill amount instead of its 32 least significant bits.