2020 */
2121package com .falsepattern .lib .internal .proxy ;
2222
23- import com .falsepattern .lib .internal .Share ;
24- import com .falsepattern .lib .internal .Tags ;
2523import com .falsepattern .lib .internal .impl .config .event .ClientEventHandlerPost ;
2624import com .falsepattern .lib .internal .impl .config .event .ClientEventHandlerPre ;
2725import com .falsepattern .lib .internal .impl .toast .GuiToastImpl ;
28- import com .falsepattern .lib .updates .UpdateChecker ;
29- import lombok .val ;
3026
3127import net .minecraft .client .Minecraft ;
32- import net .minecraft .client .entity .EntityPlayerSP ;
33- import net .minecraft .util .IChatComponent ;
3428import net .minecraftforge .common .MinecraftForge ;
35- import net .minecraftforge .event .entity .EntityJoinWorldEvent ;
3629import cpw .mods .fml .common .event .FMLConstructionEvent ;
3730import cpw .mods .fml .common .event .FMLPostInitializationEvent ;
3831import cpw .mods .fml .common .event .FMLPreInitializationEvent ;
39- import cpw .mods .fml .common .eventhandler .SubscribeEvent ;
4032import cpw .mods .fml .relauncher .Side ;
4133import cpw .mods .fml .relauncher .SideOnly ;
4234
4638
4739@ SideOnly (Side .CLIENT )
4840public class ClientProxy extends CommonProxy {
49- private CompletableFuture <List <IChatComponent >> chatFuture ;
50-
5141 @ Override
5242 public void construct (FMLConstructionEvent e ) {
5343 super .construct (e );
@@ -65,27 +55,5 @@ public void preInit(FMLPreInitializationEvent e) {
6555 public void postInit (FMLPostInitializationEvent e ) {
6656 super .postInit (e );
6757 ClientEventHandlerPost .registerBus ();
68- chatFuture = updatesFuture .handleAsync ((updates , exception ) -> {
69- if (exception != null || updates .isEmpty ()) {
70- return Collections .emptyList ();
71- }
72- return UpdateChecker .updateListToChatMessages (Tags .MODNAME , updates );
73- });
74- }
75-
76- @ SubscribeEvent
77- public void onSinglePlayer (EntityJoinWorldEvent e ) {
78- if (chatFuture == null || !(e .entity instanceof EntityPlayerSP )) {
79- return ;
80- }
81- val player = (EntityPlayerSP ) e .entity ;
82- try {
83- for (val line : chatFuture .get ()) {
84- player .addChatMessage (line );
85- }
86- chatFuture = null ;
87- } catch (Exception ex ) {
88- Share .LOG .warn (ex );
89- }
9058 }
9159}
0 commit comments