본문 바로가기
Game/Minecraft

마인크래프트 서버 접속기 만들기[2]

by ryush00 2013. 3. 30.

안녕하세요.

말똥이입니다.



2013/03/30 - [마인크래프트/개발] - 마인크래프트 서버 접속기 만들기[1]


이전 글에 이어 두번째입니다.


오늘은 저번에 서버 접속하기만들었을때


오류나면 멀티플레이어서버선택메뉴로 가는데

그걸 바꿔보도록 하겠습니다.


먼저 저번에 디컴파일한걸 이클립스로 열어보세요.


그리고 이번엔 GuiDisconnected.java를 열어주세요.


그러면 this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.toMenu"))); 이게 보일겁니다.


예가 toMenu. 즉 나가는겁니다.

예의 고유번호는 0. 아래내려서


    protected void actionPerformed(GuiButton par1GuiButton)

    {

        if (par1GuiButton.id == 0)

        {

            this.mc.displayGuiScreen(this.field_98095_n);

        }

    }


이걸 찾아봅시다. 고유번호 0번일경우 누르면 field_98095_n를 보이도록 되어있네요.


또 이곳을 저번과 같이


    protected void actionPerformed(GuiButton par1GuiButton)

    {

        if (par1GuiButton.id == 0)

        {

            //this.mc.displayGuiScreen(this.field_98095_n);

        this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, new ServerData("서버이름", "서버주소")));

        }

    }


로 바꿔줍니다.

아 그리고 전에 깜빡한게 있는데 버튼에 이름을 바꾸려면


this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.toMenu")));

이곳을 바꿔주면 됩니다.


저는


this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "다시 접속"));


이렇게 바꿔보도록 하겠습니다.






다시 접속을 누르면 다시접속을 시도합니다. ㅇㅇ


이걸 그냥 메인으로 나가게하려면 this.mc.displayGuiScreen(this.field_98095_n);

 this.mc.displayGuiScreen(new GuiMainMenu());

로 바꿔주면 될 듯 합니다.



To be contine...



오래된 글입니다. 최신 마인크래프트 버전에서는 잘 동작하지 않습니다. 직접 구조를 파악하셔야 합니다.


댓글