Non résolu Problème de compilation
-
J’en fait un mod qui change le menu principal et le menu multijoueur
Apres avoir compile le mod tous que j’ai modifier de change pas
Qund je lance le jeux dans éclipse tous marche (photo 1 et 2 )
Mais quand je lance sur le minecraft normale (photo 3 et 4)
Et voici les codes:
Le menu
/* */ package MiniMenu; /* */ /* */ import cpw.mods.fml.client.GuiModList; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; 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.GuiMultiplayer; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSelectWorld; import net.minecraft.client.gui.GuiYesNo; 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.minecraft.world.demo.DemoWorldServer; import net.minecraft.world.storage.ISaveFormat; import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.client.ForgeHooksClient; import org.apache.commons.io.Charsets; 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; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.io.CharStreams; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.GuiModList; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; /* */ import cpw.mods.fml.relauncher.Side; /* */ import cpw.mods.fml.relauncher.SideOnly; /* */ import java.io.BufferedReader; /* */ import java.io.IOException; /* */ import java.io.InputStreamReader; /* */ import java.lang.reflect.Method; /* */ import java.net.URI; import java.net.URL; /* */ import java.util.ArrayList; /* */ import java.util.Calendar; /* */ import java.util.Date; /* */ import java.util.List; /* */ import java.util.Random; /* */ import net.minecraft.client.Minecraft; /* */ import net.minecraft.client.renderer.OpenGlHelper; /* */ import net.minecraft.client.renderer.Tessellator; /* */ import net.minecraft.client.renderer.texture.DynamicTexture; /* */ import net.minecraft.client.renderer.texture.TextureManager; /* */ import net.minecraft.client.resources.I18n; /* */ import net.minecraft.client.resources.IResource; /* */ import net.minecraft.client.resources.IResourceManager; /* */ import net.minecraft.realms.RealmsBridge; /* */ import net.minecraft.util.EnumChatFormatting; /* */ import net.minecraft.util.MathHelper; /* */ import net.minecraft.util.ResourceLocation; /* */ import net.minecraft.world.demo.DemoWorldServer; /* */ import net.minecraft.world.storage.ISaveFormat; /* */ import net.minecraft.world.storage.WorldInfo; /* */ import net.minecraftforge.client.ForgeHooksClient; /* */ import org.apache.commons.io.Charsets; /* */ import org.apache.logging.log4j.LogManager; /* */ import org.apache.logging.log4j.Logger; /* */ import org.lwjgl.Sys; /* */ import org.lwjgl.opengl.ContextCapabilities; /* */ import org.lwjgl.opengl.GL11; /* */ import org.lwjgl.opengl.GLContext; /* */ /* */ @SideOnly(Side.CLIENT) /* */ public class Menu extends GuiScreen implements GuiYesNoCallback /* */ { /* 43 */ private static final Logger logger = LogManager.getLogger(); /* */ /* 45 */ private static final Random rand = new Random(); /* */ /* */ private float updateCounter; /* */ private int scrollingTextPosX; /* */ private String splashText; /* */ private String scrollingText; /* */ private GuiButton buttonResetDemo; /* */ /* */ private int panoramaTimer; /* */ private DynamicTexture viewportTexture; /* 55 */ private final Object field_104025_t = new Object(); /* */ private String field_92025_p; /* */ private String field_146972_A; /* */ private String field_104024_v; /* 59 */ private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes"); /* 60 */ private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png"); /* */ /* 62 */ private final ResourceLocation backGround = new ResourceLocation("textures/gui/title/background/panorama_1.png"); /* */ /* 64 */ 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 GuiButton siteButton; private Object fontRenderer; /* */ private static final String __OBFID = "CL_00001154"; /* */ /* */ public Menu() /* */ { /* 77 */ this.field_146972_A = field_96138_a; /* 78 */ this.splashText = ""; /* 79 */ BufferedReader bufferedreader = null; /* */ /* */ try /* */ { /* 83 */ ArrayList arraylist = new ArrayList(); /* 84 */ bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8)); /* */ /* */ String s; /* 87 */ while ((s = bufferedreader.readLine()) != null) /* */ { /* 89 */ s = s.trim(); /* */ /* 91 */ if (!s.isEmpty()) /* */ { /* 93 */ arraylist.add(s); /* */ } /* */ } /* */ /* 97 */ if (!arraylist.isEmpty()) /* */ { /* */ do /* */ { /* 101 */ this.splashText = ((String)arraylist.get(rand.nextInt(arraylist.size()))); /* */ } /* 103 */ while (this.splashText.hashCode() == 125780783); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 112 */ if (bufferedreader != null) /* */ { /* */ try /* */ { /* 116 */ bufferedreader.close(); /* */ } /* */ catch (IOException localIOException) {} /* */ } /* */ /* */ /* */ /* */ /* */ /* 125 */ this.updateCounter = rand.nextFloat(); /* */ } /* */ catch (IOException localIOException1) {}finally /* */ { /* 112 */ if (bufferedreader != null) /* */ { /* */ try /* */ { /* 116 */ bufferedreader.close(); /* */ } /* */ catch (IOException localIOException3) {} /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* 126 */ this.field_92025_p = ""; /* */ /* 128 */ if ((!GLContext.getCapabilities().OpenGL20) && (!OpenGlHelper.func_153193_b())) /* */ { /* 130 */ this.field_92025_p = I18n.format("title.oldgl1", new Object[0]); /* 131 */ this.field_146972_A = I18n.format("title.oldgl2", new Object[0]); /* 132 */ this.field_104024_v = "https://help.mojang.com/customer/portal/articles/325948?ref=game"; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public void updateScreen() /* */ { /* 141 */ this.panoramaTimer += 1; /* */ } /* */ /* */ /* */ /* */ /* */ public boolean doesGuiPauseGame() /* */ { /* 149 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ protected void keyTyped(char p_73869_1_, int p_73869_2_) {} /* */ /* */ /* */ /* */ /* */ public void initGui() /* */ { /* 162 */ this.viewportTexture = new DynamicTexture(256, 256); /* 163 */ this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); /* 164 */ Calendar calendar = Calendar.getInstance(); /* 165 */ calendar.setTime(new Date()); /* */ /* 167 */ if ((calendar.get(2) + 1 == 11) && (calendar.get(5) == 9)) /* */ { /* 169 */ this.splashText = ""; /* */ } /* 171 */ else if ((calendar.get(2) + 1 == 6) && (calendar.get(5) == 1)) /* */ { /* 173 */ this.splashText = ""; /* */ } /* 175 */ else if ((calendar.get(2) + 1 == 12) && (calendar.get(5) == 24)) /* */ { /* 177 */ this.splashText = ""; /* */ } /* 179 */ else if ((calendar.get(2) + 1 == 1) && (calendar.get(5) == 1)) /* */ { /* 181 */ this.splashText = ""; /* */ } /* 183 */ else if ((calendar.get(2) + 1 == 10) && (calendar.get(5) == 31)) /* */ { /* 185 */ this.splashText = ""; /* */ } /* */ /* 188 */ boolean flag = true; /* 189 */ int i = this.height / 4 + 48; /* */ /* 191 */ if (this.mc.isDemo()) /* */ { /* 193 */ addDemoButtons(i, 24); /* */ } /* */ else /* */ { /* 197 */ addSingleplayerMultiplayerButtons(i, 24); /* */ } /* */ /* 200 */ this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 + 12, 98, 20, I18n.format("Настройки", new Object[0]))); /* 201 */ this.buttonList.add(new GuiButton(4, this.width / 2 + 2, i + 72 + 12, 98, 20, I18n.format("Выйти", new Object[0]))); /* */ /* 203 */ Object object = this.field_104025_t; /* */ /* 205 */ synchronized (this.field_104025_t) /* */ { /* 207 */ this.field_92023_s = this.fontRendererObj.getStringWidth(this.field_92025_p); /* 208 */ this.field_92024_r = this.fontRendererObj.getStringWidth(this.field_146972_A); /* 209 */ int j = Math.max(this.field_92023_s, this.field_92024_r); /* 210 */ this.field_92022_t = ((this.width - j) / 2); /* 211 */ this.field_92021_u = (((GuiButton)this.buttonList.get(0)).field_146129_i - 24); /* 212 */ this.field_92020_v = (this.field_92022_t + j); /* 213 */ this.field_92019_w = (this.field_92021_u + 24); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) /* */ { /* 222 */ this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("Одиночная Игра", new Object[0]))); /* 223 */ this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("Мультиплеер", new Object[0]))); /* */ /* 225 */ // GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, "Моды"); /* */ /* 227 */ this.siteButton = new GuiButton(101, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, "Наш Сайт"); /* 228 */ this.buttonList.add(this.siteButton); /* 229 */ this.siteButton.field_146120_f = 200; /* */ /* 231 */ //fmlModButton.field_146128_h = (this.width / 2 + 2); /* */ /* 233 */ // fmlModButton.field_146120_f = 98; /* */ /* 235 */ // this.buttonList.add(fmlModButton); /* */ } /* */ /* */ /* */ /* */ /* */ private void addDemoButtons(int p_73972_1_, int p_73972_2_) /* */ { /* 243 */ this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0]))); /* 244 */ this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0]))); /* 245 */ ISaveFormat isaveformat = this.mc.getSaveLoader(); /* 246 */ WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World"); /* */ /* 248 */ if (worldinfo == null) /* */ { /* 250 */ this.buttonResetDemo.enabled = false; /* */ } /* */ } /* */ /* */ protected void actionPerformed(GuiButton p_146284_1_) /* */ { /* 256 */ if (p_146284_1_.id == 0) /* */ { /* 258 */ this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); /* */ } /* */ /* 261 */ if (p_146284_1_.id == 5) /* */ { /* 263 */ this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager())); /* */ } /* */ /* 266 */ if (p_146284_1_.id == 1) /* */ { /* 268 */ this.mc.displayGuiScreen(new GuiSelectWorld(this)); /* */ } /* */ /* 271 */ if (p_146284_1_.id == 2) /* */ { /* 273 */ this.mc.displayGuiScreen(new GuiMultiplayer(this)); /* */ } /* */ /* 276 */ if (p_146284_1_.id == 14) /* */ { /* 278 */ func_140005_i(); /* */ } /* */ /* 281 */ if (p_146284_1_.id == 4) /* */ { /* 283 */ this.mc.shutdown(); /* */ } /* */ /* 286 */ if (p_146284_1_.id == 101) /* */ { /* 288 */ Sys.openURL("http://mcminilife.ru/"); /* */ } /* */ /* 291 */ if (p_146284_1_.id == 6) /* */ { /* 293 */ this.mc.displayGuiScreen(new GuiModList(this)); /* */ } /* */ /* 296 */ if (p_146284_1_.id == 11) /* */ { /* 298 */ this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); /* */ } /* */ /* 301 */ if (p_146284_1_.id == 12) /* */ { /* 303 */ ISaveFormat isaveformat = this.mc.getSaveLoader(); /* 304 */ WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World"); /* */ /* 306 */ if (worldinfo != null) /* */ { /* 308 */ GuiYesNo guiyesno = GuiSelectWorld.func_152129_a(this, worldinfo.getWorldName(), 12); /* 309 */ this.mc.displayGuiScreen(guiyesno); /* */ } /* */ } /* */ } /* */ /* */ private void func_140005_i() /* */ { /* 316 */ RealmsBridge realmsbridge = new RealmsBridge(); /* 317 */ realmsbridge.switchToRealms(this); /* */ } /* */ /* */ public void confirmClicked(boolean p_73878_1_, int p_73878_2_) /* */ { /* 322 */ if ((p_73878_1_) && (p_73878_2_ == 12)) /* */ { /* 324 */ ISaveFormat isaveformat = this.mc.getSaveLoader(); /* 325 */ isaveformat.flushCache(); /* 326 */ isaveformat.deleteWorldDirectory("Demo_World"); /* 327 */ this.mc.displayGuiScreen(this); /* */ } /* 329 */ else if (p_73878_2_ == 13) /* */ { /* 331 */ if (p_73878_1_) /* */ { /* */ try /* */ { /* 335 */ Class oclass = Class.forName("java.awt.Desktop"); /* 336 */ Object object = oclass.getMethod("getDesktop", new Class[0]).invoke(null, new Object[0]); /* 337 */ oclass.getMethod("browse", new Class[] { URI.class }).invoke(object, new Object[] { new URI(this.field_104024_v) }); /* */ } /* */ catch (Throwable throwable) /* */ { /* 341 */ logger.error("Couldn't open link", throwable); /* */ } /* */ } /* */ /* 345 */ this.mc.displayGuiScreen(this); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ private void renderBackGround() /* */ { /* 354 */ GL11.glViewport(0, 0, 256, 256); /* 355 */ this.mc.getTextureManager().bindTexture(this.backGround); /* 356 */ GL11.glDisable(3553); /* 357 */ GL11.glEnable(3553); /* 358 */ GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); /* 359 */ Tessellator tessellator = Tessellator.instance; /* 360 */ tessellator.startDrawingQuads(); /* 361 */ GL11.glTexParameteri(3553, 10241, 9729); /* 362 */ GL11.glTexParameteri(3553, 10240, 9729); /* 363 */ tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); /* 364 */ int k = this.width; /* 365 */ int l = this.height; /* 366 */ tessellator.addVertexWithUV(0.0D, 0.0D, this.zLevel, 0.0D, 0.0D); /* 367 */ tessellator.addVertexWithUV(0.0D, l, this.zLevel, 0.0D, 1.0D); /* 368 */ tessellator.addVertexWithUV(k, l, this.zLevel, 1.0D, 1.0D); /* 369 */ tessellator.addVertexWithUV(k, 0.0D, this.zLevel, 1.0D, 0.0D); /* 370 */ tessellator.draw(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) /* */ { /* 425 */ GL11.glDisable(3008); /* 426 */ renderBackGround(); /* 427 */ GL11.glEnable(3008); /* 428 */ Tessellator tessellator = Tessellator.instance; /* 429 */ short short1 = 274; /* 430 */ int k = this.width / 2 - short1 / 2; /* 431 */ byte b0 = 30; /* */ /* */ /* 434 */ this.mc.getTextureManager().bindTexture(minecraftTitleTextures); /* 435 */ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); /* */ /* 437 */ if (this.updateCounter < 1.0E-4D) /* */ { /* 439 */ drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44); /* 440 */ drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44); /* 441 */ drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44); /* 442 */ drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44); /* 443 */ drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); /* */ } /* */ else /* */ { /* 447 */ drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44); /* 448 */ drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); /* */ } /* */ /* 451 */ tessellator.setColorOpaque_I(-1); /* 452 */ GL11.glPushMatrix(); /* 453 */ GL11.glTranslatef(this.width / 2 + 90, 70.0F, 0.0F); /* 454 */ GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); /* 455 */ float f1 = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * 3.1415927F * 2.0F) * 0.1F); /* 456 */ f1 = f1 * 100.0F / (this.fontRendererObj.getStringWidth(this.splashText) + 32); /* 457 */ GL11.glScalef(f1, f1, f1); /* 458 */ drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, 65280); /* 459 */ GL11.glPopMatrix(); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 477 */ String s1 = "§9Все права на игру принадлежат Mojang AB."; /* 478 */ drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 27, -1); /* 480 */ String s2 = "§9Копирование информации без разрешения администрации §cзапрещено."; /* 481 */ drawString(this.fontRendererObj, s2, this.width - this.fontRendererObj.getStringWidth(s2) - 2, this.height - 10, -1); /* 482 */ String s3 = "§aMini§bLife §9- Комплекс игровых серверов Minecraft"; /* 483 */ drawString(this.fontRendererObj, s3, this.width - this.fontRendererObj.getStringWidth(s3) - 2, this.height - 19, -1); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 492 */ super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); /* */ } private int fontRendererObj(String scrollingText2) { // TODO Автоматически созданная заглушка метода return 0; } private void fontRendererObj(String scrollingText2, int scrollingTextPosX2, int i, int j) { // TODO Автоматически созданная заглушка метода } /* */ /* */ /* */ /* */ /* */ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) /* */ { /* 500 */ super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); /* 501 */ Object object = this.field_104025_t; /* */ /* 503 */ synchronized (this.field_104025_t) /* */ { /* 505 */ 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)) /* */ { /* 507 */ GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.field_104024_v, 13, true); /* 508 */ guiconfirmopenlink.func_146358_g(); /* 509 */ this.mc.displayGuiScreen(guiconfirmopenlink); /* */ } /* */ } /* */ } /* */ } /* Location: C:\SRC\build\libs\menumod.jar!\net\minecraft\client\gui\GuiMainMenu.class * Java compiler version: 7 (51.0) * JD-Core Version: 0.7.1 */
core:
package MiniMenu; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; 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 cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @Mod(modid = "custommenu", name = "Custom Menu", version = "1.1.0") public class coremenu { @EventHandler public void init(FMLInitializationEvent event) { if(event.getSide().isClient()) { FMLCommonHandler.instance().bus().register(this); } } @SubscribeEvent @SideOnly(Side.CLIENT) public void onTick(TickEvent.ClientTickEvent event) { Minecraft mc = FMLClientHandler.instance().getClient(); if(mc.currentScreen != null && mc.currentScreen.getClass().equals(GuiMainMenu.class)) { mc.displayGuiScreen(new Menu()); } } }
Gui:
package net.minecraft.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class Gui { public static final ResourceLocation optionsBackground = new ResourceLocation("textures/gui/options_background.png"); public static final ResourceLocation statIcons = new ResourceLocation("textures/gui/container/stats_icons.png"); public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); public void drawBorderedRect(int x, int y, int x1, int y1, int size, int borderC, int insideC) { drawRect(x + size, y + size, x1 - size, y1 - size, insideC); drawRect(x + size, y + size, x1, y, borderC); drawRect(x, y, x + size, y1 - 1, borderC); drawRect(x1, y1 - 1, x1 - size, y + size, borderC); drawRect(x, y1 - size, x1, y1, borderC); } protected float zLevel; private static final String __OBFID = "CL_00000662"; protected void drawHorizontalLine(int p_73730_1_, int p_73730_2_, int p_73730_3_, int p_73730_4_) { if (p_73730_2_ < p_73730_1_) { int i1 = p_73730_1_; p_73730_1_ = p_73730_2_; p_73730_2_ = i1; } drawRect(p_73730_1_, p_73730_3_, p_73730_2_ + 1, p_73730_3_ + 1, p_73730_4_); } protected void drawVerticalLine(int p_73728_1_, int p_73728_2_, int p_73728_3_, int p_73728_4_) { if (p_73728_3_ < p_73728_2_) { int i1 = p_73728_2_; p_73728_2_ = p_73728_3_; p_73728_3_ = i1; } drawRect(p_73728_1_, p_73728_2_ + 1, p_73728_1_ + 1, p_73728_3_, p_73728_4_); } /** * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color */ public static void drawRect(int p_73734_0_, int p_73734_1_, int p_73734_2_, int p_73734_3_, int p_73734_4_) { int j1; if (p_73734_0_ < p_73734_2_) { j1 = p_73734_0_; p_73734_0_ = p_73734_2_; p_73734_2_ = j1; } if (p_73734_1_ < p_73734_3_) { j1 = p_73734_1_; p_73734_1_ = p_73734_3_; p_73734_3_ = j1; } float f3 = (float)(p_73734_4_ >> 24 & 255) / 255.0F; float f = (float)(p_73734_4_ >> 16 & 255) / 255.0F; float f1 = (float)(p_73734_4_ >> 8 & 255) / 255.0F; float f2 = (float)(p_73734_4_ & 255) / 255.0F; Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(f, f1, f2, f3); tessellator.startDrawingQuads(); tessellator.addVertex((double)p_73734_0_, (double)p_73734_3_, 0.0D); tessellator.addVertex((double)p_73734_2_, (double)p_73734_3_, 0.0D); tessellator.addVertex((double)p_73734_2_, (double)p_73734_1_, 0.0D); tessellator.addVertex((double)p_73734_0_, (double)p_73734_1_, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } /** * Draws a rectangle with a vertical gradient between the specified colors. */ protected void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_) { float f = (float)(p_73733_5_ >> 24 & 255) / 255.0F; float f1 = (float)(p_73733_5_ >> 16 & 255) / 255.0F; float f2 = (float)(p_73733_5_ >> 8 & 255) / 255.0F; float f3 = (float)(p_73733_5_ & 255) / 255.0F; float f4 = (float)(p_73733_6_ >> 24 & 255) / 255.0F; float f5 = (float)(p_73733_6_ >> 16 & 255) / 255.0F; float f6 = (float)(p_73733_6_ >> 8 & 255) / 255.0F; float f7 = (float)(p_73733_6_ & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f1, f2, f3, f); tessellator.addVertex((double)p_73733_3_, (double)p_73733_2_, (double)this.zLevel); tessellator.addVertex((double)p_73733_1_, (double)p_73733_2_, (double)this.zLevel); tessellator.setColorRGBA_F(f5, f6, f7, f4); tessellator.addVertex((double)p_73733_1_, (double)p_73733_4_, (double)this.zLevel); tessellator.addVertex((double)p_73733_3_, (double)p_73733_4_, (double)this.zLevel); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); } /** * Renders the specified text to the screen, center-aligned. */ public void drawCenteredString(FontRenderer p_73732_1_, String p_73732_2_, int p_73732_3_, int p_73732_4_, int p_73732_5_) { p_73732_1_.drawStringWithShadow(p_73732_2_, p_73732_3_ - p_73732_1_.getStringWidth(p_73732_2_) / 2, p_73732_4_, p_73732_5_); } /** * Renders the specified text to the screen. */ public void drawString(FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_, int p_73731_5_) { p_73731_1_.drawStringWithShadow(p_73731_2_, p_73731_3_, p_73731_4_, p_73731_5_); } /** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, int p_73729_5_, int p_73729_6_) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1)); tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1)); tessellator.draw(); } public void drawTexturedModelRectFromIcon(int p_94065_1_, int p_94065_2_, IIcon p_94065_3_, int p_94065_4_, int p_94065_5_) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(p_94065_1_ + 0), (double)(p_94065_2_ + p_94065_5_), (double)this.zLevel, (double)p_94065_3_.getMinU(), (double)p_94065_3_.getMaxV()); tessellator.addVertexWithUV((double)(p_94065_1_ + p_94065_4_), (double)(p_94065_2_ + p_94065_5_), (double)this.zLevel, (double)p_94065_3_.getMaxU(), (double)p_94065_3_.getMaxV()); tessellator.addVertexWithUV((double)(p_94065_1_ + p_94065_4_), (double)(p_94065_2_ + 0), (double)this.zLevel, (double)p_94065_3_.getMaxU(), (double)p_94065_3_.getMinV()); tessellator.addVertexWithUV((double)(p_94065_1_ + 0), (double)(p_94065_2_ + 0), (double)this.zLevel, (double)p_94065_3_.getMinU(), (double)p_94065_3_.getMinV()); tessellator.draw(); } public static void func_146110_a(int p_146110_0_, int p_146110_1_, float p_146110_2_, float p_146110_3_, int p_146110_4_, int p_146110_5_, float p_146110_6_, float p_146110_7_) { float f4 = 1.0F / p_146110_6_; float f5 = 1.0F / p_146110_7_; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)p_146110_0_, (double)(p_146110_1_ + p_146110_5_), 0.0D, (double)(p_146110_2_ * f4), (double)((p_146110_3_ + (float)p_146110_5_) * f5)); tessellator.addVertexWithUV((double)(p_146110_0_ + p_146110_4_), (double)(p_146110_1_ + p_146110_5_), 0.0D, (double)((p_146110_2_ + (float)p_146110_4_) * f4), (double)((p_146110_3_ + (float)p_146110_5_) * f5)); tessellator.addVertexWithUV((double)(p_146110_0_ + p_146110_4_), (double)p_146110_1_, 0.0D, (double)((p_146110_2_ + (float)p_146110_4_) * f4), (double)(p_146110_3_ * f5)); tessellator.addVertexWithUV((double)p_146110_0_, (double)p_146110_1_, 0.0D, (double)(p_146110_2_ * f4), (double)(p_146110_3_ * f5)); tessellator.draw(); } public static void func_152125_a(int p_152125_0_, int p_152125_1_, float p_152125_2_, float p_152125_3_, int p_152125_4_, int p_152125_5_, int p_152125_6_, int p_152125_7_, float p_152125_8_, float p_152125_9_) { float f4 = 1.0F / p_152125_8_; float f5 = 1.0F / p_152125_9_; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)p_152125_0_, (double)(p_152125_1_ + p_152125_7_), 0.0D, (double)(p_152125_2_ * f4), (double)((p_152125_3_ + (float)p_152125_5_) * f5)); tessellator.addVertexWithUV((double)(p_152125_0_ + p_152125_6_), (double)(p_152125_1_ + p_152125_7_), 0.0D, (double)((p_152125_2_ + (float)p_152125_4_) * f4), (double)((p_152125_3_ + (float)p_152125_5_) * f5)); tessellator.addVertexWithUV((double)(p_152125_0_ + p_152125_6_), (double)p_152125_1_, 0.0D, (double)((p_152125_2_ + (float)p_152125_4_) * f4), (double)(p_152125_3_ * f5)); tessellator.addVertexWithUV((double)p_152125_0_, (double)p_152125_1_, 0.0D, (double)(p_152125_2_ * f4), (double)(p_152125_3_ * f5)); tessellator.draw(); } }
GuiButton:
package net.minecraft.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiButton extends Gui { protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); /** Button width in pixels */ public int width; /** Button height in pixels */ public int height; /** The x position of this control. */ public int xPosition; /** The y position of this control. */ public int yPosition; /** The string displayed on this control. */ public String displayString; public int id; /** True if this control is enabled, false to disable. */ public boolean enabled; /** Hides the button completely if false. */ public boolean visible; protected boolean field_146123_n; private static final String __OBFID = "CL_00000668"; public int packedFGColour; public int field_146120_f; public int field_146129_i; public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) { this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_); } public GuiButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) { this.width = 200; this.height = 20; this.enabled = true; this.visible = true; this.id = p_i1021_1_; this.xPosition = p_i1021_2_; this.yPosition = p_i1021_3_; this.width = p_i1021_4_; this.height = p_i1021_5_; this.displayString = p_i1021_6_; } /** * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over * this button. */ public int getHoverState(boolean p_146114_1_) { byte b0 = 1; if (!this.enabled) { b0 = 0; } else if (p_146114_1_) { b0 = 2; } return b0; } /** * Draws this button to the screen. */ public void drawButton(Minecraft mc, int mx, int my) { if (this.visible) { GL11.glColor4f(1F, 1F, 1F, 1F); boolean changed = mx >= this.xPosition && my >= this.yPosition && mx < this.xPosition + this.width && my < this.yPosition + this.height; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); int color = changed ? 0x50000000 : 0x40000000; // changed;not_changed this.drawBorderedRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 1, 0x90FFFFFF, color); color = this.enabled ? (changed ? 0x00FF00 : 0x7CFC00) : 0xFF0000; // changed;not_changed;not_enabled this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, color); this.mouseDragged(mc, mx, my); } } /** * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). */ protected void mouseDragged(Minecraft p_146119_1_, int p_146119_2_, int p_146119_3_) {} /** * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). */ public void mouseReleased(int p_146118_1_, int p_146118_2_) {} /** * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent * e). */ public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_) { return this.enabled && this.visible && p_146116_2_ >= this.xPosition && p_146116_3_ >= this.yPosition && p_146116_2_ < this.xPosition + this.width && p_146116_3_ < this.yPosition + this.height; } public boolean func_146115_a() { return this.field_146123_n; } public void func_146111_b(int p_146111_1_, int p_146111_2_) {} public void func_146113_a(SoundHandler p_146113_1_) { p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } public int getButtonWidth() { return this.width; } public int func_154310_c() { return this.height; } }
GuiMultiplayer:
package net.minecraft.client.gui; import com.google.common.base.Splitter; import com.google.common.collect.Lists; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreenAddServer; import net.minecraft.client.gui.GuiScreenServerList; import net.minecraft.client.gui.GuiYesNo; import net.minecraft.client.gui.GuiYesNoCallback; import net.minecraft.client.gui.ServerListEntryLanDetected; import net.minecraft.client.gui.ServerListEntryLanScan; import net.minecraft.client.gui.ServerListEntryNormal; import net.minecraft.client.gui.ServerSelectionList; import net.minecraft.client.gui.GuiListExtended; import net.minecraft.client.gui.GuiListExtended.IGuiListEntry; import net.minecraft.client.multiplayer.GuiConnecting; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.ServerList; import net.minecraft.client.network.LanServerDetector; import net.minecraft.client.network.OldServerPinger; import net.minecraft.client.resources.I18n; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.input.Keyboard; @SideOnly(Side.CLIENT) public class GuiMultiplayer extends GuiScreen implements GuiYesNoCallback { private static final Logger logger = LogManager.getLogger(); private final OldServerPinger field_146797_f = new OldServerPinger(); private GuiScreen field_146798_g; private ServerSelectionList field_146803_h; private ServerList field_146804_i; private GuiButton field_146810_r; private GuiButton field_146809_s; private GuiButton field_146808_t; private boolean field_146807_u; private boolean field_146806_v; private boolean field_146805_w; private boolean field_146813_x; private String field_146812_y; private ServerData field_146811_z; private LanServerDetector.LanServerList field_146799_A; private LanServerDetector.ThreadLanServerFind field_146800_B; private boolean field_146801_C; private static final String __OBFID = "CL_00000814"; public GuiMultiplayer(GuiScreen p_i1040_1_) { this.field_146798_g = p_i1040_1_; FMLClientHandler.instance().setupServerList(); } /** * Adds the buttons (and other controls) to the screen in question. */ public void initGui() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); if (!this.field_146801_C) { this.field_146801_C = true; this.field_146804_i = new ServerList(this.mc); this.field_146804_i.loadServerList(); this.field_146799_A = new LanServerDetector.LanServerList(); try { this.field_146800_B = new LanServerDetector.ThreadLanServerFind(this.field_146799_A); this.field_146800_B.start(); } catch (Exception exception) { logger.warn("Unable to start LAN server detection: " + exception.getMessage()); } this.field_146803_h = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36); this.field_146803_h.func_148195_a(this.field_146804_i); } else { this.field_146803_h.func_148122_a(this.width, this.height, 32, this.height - 64); } this.func_146794_g(); } public void func_146794_g() { this.buttonList.add(this.field_146810_r = new GuiButton(7, this.width / 2 - 154, this.height, I18n.format("selectServer.edit", new Object[0]))); this.buttonList.add(this.field_146808_t = new GuiButton(2, this.width / 2 - 74, this.height, I18n.format("selectServer.delete", new Object[0]))); this.buttonList.add(this.field_146809_s = new GuiButton(1, this.width / 2 - 154, this.height - 52, 308, 20, I18n.format("Зайти на Сервер", new Object[0]))); this.buttonList.add(new GuiButton(8, this.width / 2 - 154, this.height - 28, 152, 20, I18n.format("Обновить", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 + 2, this.height - 28, 152, 20, I18n.format("Отмена", new Object[0]))); func_146790_a(this.field_146803_h.func_148193_k()); } /** * Called from the main game loop to update the screen. */ public void updateScreen() { super.updateScreen(); if (this.field_146799_A.getWasUpdated()) { List list = this.field_146799_A.getLanServers(); this.field_146799_A.setWasNotUpdated(); this.field_146803_h.func_148194_a(list); } this.field_146797_f.func_147223_a(); } /** * Called when the screen is unloaded. Used to disable keyboard repeat events */ public void onGuiClosed() { Keyboard.enableRepeatEvents(false); if (this.field_146800_B != null) { this.field_146800_B.interrupt(); this.field_146800_B = null; } this.field_146797_f.func_147226_b(); } protected void actionPerformed(GuiButton p_146284_1_) { if (p_146284_1_.enabled) { GuiListExtended.IGuiListEntry iguilistentry = this.field_146803_h.func_148193_k() < 0 ? null : this.field_146803_h.getListEntry(this.field_146803_h.func_148193_k()); if (p_146284_1_.id == 2 && iguilistentry instanceof ServerListEntryNormal) { String s4 = ((ServerListEntryNormal)iguilistentry).func_148296_a().serverName; if (s4 != null) { this.field_146807_u = true; String s = I18n.format("selectServer.deleteQuestion", new Object[0]); String s1 = "\'" + s4 + "\' " + I18n.format("selectServer.deleteWarning", new Object[0]); String s2 = I18n.format("selectServer.deleteButton", new Object[0]); String s3 = I18n.format("gui.cancel", new Object[0]); GuiYesNo guiyesno = new GuiYesNo(this, s, s1, s2, s3, this.field_146803_h.func_148193_k()); this.mc.displayGuiScreen(guiyesno); } } else if (p_146284_1_.id == 1) { this.func_146796_h(); } else if (p_146284_1_.id == 4) { this.field_146813_x = true; this.mc.displayGuiScreen(new GuiScreenServerList(this, this.field_146811_z = new ServerData(I18n.format("selectServer.defaultName", new Object[0]), ""))); } else if (p_146284_1_.id == 3) { this.field_146806_v = true; this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.field_146811_z = new ServerData(I18n.format("selectServer.defaultName", new Object[0]), ""))); } else if (p_146284_1_.id == 7 && iguilistentry instanceof ServerListEntryNormal) { this.field_146805_w = true; ServerData serverdata = ((ServerListEntryNormal)iguilistentry).func_148296_a(); this.field_146811_z = new ServerData(serverdata.serverName, serverdata.serverIP); this.field_146811_z.func_152583_a(serverdata); this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.field_146811_z)); } else if (p_146284_1_.id == 0) { this.mc.displayGuiScreen(this.field_146798_g); } else if (p_146284_1_.id == 8) { this.func_146792_q(); } } } private void func_146792_q() { this.mc.displayGuiScreen(new GuiMultiplayer(this.field_146798_g)); } public void confirmClicked(boolean p_73878_1_, int p_73878_2_) { GuiListExtended.IGuiListEntry iguilistentry = this.field_146803_h.func_148193_k() < 0 ? null : this.field_146803_h.getListEntry(this.field_146803_h.func_148193_k()); if (this.field_146807_u) { this.field_146807_u = false; if (p_73878_1_ && iguilistentry instanceof ServerListEntryNormal) { this.field_146804_i.removeServerData(this.field_146803_h.func_148193_k()); this.field_146804_i.saveServerList(); this.field_146803_h.func_148192_c(-1); this.field_146803_h.func_148195_a(this.field_146804_i); } this.mc.displayGuiScreen(this); } else if (this.field_146813_x) { this.field_146813_x = false; if (p_73878_1_) { this.func_146791_a(this.field_146811_z); } else { this.mc.displayGuiScreen(this); } } else if (this.field_146806_v) { this.field_146806_v = false; if (p_73878_1_) { this.field_146804_i.addServerData(this.field_146811_z); this.field_146804_i.saveServerList(); this.field_146803_h.func_148192_c(-1); this.field_146803_h.func_148195_a(this.field_146804_i); } this.mc.displayGuiScreen(this); } else if (this.field_146805_w) { this.field_146805_w = false; if (p_73878_1_ && iguilistentry instanceof ServerListEntryNormal) { ServerData serverdata = ((ServerListEntryNormal)iguilistentry).func_148296_a(); serverdata.serverName = this.field_146811_z.serverName; serverdata.serverIP = this.field_146811_z.serverIP; serverdata.func_152583_a(this.field_146811_z); this.field_146804_i.saveServerList(); this.field_146803_h.func_148195_a(this.field_146804_i); } this.mc.displayGuiScreen(this); } } /** * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ protected void keyTyped(char p_73869_1_, int p_73869_2_) { int j = this.field_146803_h.func_148193_k(); GuiListExtended.IGuiListEntry iguilistentry = j < 0 ? null : this.field_146803_h.getListEntry(j); if (p_73869_2_ == 63) { this.func_146792_q(); } else { if (j >= 0) { if (p_73869_2_ == 200) { if (isShiftKeyDown()) { if (j > 0 && iguilistentry instanceof ServerListEntryNormal) { this.field_146804_i.swapServers(j, j - 1); this.func_146790_a(this.field_146803_h.func_148193_k() - 1); this.field_146803_h.scrollBy(-this.field_146803_h.getSlotHeight()); this.field_146803_h.func_148195_a(this.field_146804_i); } } else if (j > 0) { this.func_146790_a(this.field_146803_h.func_148193_k() - 1); this.field_146803_h.scrollBy(-this.field_146803_h.getSlotHeight()); if (this.field_146803_h.getListEntry(this.field_146803_h.func_148193_k()) instanceof ServerListEntryLanScan) { if (this.field_146803_h.func_148193_k() > 0) { this.func_146790_a(this.field_146803_h.getSize() - 1); this.field_146803_h.scrollBy(-this.field_146803_h.getSlotHeight()); } else { this.func_146790_a(-1); } } } else { this.func_146790_a(-1); } } else if (p_73869_2_ == 208) { if (isShiftKeyDown()) { if (j < this.field_146804_i.countServers() - 1) { this.field_146804_i.swapServers(j, j + 1); this.func_146790_a(j + 1); this.field_146803_h.scrollBy(this.field_146803_h.getSlotHeight()); this.field_146803_h.func_148195_a(this.field_146804_i); } } else if (j < this.field_146803_h.getSize()) { this.func_146790_a(this.field_146803_h.func_148193_k() + 1); this.field_146803_h.scrollBy(this.field_146803_h.getSlotHeight()); if (this.field_146803_h.getListEntry(this.field_146803_h.func_148193_k()) instanceof ServerListEntryLanScan) { if (this.field_146803_h.func_148193_k() < this.field_146803_h.getSize() - 1) { this.func_146790_a(this.field_146803_h.getSize() + 1); this.field_146803_h.scrollBy(this.field_146803_h.getSlotHeight()); } else { this.func_146790_a(-1); } } } else { this.func_146790_a(-1); } } else if (p_73869_2_ != 28 && p_73869_2_ != 156) { super.keyTyped(p_73869_1_, p_73869_2_); } else { this.actionPerformed((GuiButton)this.buttonList.get(2)); } } else { super.keyTyped(p_73869_1_, p_73869_2_); } } } /** * Draws the screen and all the components in it. */ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.field_146812_y = null; this.drawDefaultBackground(); this.field_146803_h.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.title", new Object[0]), this.width / 2, 20, 16777215); super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); if (this.field_146812_y != null) { this.func_146283_a(Lists.newArrayList(Splitter.on("\n").split(this.field_146812_y)), p_73863_1_, p_73863_2_); } } public void func_146796_h() { GuiListExtended.IGuiListEntry iguilistentry = this.field_146803_h.func_148193_k() < 0 ? null : this.field_146803_h.getListEntry(this.field_146803_h.func_148193_k()); if (iguilistentry instanceof ServerListEntryNormal) { this.func_146791_a(((ServerListEntryNormal)iguilistentry).func_148296_a()); } else if (iguilistentry instanceof ServerListEntryLanDetected) { LanServerDetector.LanServer lanserver = ((ServerListEntryLanDetected)iguilistentry).func_148289_a(); this.func_146791_a(new ServerData(lanserver.getServerMotd(), lanserver.getServerIpPort(), true)); } } private void func_146791_a(ServerData p_146791_1_) { FMLClientHandler.instance().connectToServer(this, p_146791_1_); } public void func_146790_a(int p_146790_1_) { this.field_146803_h.func_148192_c(p_146790_1_); GuiListExtended.IGuiListEntry iguilistentry = p_146790_1_ < 0 ? null : this.field_146803_h.getListEntry(p_146790_1_); this.field_146809_s.enabled = false; this.field_146810_r.enabled = false; this.field_146808_t.enabled = false; if (iguilistentry != null && !(iguilistentry instanceof ServerListEntryLanScan)) { this.field_146809_s.enabled = true; if (iguilistentry instanceof ServerListEntryNormal) { this.field_146810_r.enabled = true; this.field_146808_t.enabled = true; } } } public OldServerPinger func_146789_i() { return this.field_146797_f; } public void func_146793_a(String p_146793_1_) { this.field_146812_y = p_146793_1_; } /** * Called when the mouse is clicked. */ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) { super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); this.field_146803_h.func_148179_a(p_73864_1_, p_73864_2_, p_73864_3_); } /** * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is * mouseMove, which==0 or which==1 is mouseUp */ protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) { super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); this.field_146803_h.func_148181_b(p_146286_1_, p_146286_2_, p_146286_3_); } public ServerList func_146795_p() { return this.field_146804_i; } }
la suite des code je peux pas maittre car il y a une limite de text
-
Salut,
Il n’est pas possible de remplacer une classe de Minecraft de cette façon car les classes de mods sont chargés après celle de Minecraft en prod (alors que sur le dev, minecraft est en bibliothèque externe et est donc chargé après les classes de ton mod).Si tu veux juste retexturer les boutons, un pack de ressource directement intégré dans ton mod sera suffisant (c’est possible).
Sinon il faut passer par de l’asm et un coremod pour changer le code de mc.
-
@‘robin4002’:
Salut,
Il n’est pas possible de remplacer une classe de Minecraft de cette façon car les classes de mods sont chargés après celle de Minecraft en prod (alors que sur le dev, minecraft est en bibliothèque externe et est donc chargé après les classes de ton mod).Si tu veux juste retexturer les boutons, un pack de ressource directement intégré dans ton mod sera suffisant (c’est possible).
Sinon il faut passer par de l’asm et un coremod pour changer le code de mc.
tu peux me dire comment faire ? (sois le texture pack dans le mode, sois le coremod)
Merci ) -
En pack de texture il faut simplement modifier le fichier de minecraft contenant les textures que tu veux modifier et placer les fichiers modifiés dans ton mod en suivant la même arborescence (donc faire un dossier assets/minecraft/… dans ton mod). Les mods étant chargé comme des pack de ressource, cela devrait fonctionner.
Avec un coremod : https://www.minecraftforgefrance.fr/topic/3495/créer-un-coremod-pour-modifier-les-classes-de-minecraft
-
Re : Problème compilation
Quand J’essaye de faire gradlew build sa m’affiche cela https://hastebin.com/ohasajinoc pouvez vous m’aidé s’il vous plaît
-
Bonjour,
Visiblement le dépo maven http://repo1.maven.org/maven2 ne répond plus en http, il faut obligatoirement l’utiliser en https.
Par contre ne suis pas sûr que tu puisses changer ce lien, il est peut-être dans le code de gradle ou de forge gradle.Le mieux serait de se mettre à jour, de toute façon MFF ne fait plus de support pour la 1.7.10.
-
comment je le met a jour ?
-
En utilisant la 1.14.4 au lieu de la 1.7.10.
-
d’accord merci
-
est ce que je peux toujours resté en 1.7.10 ou je suis obligé de changé de versions. Je peut pas résoudre ce probléme ?
-
Ce message a été supprimé ! -
on peut le trouver ou le code de gradle ou de forge gradle
-
ForgeGradle : https://github.com/MinecraftForge/ForgeGradle
-
Ce message a été supprimé ! -
Ce message a été supprimé ! -
pour modifié les lien il faut allez ou comme pour modifié celui la http://repo1.maven.org/maven2
-
Aucune idée, quelque part dans le code de gradle ou forge gradle.
Il faut remplacer le http par https.Mais sinon les versions à jour ne sont pas concerné par ce bug (genre la 1.12.2, la 1.15.1, etc.).
-
@robin4002 je sais mais je préfere la 1.7.10
-
Moi non, je n’aime pas les soft obsolète.
Et MFF ne fait plus de support pour la 1.7.10 donc tu n’aura pas de solution ici (de toute façon je ne connais pas la solution. -
@robin4002 d’accord merci quand même