kerosene/src/main/java/pm/j4/kerosene/mixin/OptionsScreenMixin.java

44 lines
1.2 KiB
Java
Raw Normal View History

2020-12-20 04:19:55 +00:00
package pm.j4.kerosene.mixin;
2020-12-19 23:30:50 +00:00
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.options.OptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2020-12-20 04:19:55 +00:00
import pm.j4.kerosene.gui.POptionsScreen;
2020-12-19 23:30:50 +00:00
/**
* The type Options menu mixin.
*/
@Mixin(OptionsScreen.class)
public class OptionsScreenMixin extends Screen {
2020-12-19 23:30:50 +00:00
/**
* Instantiates a new Options menu mixin.
*
* @param title the title
*/
protected OptionsScreenMixin(Text title) {
2020-12-19 23:30:50 +00:00
super(title);
}
/**
* Init.
*
* @param ci the ci
*/
@Inject(at = @At(value = "TAIL"),
method = "init()V")
protected void init(CallbackInfo ci) {
2020-12-20 04:19:55 +00:00
this.addButton(new ButtonWidget(this.width / 2 - 75, this.height / 6 + 140, 150, 20, new TranslatableText("kerosene.options"), (buttonWidget) -> {
2020-12-23 00:51:20 +00:00
if (this.client != null) {
this.client.openScreen(new POptionsScreen(this));
}
2020-12-19 23:30:50 +00:00
}));
}
}