Advertisement
Guest User

GuiEvents

a guest
Oct 12th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. public class GuiEvents {
  2.  
  3.     @SubscribeEvent
  4.     public void overdrawGui(GuiScreenEvent.InitGuiEvent e){
  5.         GuiScreen screen=null;
  6.         if(e.getGui() instanceof GuiWorldSelection)
  7.             Minecraft.getMinecraft().displayGuiScreen(new net.rexozz.pixelengine.client.gui.GuiWorldSelection(screen));
  8.         else
  9.             screen=e.getGui();
  10.     }
  11.    
  12.     public static void tryLoadExistingWorld(net.rexozz.pixelengine.client.gui.GuiWorldSelection selectWorldGUI, WorldSummary comparator)
  13.     {
  14.         File dir = new File(new File(Minecraft.getMinecraft().mcDataDir, "saves"), comparator.getFileName());
  15.         NBTTagCompound leveldat;
  16.         try
  17.         {
  18.             leveldat = CompressedStreamTools.readCompressed(new FileInputStream(new File(dir, "level.dat")));
  19.         }
  20.         catch (Exception e)
  21.         {
  22.             try
  23.             {
  24.                 leveldat = CompressedStreamTools.readCompressed(new FileInputStream(new File(dir, "level.dat_old")));
  25.             }
  26.             catch (Exception e1)
  27.             {
  28.                 FMLLog.warning("There appears to be a problem loading the save %s, both level files are unreadable.", comparator.getFileName());
  29.                 return;
  30.             }
  31.         }
  32.         NBTTagCompound fmlData = leveldat.getCompoundTag("FML");
  33.         if (fmlData.hasKey("ModItemData"))
  34.         {
  35.             GuiScreen gui = (GuiScreen) new GuiOldSaveLoadConfirm(comparator.getFileName(), comparator.getDisplayName(), selectWorldGUI);
  36.             Minecraft.getMinecraft().displayGuiScreen(gui);
  37.         }
  38.         else
  39.         {
  40.             try
  41.             {
  42.                 Minecraft.getMinecraft().launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null);
  43.             }
  44.             catch (StartupQuery.AbortedException e)
  45.             {
  46.                 // ignore
  47.             }
  48.         }
  49.     }
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement