28
28
import net .minecraft .world .gen .FlatGenerationSettings ;
29
29
import net .minecraft .world .storage .WorldInfo ;
30
30
import net .minecraftforge .api .distmarker .Dist ;
31
- import net .minecraftforge .client .event .DrawHighlightEvent . HighlightBlock ;
32
- import net .minecraftforge .client .event .GuiScreenEvent . InitGuiEvent ;
31
+ import net .minecraftforge .client .event .DrawHighlightEvent ;
32
+ import net .minecraftforge .client .event .GuiScreenEvent ;
33
33
import net .minecraftforge .eventbus .api .SubscribeEvent ;
34
34
import net .minecraftforge .fml .ModContainer ;
35
35
import net .minecraftforge .fml .ModList ;
@@ -47,36 +47,36 @@ public class EventHandler {
47
47
private final static Minecraft MINECRAFT = Minecraft .getInstance ();
48
48
private final static Field WORLD_SEED = ObfuscationReflectionHelper .findField (CreateWorldScreen .class ,
49
49
"field_146329_I" ); // worldSeed
50
- private final static WorldSettings WORLD_SETTINGS = new WorldSettings (0 , GameType .CREATIVE , false , false ,
51
- WorldType .FLAT )
52
- .enableCommands ()
53
- .setGeneratorOptions (FlatGenerationSettings
54
- .createFlatGeneratorFromString (
55
- "minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;minecraft:desert" )
56
- .func_210834_a (JsonOps .INSTANCE ).getValue ());
50
+ private final static WorldSettings SETTINGS = new WorldSettings (0 , GameType .CREATIVE , false , false , WorldType .FLAT )
51
+ .enableCommands ()
52
+ .setGeneratorOptions (FlatGenerationSettings
53
+ .createFlatGeneratorFromString (
54
+ "minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;minecraft:desert" )
55
+ .func_210834_a (JsonOps .INSTANCE ).getValue ());
57
56
58
- private static void alert (String line1 , String line2 , String line3 , String button , Consumer <OS > consumer ) {
57
+ private static void alert (String msg1 , String msg2 , String msg3 , String button , Consumer <OS > consumer ) {
59
58
MINECRAFT
60
59
.displayGuiScreen (new AlertScreen (() -> consumer .accept (Util .getOSType ()),
61
- new StringTextComponent (line1 ).setStyle (new Style ().setColor (TextFormatting .RED )),
62
- new StringTextComponent (line2 + "\n \n " ).appendSibling (
63
- new StringTextComponent (line3 ).setStyle (new Style ().setColor (TextFormatting .AQUA ))),
60
+ new StringTextComponent (msg1 ).setStyle (new Style ().setColor (TextFormatting .RED )),
61
+ new StringTextComponent (msg2 + "\n \n " ).appendSibling (
62
+ new StringTextComponent (msg3 ).setStyle (new Style ().setColor (TextFormatting .AQUA ))),
64
63
button ));
65
64
}
66
65
67
66
@ SubscribeEvent
68
- public static void onHighlightBlock ( HighlightBlock event ) {
69
- TileEntity te = MINECRAFT .world .getTileEntity (event .getTarget ().getPos ());
67
+ public static void onDrawHighlightBlock ( DrawHighlightEvent . HighlightBlock event ) {
68
+ TileEntity entity = MINECRAFT .world .getTileEntity (event .getTarget ().getPos ());
70
69
MINECRAFT .ingameGUI .setOverlayMessage (
71
- te != null && te .getType () == Circuitry .NODE .get () ? ((NodeTileEntity ) te ).getTag () : "" , false );
70
+ entity != null && entity .getType () == Circuitry .NODE .get () ? ((NodeTileEntity ) entity ).getTag () : "" ,
71
+ false );
72
72
}
73
73
74
74
@ SubscribeEvent
75
- public static void onPostInitGui ( InitGuiEvent .Post event ) throws IllegalAccessException {
75
+ public static void onGuiScreenInitPost ( GuiScreenEvent . InitGuiEvent .Post event ) throws IllegalAccessException {
76
76
Screen screen = event .getGui ();
77
77
if (screen instanceof CreateWorldScreen && WORLD_SEED .get (screen ).equals ("" ))
78
78
((CreateWorldScreen ) screen )
79
- .recreateFromExistingWorld (new WorldInfo (WORLD_SETTINGS , I18n .format ("selectWorld.newWorld" )));
79
+ .recreateFromExistingWorld (new WorldInfo (SETTINGS , I18n .format ("selectWorld.newWorld" )));
80
80
else if (event .getGui () instanceof MainMenuScreen ) {
81
81
ModList list = ModList .get ();
82
82
@@ -88,11 +88,11 @@ else if (event.getGui() instanceof MainMenuScreen) {
88
88
Arrays .toString (mods ), "fml.button.open.mods.folder" ,
89
89
os -> os .openFile (FMLPaths .MODSDIR .get ().toFile ()));
90
90
91
- IModInfo info = list .getModContainerById (Circuitry .MODID ).get ().getModInfo ();
92
- if (!info .getVersion ().getQualifier ().equals ("NONE" )) {
93
- CheckResult result = VersionChecker .getResult (info );
91
+ IModInfo mod = list .getModContainerById (Circuitry .MODID ).get ().getModInfo ();
92
+ if (!mod .getVersion ().getQualifier ().equals ("NONE" )) {
93
+ CheckResult result = VersionChecker .getResult (mod );
94
94
if (result .status == Status .OUTDATED )
95
- alert (info .getDisplayName () + " is out of date." ,
95
+ alert (mod .getDisplayName () + " is out of date." ,
96
96
"You must update to version " + result .target
97
97
+ " before proceeding.\n Open Link will bring you to the below page:" ,
98
98
result .url , "Open Link" , os -> os .openURI (result .url ));
0 commit comments