22
33import net .fabricmc .loader .api .FabricLoader ;
44import net .minecraft .client .Minecraft ;
5+ import net .minecraft .client .gui .Screen ;
6+ import net .minecraft .client .gui .popup .PopupBuilder ;
7+ import net .minecraft .client .gui .popup .PopupComponent ;
8+ import net .minecraft .client .gui .popup .PopupScreen ;
59import net .minecraft .core .enums .EnumOS ;
10+ import net .minecraft .core .lang .I18n ;
11+ import net .minecraft .core .net .command .TextFormatting ;
12+ import org .jetbrains .annotations .Nullable ;
613import org .spongepowered .asm .mixin .Mixin ;
14+ import org .spongepowered .asm .mixin .Shadow ;
715import org .spongepowered .asm .mixin .injection .At ;
816import org .spongepowered .asm .mixin .injection .Inject ;
917import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
18+ import turniplabs .halplibe .HalpLibe ;
1019import turniplabs .halplibe .helper .network .NetworkHandler ;
1120import turniplabs .halplibe .mixin .accessors .ItemsAccessor ;
1221import turniplabs .halplibe .util .*;
1827
1928public abstract class MinecraftMixin {
2029
30+ @ Shadow
31+ @ Nullable
32+ public Screen currentScreen ;
33+
34+ @ Shadow
35+ public abstract void displayScreen (Screen screen );
36+
2137 @ Inject (method = "startGame" , at = @ At (value = "INVOKE" ,target = "Lnet/minecraft/core/data/DataLoader;loadRecipesFromFile(Ljava/lang/String;)V" , ordinal = 3 , shift = At .Shift .AFTER ))
2238 public void recipeEntrypoint (CallbackInfo ci ){
2339 FabricLoader .getInstance ().getEntrypoints ("recipesReady" , RecipeEntrypoint .class ).forEach (RecipeEntrypoint ::initNamespaces );
@@ -35,6 +51,19 @@ public void afterGameStartEntrypoint(CallbackInfo ci){
3551 NetworkHandler .internalNetworkHandlerSetup ();
3652 FabricLoader .getInstance ().getEntrypoints ("afterGameStart" , GameStartEntrypoint .class ).forEach (GameStartEntrypoint ::afterGameStart );
3753 FabricLoader .getInstance ().getEntrypoints ("afterClientStart" , ClientStartEntrypoint .class ).forEach (ClientStartEntrypoint ::afterClientStart );
54+ if (HalpLibe .CONFIG .getBoolean ("recoveryMode" )) {
55+ PopupScreen popup = new PopupBuilder (this .currentScreen , 246 )
56+ .withLabelLiteral (I18n .getInstance ().translateKey ("halplibe.recoveryMode" ))
57+ .withMessageBox ("message" ,128 ,
58+ I18n .getInstance ().translateKey ("halplibe.recoveryMode.text" )+"\n \n "
59+ + I18n .getInstance ().translateKey ("halplibe.recoveryMode.text2" )+"\n "
60+ + I18n .getInstance ().translateKey ("halplibe.recoveryMode.action1" )+"\n "
61+ + I18n .getInstance ().translateKey ("halplibe.recoveryMode.action2" )+"\n \n "
62+ + I18n .getInstance ().translateKey ("halplibe.recoveryMode.text3" ),44 )
63+ .closeOnClickOut (0 )
64+ .build ();
65+ displayScreen (popup );
66+ }
3867 }
3968
4069 @ Inject (method = "startGame" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/core/block/Blocks;init()V" , shift = At .Shift .AFTER ))
0 commit comments