add example mixin
This commit is contained in:
parent
df66596b5e
commit
798fc26fe4
|
@ -0,0 +1,25 @@
|
|||
package org.ecorous.esnesnon.nonsense.loader.example.mixin;
|
||||
|
||||
import net.minecraft.client.gui.components.FocusableTextWidget;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public abstract class TitleScreenMixin extends Screen {
|
||||
|
||||
protected TitleScreenMixin(Component title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "createNormalMenuOptions", at = @At("TAIL"), remap = false)
|
||||
private void showExample(int y, int rowHeight, CallbackInfo ci) {
|
||||
var widget = new FocusableTextWidget(200, Component.literal("<insert frog here!>"), this.font);
|
||||
widget.setPosition(width / 2 - widget.getWidth(), 20);
|
||||
addRenderableOnly(widget);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@
|
|||
"package": "org.ecorous.esnesnon.nonsense.loader.example.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [],
|
||||
"client": [],
|
||||
"client": [
|
||||
"TitleScreenMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue