MauveCloud / Ic2ExpReactorPlanner

A planner for nuclear reactors in the popular Minecraft mod IndustrialCraft2 Experimental.
GNU General Public License v2.0
180 stars 30 forks source link

Make heat-relating numbers display in integers instead of floats #64

Closed KrisBigK closed 5 years ago

KrisBigK commented 5 years ago

I don't see any reason why reactor temperature, heat generation, etc to be a float, so I changed them to display as integers. Also deleted an extra "%" that I found.

I'm not sure about whether to change related things in CSV output. They should also be integers.

MauveCloud commented 5 years ago

I don't see any reason why reactor temperature, heat generation, etc to be a float, so I changed them to display as integers.

They are currently passed to String.format as floating-point values, so just changing them to %,d in Bundle.properties will trigger a java.util.IllegalFormatConversionException. I can think of 3 ways to avoid this:

  1. Use %,.0f instead - skips showing the decimal places, but doesn't require any changes to the Java code.
  2. Convert the values to integers in the String.format call.
  3. Use the DecimalFormat conversion I've added (but not yet released) similar to the HU/t and EU/t outputs - this avoids assumptions about whether these values will ever have fractional parts, but still displays them like integers when they don't.
KrisBigK commented 5 years ago

Alright, used %,.0f. Now it should be fine.

MauveCloud commented 5 years ago

Technically not for the CSV data, but I'll take care of it - adding the grouping separator to the format specifier means that some of them may end up with an inconsistent number of columns, but since some places use the comma as a decimal separator (and a period as the grouping separator), there was a risk of that before.