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

Electric tool damage chance config is inaccurate #2348

Closed
windyknight opened this issue Jan 16, 2024 · 1 comment · Fixed by #2350
Closed

Electric tool damage chance config is inaccurate #2348

windyknight opened this issue Jan 16, 2024 · 1 comment · Fixed by #2350
Labels
status: unverified Issue is unverified

Comments

@windyknight
Copy link

windyknight commented Jan 16, 2024

GregTech CEu Version

2.7.4

Modpack Used

Nomifactory CEu 1.7 alpha 1

Addons Installed

No response

Environment

Singleplayer

New Worlds

Yes

Cross-Mod Interaction

Yes

Expected Behavior

Electric tool durability does not decrease when corresponding config option is set to 0.

Actual Behavior

Durability slowly decreases.

Steps to Reproduce

  1. Set config option rngDamageElectricTools to 0.
  2. Get an electric drill, preferably one of a high voltage tier.
  3. Dig lots of stuff.
  4. Observe as the durability decreases after a while.

Additional Information

Most likely cause is in ToolHelper file's damageItem method. The line relating to chance is (paraphrased)
random.nextInt(100) > rngDamageElectricTools to not damage the tool.

The problem is that the nextInt() method can generate 0, so setting the config to 0 only reduces the damage chance to 1%. In general, this line produces a damage chance that is 1% higher than what the config setting would imply. Setting the config to 99 would give a 100% chance.

To fix this, changing the > to an >= should suffice.

@windyknight windyknight added the status: unverified Issue is unverified label Jan 16, 2024
@h3nry-s71ckm1n
Copy link

I managed to reproduce this issue on GTCEu 2.8.5 by itself.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: unverified Issue is unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants