GregTech CE Unofficial

GregTech CE Unofficial

412k Downloads

Electric tool damage chance config is inaccurate

windyknight opened this issue ยท 1 comments

commented

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.

commented

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