Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

java.lang.NoSuchFieldError: id
i was use GuiButton.id to get button id when InitGuiEvent.Post triggerd.

code is tested in mdk's client,this error happend in a real client.

forge version is same

 

here's code

    @SubscribeEvent
    public void guiEdit(InitGuiEvent.Post e) {
    	int allowModNum = 4;
    	if (Loader.isModLoaded("OptiFine"))
    		allowModNum++;
    	if (Loader.isModLoaded("InputFix"))
    		allowModNum++;
    	if (Loader.instance().getActiveModList().size() > allowModNum) {
    		Minecraft.getMinecraft().shutdown();
    	}
    	if (e.gui instanceof GuiMainMenu) {
    		GuiScreen screen = e.gui;
    		for (Object o : e.buttonList) {
    			GuiButton btn = (GuiButton)o;
    			if (btn.id != 4&&btn.id != 0&&btn.id != 5) {
    				btn.visible = false;
    			} else if (btn.id == 4) {
    				btn.displayString = "离开昔日黄昏";
    			} else if (btn.id == 0) {
    				btn.displayString = "客户端设置...";
    			}
    		}
    		joinServer.yPosition = (int)(screen.height * 0.5);
    		joinServer.xPosition = (int)(screen.width * 0.5) - 100;
    		joinServer.width = 200;
    		e.buttonList.add(joinServer);
    	} else if (e.gui instanceof GuiIngameMenu) {
    		GuiScreen screen = e.gui;
    		for (Object o : e.buttonList) {
    			GuiButton btn = (GuiButton)o;
    			if (btn.id != 4&&btn.id != 0&&btn.id != 5&&btn.id != 6) {
    				btn.visible = false;
    			} else if (btn.id == 4) {
    				btn.displayString = "返回昔日黄昏";
    			} else if (btn.id == 0) {
    				btn.displayString = "客户端设置...";
    				btn.width = 200;
    			} else if (btn.id == 5) {
    				btn.displayString = "成就";
    			} else if (btn.id == 6) {
    				btn.displayString = "统计数据";
    			}
    			if (btn.id == 1) {
    				disconnect.xPosition = btn.xPosition;
    				disconnect.yPosition = btn.yPosition;
    				disconnect.width = btn.width;
    			}
    		}
    		e.buttonList.add(disconnect);
    	} else if (e.gui instanceof GuiConnecting) {
    		e.buttonList.clear();
    	}
    }

 

crash-2018-03-23_13.12.01-client.txt

Edited by yyk419476391
Question solved

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.