sinkillerj / ProjectE

ProjectE. A complete rewrite of EE2 for modern Minecraft versions.
MIT License
394 stars 203 forks source link

Extracting and re-inserting maximally-valuable items voids relatively tiny amounts of EMC due to imprecision #2339

Open James103 opened 1 month ago

James103 commented 1 month ago

Tickets that do not conform to this template will be closed without comment

Exact ProjectE version (do not say "latest", "latest on Curse", or similar): ProjectE-1.20.1-PE1.0.1

Exact Forge version: 47.2.31

Link to crash log (please use a paste site, do not attach the .txt or paste the log inline): https://gist.github.com/James103/a79f3239706346405ddd255ea2361b2c

Steps to reproduce:

  1. Create a new world with cheats enabled.
  2. Give yourself a couple of Transmutation Tables.
  3. Place one down, and learn the other. You should now have 260 EMC (the value of the Transmutation Table).
  4. Give yourself a barrier block: /give @s barrier
  5. Run this command: projecte setemc 1234567890767676677 barrier
  6. Run /reload.
  7. Transmute and learn the barrier block.
  8. Take out the barrier block.
  9. 5 EMC is voided. (your EMC becomes 255, 250, 245, 240, ... with each cycle)

What I expected to happen: No EMC is voided or duplicated

What happened instead: Very tiny amounts of EMC are voided or duplicated due to imprecision caused by calculations within ProjectE using 64-bit floating point numbers instead of all BigIntegers.