-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathModMenuIntegration.java
More file actions
51 lines (41 loc) · 1.96 KB
/
ModMenuIntegration.java
File metadata and controls
51 lines (41 loc) · 1.96 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package net.boostedbrightness.ui;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.boostedbrightness.BoostedBrightness;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ModMenuOptionsScreen::new;
}
public class ModMenuOptionsScreen extends GameOptionsScreen {
private BrightnessListWidget list;
public ModMenuOptionsScreen(Screen parent) {
super(parent, MinecraftClient.getInstance().options, Text.translatable("options.boosted-brightness.title"));
}
protected void init() {
this.list = new BrightnessListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
this.addSelectableChild(this.list);
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> this.close())
.size(240, 20).position(this.width / 2 - 120, this.height - 27).build());
}
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
this.list.render(context, mouseX, mouseY, delta);
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2, 5, 0xFFFFFF);
}
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackgroundTexture(context);
}
public void removed() {
BoostedBrightness.saveConfig();
super.removed();
}
}
}