Skip to content

Commit 3c4a0e0

Browse files
committed
keep values proportional instead of resetting on switching modes
1 parent 66a15f3 commit 3c4a0e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/gregtech/common/covers/detector/CoverDetectorEnergyAdvanced.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ private void updateWidget(GTTextFieldWidget w) {
138138
}
139139

140140
private long getMinValue() {
141-
return (minValue);
141+
return minValue;
142142
}
143143

144144
private long getMaxValue() {
145-
return (maxValue);
145+
return maxValue;
146146
}
147147

148148
private void setMinValue(long val) {
@@ -163,11 +163,11 @@ private void setUsePercent(boolean b) {
163163
this.usePercent = b;
164164

165165
if (this.usePercent) { // using percent
166-
this.minValue = DEFAULT_MIN_PERCENT;
167-
this.maxValue = DEFAULT_MAX_PERCENT;
166+
this.minValue = (long) Math.ceil(((double) this.minValue / getCoverHolderCapacity()) * 100d);
167+
this.maxValue = (long) Math.ceil(((double) this.maxValue / getCoverHolderCapacity()) * 100d);
168168
} else { // using discrete EU
169-
this.minValue = DEFAULT_MIN_EU;
170-
this.maxValue = DEFAULT_MAX_EU;
169+
this.minValue = (long) Math.floor((this.minValue / 100d) * getCoverHolderCapacity());
170+
this.maxValue = (long) Math.floor((this.maxValue / 100d) * getCoverHolderCapacity());
171171
}
172172
}
173173

0 commit comments

Comments
 (0)