Белая менюха майна

Версия Minecraft
1.7.10
199
1
17
Ребят, вот я сделал свое меню и когда у меня полностью загружается майн вместо переделанного меню просто белый экран и все. Вот код
Код:
package ExCraft2.menu;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.lang.reflect.Field;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiButtonLanguage;
import net.minecraft.client.gui.GuiConfirmOpenLink;
import net.minecraft.client.gui.GuiLanguage;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiOptions;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.Project;

@Mod(
   modid = "ExCraftMenu",
   version = "0.1"
)
public class Menu extends GuiScreen implements GuiYesNoCallback {

   private static Field f;
   private static final Logger logger = LogManager.getLogger();
   private static final Random rand = new Random();
   private float updateCounter;
   private String splashText;
   private int panoramaTimer;
   private DynamicTexture viewportTexture;
   private final Object field_104025_t = new Object();
   private String field_92025_p;
   private String field_146972_A;
   private String field_104024_v;
   private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png");
   private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[]{new ResourceLocation("textures/gui/title/background/panorama_0.png"), new ResourceLocation("textures/gui/title/background/panorama_1.png"), new ResourceLocation("textures/gui/title/background/panorama_2.png"), new ResourceLocation("textures/gui/title/background/panorama_3.png"), new ResourceLocation("textures/gui/title/background/panorama_4.png"), new ResourceLocation("textures/gui/title/background/panorama_5.png")};
   public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information.";
   private int field_92024_r;
   private int field_92023_s;
   private int field_92022_t;
   private int field_92021_u;
   private int field_92020_v;
   private int field_92019_w;
   private ResourceLocation field_110351_G;
   private static final String __OBFID = "CL_00001154";


   @EventHandler
   public void load(FMLInitializationEvent ev) {
      try {
         f = GuiScreen.class.getDeclaredField("buttonList");
      } catch (NoSuchFieldException var7) {
         try {
            f = GuiScreen.class.getDeclaredField("field_146292_n");
         } catch (NoSuchFieldException var6) {
            try {
               f = GuiScreen.class.getDeclaredField("n");
            } catch (NoSuchFieldException var5) {
               ;
            }
         }
      }

      if(f != null) {
         MinecraftForge.EVENT_BUS.register(this);
         f.setAccessible(true);
      }

   }

   @SubscribeEvent
   @EventHandler
   public void qwe(GuiOpenEvent ev) {
      if(ev.gui instanceof GuiMainMenu) {
         ev.gui = this;
      }

   }

   public Menu() {
      this.field_146972_A = field_96138_a;
      this.splashText = "";
      this.updateCounter = rand.nextFloat();
      this.field_92025_p = "";
      if(!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.func_153193_b()) {
         this.field_92025_p = I18n.format("title.oldgl1", new Object[0]);
         this.field_146972_A = I18n.format("title.oldgl2", new Object[0]);
         this.field_104024_v = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
      }

   }

   public void func_73876_c() {
      ++this.panoramaTimer;
   }

   public boolean func_73868_f() {
      return false;
   }

   protected void func_73869_a(char p_73869_1_, int p_73869_2_) {}

