forked from wormzjl/ModularMachinery
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathGuiMEBusPollingButton.java
More file actions
36 lines (27 loc) · 1.34 KB
/
Copy pathGuiMEBusPollingButton.java
File metadata and controls
36 lines (27 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package github.kasuminova.mmce.client.gui;
import appeng.api.config.FullnessMode;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.GuiImgButton;
import github.kasuminova.mmce.common.util.PollingRateUtils;
import hellfirepvp.modularmachinery.common.data.Config;
import net.minecraft.client.resources.I18n;
import java.util.function.IntSupplier;
public class GuiMEBusPollingButton extends GuiImgButton {
private final IntSupplier pollingRateSupplier;
public GuiMEBusPollingButton(final int x, final int y, final IntSupplier pollingRateSupplier) {
super(x, y, Settings.FULLNESS_MODE, FullnessMode.FULL);
this.pollingRateSupplier = pollingRateSupplier;
}
@Override
public String getMessage() {
int pollingRate = Math.max(0, this.pollingRateSupplier.getAsInt());
int maxAdaptive = Config.meHatchAdaptivePollingMin;
int minAdaptive = Config.meHatchAdaptivePollingMax;
String currentValue = pollingRate <= 0
? I18n.format("gui.mehatch.polling_rate.current_adaptive", maxAdaptive, minAdaptive)
: I18n.format("gui.mehatch.polling_rate.current", PollingRateUtils.format(pollingRate));
return I18n.format("gui.mehatch.polling_rate.name") + "\n\n"
+ currentValue + "\n"
+ I18n.format("gui.mehatch.polling_rate.tooltip");
}
}