Mekanism Generators

Mekanism Generators

114M Downloads

[1.21.1] Induction Matrix Energy Incorrectly Reported via ComputerCraft when using FORGE_ENERGY units.

TheLargeCactus opened this issue ยท 5 comments

commented

Issue description

It is possible to switch between JOULES and FORGE_ENERGY as the unit display within the mod config. When changed to FORGE_ENERGY, stored energy in the induction matrix is converted in the GUI, but the numbers when getting data from the induction matrix using cc:tweaked are shown with the joule value. This was confusing when I ran into it, and while not totally unreasonable, it led me down a frustrating search, pouring through all the mods in the pack (ATM10) and finally reading the source code to understand why it was happening.

I think this is ultimately a judgement call by the mod author, should these values be adjusted based on the config or should they remain in joules no matter what?

Extra details: I am playing on a dedicated server
Client mod version: 1.21.1-10.7.15.81
Server mod version: 1.21.1-10.7.15.81
common.toml config value energyType = "FORGE_ENERGY" on server.
common.toml config value energyType = "FORGE_ENERGY" on client.
pack version: All The Mods 10-4.11
NeoForge: neoforge 21.1.209
server OS: ubuntu 24.04
Client OS: windows 10

Steps to reproduce

  1. Add mekanism to a neoforge server with the versions above
  2. add cc:tweaked to the server
  3. change the config value `energyType = "FORGE_ENERGY" in the server config common.toml for mekanism
  4. change the config value `energyType = "FORGE_ENERGY" in the client config common.toml for mekanism
  5. connect to the server with a client containing the same mods and config
  6. build an induction matrix
  7. add x amount of energy to the matrix
  8. attach a cc:tweaked computer to one of the induction ports
  9. open the lua console inside the cc:computer
  10. wrap the induction matrix as a peripheral in the lua console
  11. get the energy value with <wrap_ref>.getLastInput() (or output or other energy reporting methods)
  12. notice that the energy value is exactly 2.5 times it's FE value in the lua console inside the cc:computer compared to it's value in the matrix UI.

Minecraft version

1.21.1 (Latest)

NeoForge version

21.1.209

Mekanism version

10.7.15

Other relevant versions

Untested.

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

No response

commented

no, but the global computerEnergyHelper.joulesToFE can convert it for you

commented

I'm not following what you mean by no, like no changes will be made? I have the wrong assumption?

As well, how do I use that global? It doesn't appear in the autocomplete when using the lua console on a cc:computer, and is there another method that can get the current unit? I think that would make sense to determine whether conversion is needed or not.

commented

I added a PR for this as I didn't find any computer method to do it. #8507

commented

I may have read a question where there wasn't one.

The cc output will remain in joules. Adding a helper to get the configured value is possible, though it will only have any real meaning in single player or where specifically configured on a server. Scripts using it will be locking players into it regardless of their settings

commented

I created #8507 to add the helper, and gave an example of how it could be useful for multiple scripts.