[英]How can i remove a title screen element with fabric in Minecraft 1.18.1
I am currently able to add elements to the title screen:我目前能够将元素添加到标题屏幕:
public abstract class MCEMixin extends Screen {
protected MCEMixin(Text title) {
super(title);
}
@Inject(at = @At("RETURN"), method = "initWidgetsNormal")
private void addCustomButton(int y, int spacingY, CallbackInfo cI) {
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, y, 200, 20, Text.of("MCEssentials | Singleplayer"), (button) -> {
MinecraftClient.getInstance().setScreen(new SelectWorldScreen(this));
}));
}
}
I want to replace the singleplayer button with mine tho and I can't figure out how.我想用我的按钮替换单人游戏按钮,但我不知道该怎么做。
Maybe you could use ci.cancel()
(requires you to include CallbackInfo
ci in your injected method) and copy/paste the fabric mc source to the function but just change the Singleplayer
button.也许您可以使用
ci.cancel()
(要求您在注入方法中包含CallbackInfo
ci)并将 fabric mc 源复制/粘贴到 function,但只需更改Singleplayer
按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.