   public void func_73866_w_() {
      this.viewportTexture = new DynamicTexture(256, 256);
      this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(new Date());
      int i = this.height / 4 + 48;
      this.addSingleplayerMultiplayerButtons(i, 24);
      this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 - 12, 200, 20, I18n.format("menu.options", new Object[0])));
      this.buttonList.add(new GuiButton(4, this.width / 2 - 100, i + 72 + 12, 200, 20, I18n.format("menu.quit", new Object[0])));
      this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, i + 72 + 12));
      Object var3 = this.field_104025_t;
      synchronized(this.field_104025_t) {
         this.field_92023_s = this.fontRendererObj.getStringWidth(this.field_92025_p);
         this.field_92024_r = this.fontRendererObj.getStringWidth(this.field_146972_A);
         int j = Math.max(this.field_92023_s, this.field_92024_r);
         this.field_92022_t = (this.width - j) / 2;
         this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
         this.field_92020_v = this.field_92022_t + j;
         this.field_92019_w = this.field_92021_u + 24;
      }
   }

   private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) {
      this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_, I18n.format("menu.multiplayer", new Object[0])));
   }

   protected void actionPerformed(GuiButton p_146284_1_) {
      if(p_146284_1_.id == 0) {
         this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
      }

      if(p_146284_1_.id == 5) {
         this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
      }

      if(p_146284_1_.id == 2) {
         this.mc.displayGuiScreen(new GuiMultiplayer(this));
      }

      if(p_146284_1_.id == 4) {
         this.mc.shutdown();
      }

   }

   public void func_73878_a(boolean p_73878_1_, int p_73878_2_) {}

   private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_) {
      Tessellator tessellator = Tessellator.instance;
      GL11.glMatrixMode(5889);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
      GL11.glMatrixMode(5888);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(3042);
      GL11.glDisable(3008);
      GL11.glDisable(2884);
      GL11.glDepthMask(false);
      OpenGlHelper.glBlendFunc(770, 771, 1, 0);
      byte b0 = 8;

      for(int k = 0; k < b0 * b0; ++k) {
         GL11.glPushMatrix();
         float f1 = ((float)(k % b0) / (float)b0 - 0.5F) / 64.0F;
         float f2 = ((float)(k / b0) / (float)b0 - 0.5F) / 64.0F;
         float f3 = 0.0F;
         GL11.glTranslatef(f1, f2, f3);
         GL11.glRotatef(MathHelper.sin(((float)this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
         GL11.glRotatef(-((float)this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F);

         for(int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();
            if(l == 1) {
               GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if(l == 2) {
               GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if(l == 3) {
               GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if(l == 4) {
               GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if(l == 5) {
               GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double)(0.0F + f4), (double)(0.0F + f4));
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double)(1.0F - f4), (double)(0.0F + f4));
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double)(1.0F - f4), (double)(1.0F - f4));
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double)(0.0F + f4), (double)(1.0F - f4));
            tessellator.draw();
            GL11.glPopMatrix();
         }

         GL11.glPopMatrix();
         GL11.glColorMask(true, true, true, false);
      }

      tessellator.setTranslation(0.0D, 0.0D, 0.0D);
      GL11.glColorMask(true, true, true, true);
      GL11.glMatrixMode(5889);
      GL11.glPopMatrix();
      GL11.glMatrixMode(5888);
      GL11.glPopMatrix();
      GL11.glDepthMask(true);
      GL11.glEnable(2884);
      GL11.glEnable(2929);
   }

   private void rotateAndBlurSkybox(float p_73968_1_) {
      this.mc.getTextureManager().bindTexture(this.field_110351_G);
      GL11.glTexParameteri(3553, 10241, 9729);
      GL11.glTexParameteri(3553, 10240, 9729);
      GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, 256, 256);
      GL11.glEnable(3042);
      OpenGlHelper.glBlendFunc(770, 771, 1, 0);
      GL11.glColorMask(true, true, true, false);
      Tessellator tessellator = Tessellator.instance;
      tessellator.startDrawingQuads();
      GL11.glDisable(3008);
      byte b0 = 3;

      for(int i = 0; i < b0; ++i) {
         tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1));
         int j = this.width;
         int k = this.height;
         float f1 = (float)(i - b0 / 2) / 256.0F;
         tessellator.addVertexWithUV((double)j, (double)k, (double)this.zLevel, (double)(0.0F + f1), 1.0D);
         tessellator.addVertexWithUV((double)j, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 1.0D);
         tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 0.0D);
         tessellator.addVertexWithUV(0.0D, (double)k, (double)this.zLevel, (double)(0.0F + f1), 0.0D);
      }

      tessellator.draw();
      GL11.glEnable(3008);
      GL11.glColorMask(true, true, true, true);
   }

   private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_) {
      this.mc.getFramebuffer().unbindFramebuffer();
      GL11.glViewport(0, 0, 256, 256);
      this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.rotateAndBlurSkybox(p_73971_3_);
      this.mc.getFramebuffer().bindFramebuffer(true);
      GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
      Tessellator tessellator = Tessellator.instance;
      tessellator.startDrawingQuads();
      float f1 = this.width > this.height?120.0F / (float)this.width:120.0F / (float)this.height;
      float f2 = (float)this.height * f1 / 256.0F;
      float f3 = (float)this.width * f1 / 256.0F;
      tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
      int k = this.width;
      int l = this.height;
      tessellator.addVertexWithUV(0.0D, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F + f3));
      tessellator.addVertexWithUV((double)k, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F - f3));
      tessellator.addVertexWithUV((double)k, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F - f3));
      tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F + f3));
      tessellator.draw();
   }

   public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
      GL11.glDisable(3008);
      this.renderSkybox(p_73863_1_, p_73863_2_, p_73863_3_);
      GL11.glEnable(3008);
      Tessellator tessellator = Tessellator.instance;
      short short1 = 274;
      int k = this.width / 2 - short1 / 2;
      byte b0 = 30;
      this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
      this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
      this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      if((double)this.updateCounter < 1.0E-4D) {
         this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
         this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
         this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
         this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44);
         this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
      } else {
         this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44);
         this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
      }

      tessellator.setColorOpaque_I(-1);
      GL11.glPushMatrix();
      GL11.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
      GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
      float f1 = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * 3.1415927F * 2.0F) * 0.1F);
      f1 = f1 * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
      GL11.glScalef(f1, f1, f1);
      this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
      GL11.glPopMatrix();
      String var13 = "Copyright Mojang AB. Do not distribute!";
      this.drawString(this.fontRendererObj, var13, this.width - this.fontRendererObj.getStringWidth(var13) - 2, this.height - 10, -1);
      super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
   }

   protected void func_73864_a(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
      super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
      Object object = this.field_104025_t;
      Object var5 = this.field_104025_t;
      Object var6 = this.field_104025_t;
      synchronized(this.field_104025_t) {
         if(this.field_92025_p.length() > 0 && p_73864_1_ >= this.field_92022_t && p_73864_1_ <= this.field_92020_v && p_73864_2_ >= this.field_92021_u && p_73864_2_ <= this.field_92019_w) {
            GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.field_104024_v, 13, true);
            guiconfirmopenlink.func_146358_g();
            this.mc.displayGuiScreen(guiconfirmopenlink);
         }

      }
   }

}
 
3,005
192
592
Может попробовать сделать другой класс с гуи и вызывать его?
(Или ev.gui = this; на ev.gui = new Menu(); заменить.)
 
3,005
192
592
Значит ты где-то накосячил с классами..
Разбей на нормальные классы, а не все в 1-ом.
 
199
1
17
WhiteWarrior написал(а):
Где-то с gl накосячил..
Советую переписать код, разбей свой мод по классам: меню в одном, все остальное - в другом...

Ну вот такая история: Мне кинули мод который изменяет меню майна и я сдекомпилировал его и он работает не так.
 
3,005
192
592
Может потому что ты его декомпилировал?
А изменить фиелды и функи забыл?
Ой да, точнее не изменял их вообще?
 
1,057
50
234
Что там изменено в этом меню?
 
199
1
17
Doc написал(а):
Может потому что ты его декомпилировал?
А изменить фиелды и функи забыл?
Ой да, точнее не изменял их вообще?

Где в еклипсе были ошибки я их исправил брав пример из ванильной менюхи майна...
 
3,005
192
592
Методы не пишутся ошибками, но они и не используются.
Плюс ты не правильно используешь эвент.
 
Сверху