Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powah Ender cell numeric clamping #642

Closed
GStefanowich opened this issue Jul 9, 2024 · 4 comments · Fixed by #643
Closed

Powah Ender cell numeric clamping #642

GStefanowich opened this issue Jul 9, 2024 · 4 comments · Fixed by #643
Assignees
Labels
1.20.1 bug Something isn't working Fixed/Added in dev
Milestone

Comments

@GStefanowich
Copy link

GStefanowich commented Jul 9, 2024

Describe

The Powah mod makes it capable to store insane amounts of power, using Ender Cells

The Powah manual states that an Energy Cell can hold up to 9E of power (Still not sure what the unit of measurement E is yet)

However, the mod compatibility seems to clamp the read energy stored as an int.

cell = peripheral.find("enderCell")

cell.getEnergy()
-- Returns "2147483647" (Max 32bit)

cell.getMaxEnergy()
-- Returns "2000000000000" >32 bit

As seen above though, the "MaxEnergy" is read correctly, at 2 trillion

I tested type(cell.getMaxEnergy()) if it was actually being handled as a string, but it does say number.

Steps to reproduce

  1. Obtain an Ender Cell and 2x Energy Cell (Nitro) (Capable of storing 2B power each)
  2. Place the Ender Cell, open the Ender Cell and shift click both Energy Cells inside (Setting capacity at 4B)
  3. Use a creative power source of some kind to fill the cell past 2.147B / 32-bit int (of 4B capacity)
  4. Use a ComputerCraft computer to attempt reading the current stored power

Multiplayer?

Yes

Version

1.20.1-0.7.40r (Latest 1.20.1)

Minecraft, Forge and maybe other related mods versions

NeoForge 47.1.101 Minecraft 1.20.1

Screenshots or Videos

No response

Crashlog/log

No response

@GStefanowich GStefanowich added bug Something isn't working needs review Needs review from an Contributor labels Jul 9, 2024
@zyxkad
Copy link
Collaborator

zyxkad commented Jul 9, 2024

hm fun, both of them should convert from long to double, not sure if this is powah's issue

@zyxkad zyxkad added 1.19x 1.20.1 and removed needs review Needs review from an Contributor labels Jul 9, 2024
@GStefanowich
Copy link
Author

CC-Tweaked provides a getEnergy method for energy_storage blocks. Is it possible that it's overriding AdvancedPeripherals implementation?

image

The energy_storage equivalent is an int.

https://github.com/cc-tweaked/CC-Tweaked/blob/d77f5f135f9251d027cc900dc27fd80160b632b9/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractEnergyMethods.java#L36-L43

Makes the following methods available:

  • enderCell:
    • getEnergy
    • getMaxEnergy
  • energy_storage:
    • getEnergy
    • getEnergyCapacity

@zyxkad
Copy link
Collaborator

zyxkad commented Jul 9, 2024

Yeah that can be the problem

@GStefanowich
Copy link
Author

I don't think there's a way I can call one specific implementation of it here.

I can open an issue over with CC:Tweaked instead, but I'm not sure how they'd fix it without also directly supporting Powahs Energy class.

https://github.com/Technici4n/Powah/blob/f4d7cf9840f5366783285133b8e5d6e365d6dd1c/src/main/java/owmii/powah/lib/block/AbstractEnergyStorage.java#L166-L168

energy_storage uses the Forge net.minecraftforge.energy.IEnergyStorage, which is also an int.

@zyxkad zyxkad removed the 1.19x label Jul 9, 2024
zyxkad added a commit to zyxkad/AdvancedPeripherals that referenced this issue Jul 9, 2024
in order to prevent the method conflict with CC:Tweaked's energy_storage generic peripheral
resolve IntelligenceModding#642
@zyxkad zyxkad linked a pull request Jul 9, 2024 that will close this issue
2 tasks
@zyxkad zyxkad self-assigned this Jul 9, 2024
@zyxkad zyxkad reopened this Jul 13, 2024
@SirEndii SirEndii moved this to To Be Released in Advanced Peripherals Aug 24, 2024
@SirEndii SirEndii added this to the 0.7.x milestone Aug 24, 2024
@github-project-automation github-project-automation bot moved this from To Be Released to Done in Advanced Peripherals Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20.1 bug Something isn't working Fixed/Added in dev
Projects
Development

Successfully merging a pull request may close this issue.

3 participants