]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java
Update to 1.17.1 (#124)
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / mixin / client / gui / screen / MixinOptionsScreen.java
1 package com.irtimaled.bbor.mixin.client.gui.screen;
2
3 import com.irtimaled.bbor.client.gui.SettingsScreenButton;
4 import net.minecraft.client.gui.screen.Screen;
5 import net.minecraft.client.gui.screen.option.OptionsScreen;
6 import net.minecraft.client.gui.widget.ClickableWidget;
7 import org.spongepowered.asm.mixin.Mixin;
8 import org.spongepowered.asm.mixin.injection.At;
9 import org.spongepowered.asm.mixin.injection.Inject;
10 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
11
12 @Mixin(OptionsScreen.class)
13 public class MixinOptionsScreen extends Screen {
14     private MixinOptionsScreen() {
15         super(null);
16     }
17
18     @Inject(method = "init", at = @At("RETURN"))
19     private void initGui(CallbackInfo ci) {
20         //shuffle middle buttons up by 12 px to make space
21         int top = this.height / 6 + 42;
22         int bottom = this.height / 6 + 168;
23         children().stream()
24                 .filter(element -> element instanceof ClickableWidget)
25                 .map(element -> (ClickableWidget) element)
26                 .forEach(button -> {
27                     if (button.y >= top && button.y < bottom)
28                         button.y -= 12;
29                 });
30         SettingsScreenButton button = new SettingsScreenButton(this.width / 2 - 155, top + 84, 150, "BBOR", this);
31         this.addDrawableChild(button);
32     }
33 }