forked from Clones/Controlify
🧹 Remove unused beta notice screen
This commit is contained in:
@ -1,59 +0,0 @@
|
|||||||
package dev.isxander.controlify.gui.screen;
|
|
||||||
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
|
||||||
import net.minecraft.client.gui.components.AccessibilityOnboardingTextWidget;
|
|
||||||
import net.minecraft.client.gui.components.Button;
|
|
||||||
import net.minecraft.client.gui.components.MultiLineTextWidget;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
|
||||||
import net.minecraft.client.gui.screens.TitleScreen;
|
|
||||||
import net.minecraft.network.chat.CommonComponents;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
|
|
||||||
public class BetaNoticeScreen extends Screen {
|
|
||||||
|
|
||||||
public BetaNoticeScreen() {
|
|
||||||
super(Component.translatable("controlify.beta.title"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
MultiLineTextWidget textWidget = new AccessibilityOnboardingTextWidget(
|
|
||||||
font,
|
|
||||||
Component.translatable("controlify.beta.message",
|
|
||||||
Component.translatable("controlify.beta.message.link")
|
|
||||||
.withStyle(ChatFormatting.AQUA)
|
|
||||||
),
|
|
||||||
this.width - 10
|
|
||||||
);
|
|
||||||
textWidget.setX(this.width / 2 - textWidget.getWidth() / 2);
|
|
||||||
textWidget.setY(30);
|
|
||||||
addRenderableWidget(textWidget);
|
|
||||||
|
|
||||||
addRenderableWidget(
|
|
||||||
Button.builder(
|
|
||||||
Component.translatable("controlify.beta.button"),
|
|
||||||
btn -> Util.getPlatform().openUri("https://github.com/isXander/controlify/issues")
|
|
||||||
)
|
|
||||||
.pos(this.width / 2 - 75, this.height - 8 - 20 - 20 - 4)
|
|
||||||
.width(150)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
addRenderableWidget(
|
|
||||||
Button.builder(
|
|
||||||
CommonComponents.GUI_CONTINUE,
|
|
||||||
btn -> minecraft.setScreen(new TitleScreen())
|
|
||||||
)
|
|
||||||
.pos(this.width / 2 - 75, this.height - 8 - 20)
|
|
||||||
.width(150)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
|
|
||||||
renderBackground(graphics);
|
|
||||||
super.render(graphics, mouseX, mouseY, delta);
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,12 +4,9 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
|||||||
import dev.isxander.controlify.Controlify;
|
import dev.isxander.controlify.Controlify;
|
||||||
import dev.isxander.controlify.ControllerManager;
|
import dev.isxander.controlify.ControllerManager;
|
||||||
import dev.isxander.controlify.controller.Controller;
|
import dev.isxander.controlify.controller.Controller;
|
||||||
import dev.isxander.controlify.gui.screen.BetaNoticeScreen;
|
|
||||||
import dev.isxander.controlify.utils.Animator;
|
import dev.isxander.controlify.utils.Animator;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.toasts.ToastComponent;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.main.GameConfig;
|
|
||||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -23,7 +20,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public abstract class MinecraftMixin {
|
public abstract class MinecraftMixin {
|
||||||
@Shadow public abstract void setScreen(@Nullable Screen screen);
|
@Shadow public abstract void setScreen(@Nullable Screen screen);
|
||||||
@Shadow public abstract float getDeltaFrameTime();
|
@Shadow public abstract float getDeltaFrameTime();
|
||||||
@Shadow public abstract ToastComponent getToasts();
|
|
||||||
|
|
||||||
@Unique private boolean initNextTick = false;
|
@Unique private boolean initNextTick = false;
|
||||||
|
|
||||||
@ -48,12 +44,6 @@ public abstract class MinecraftMixin {
|
|||||||
Controlify.instance().inGameInputHandler().ifPresent(ih -> ih.processPlayerLook(getDeltaFrameTime()));
|
Controlify.instance().inGameInputHandler().ifPresent(ih -> ih.processPlayerLook(getDeltaFrameTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
|
||||||
private void showBetaScreen(GameConfig args, CallbackInfo ci) {
|
|
||||||
if (Controlify.instance().config().isFirstLaunch())
|
|
||||||
setScreen(new BetaNoticeScreen());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "close", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/telemetry/ClientTelemetryManager;close()V"))
|
@Inject(method = "close", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/telemetry/ClientTelemetryManager;close()V"))
|
||||||
private void onMinecraftClose(CallbackInfo ci) {
|
private void onMinecraftClose(CallbackInfo ci) {
|
||||||
ControllerManager.getConnectedControllers().forEach(Controller::close);
|
ControllerManager.getConnectedControllers().forEach(Controller::close);
|
||||||
|
Reference in New Issue
Block a user