Jump to content

Recommended Posts

Posted

Hi,

I wanna ask, how I can connect to a server by a gui-button?

For Example:

I have the Main-Menu and I wanna make a button wich connect to "hypixel.com" server by click the button.

I use the recomended Version of 1.8.9 Forge.

 

Thank you very much for helping and sorry for my english... ;)

 

 

 

Here is my Code:

 

package oect.lwaltens.luckyblockhero.guis;

imports...

public class gui_start extends GuiScreen{
    public static final ResourceLocation LOGO = new ResourceLocation("luckyblockhero:textures/gui/gui_logo.png");    
    private gui_start start;
    
    private float updateCounter;
    
    private GameSettings options;
    private GuiMainMenu menu;
    private GuiMultiplayer multiplayer;
    
    
    public gui_start(GuiMainMenu menu) {this.menu = menu;}
    public gui_start(GuiMultiplayer multiplayer) {this.multiplayer = multiplayer;}
    
        

    @Override
    public void initGui() {
        this.buttonList.add(new GuiButton(0, width/2-50, height/2-40, 100, 20, "Server"));
        this.buttonList.add(new GuiButton(1, width/2-50, height/2-20, 100, 20, "Info"));
        this.buttonList.add(new GuiButton(2, width/2-50, height/2+10, 100, 20, "Quit"));
        
        super.initGui();
    }
    
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        drawDefaultBackground();
        drawRect(width/2, height/2, width/2+100, height/2+100, 0xfffff);
        fontRendererObj.drawString(EnumChatFormatting.BOLD+"Willkommen bei Minecraft Lucky Block Heroes", width / 2 - 100, height / 2 -100, 16777215);
        
        


        
        super.drawScreen(mouseX, mouseY, partialTicks);
    }
    
        

    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
        switch(button.id) {
            case 0: this.mc.displayGuiScreen(new GuiConnecting(this, mc, "hypixel.com", 25565));
            case 1: this.mc.displayGuiScreen(new gui_info(menu)); break;
            case 2: this.mc.shutdown(); break;
        }
    }
}
 

 

Posted

Thank you very much!

A other question:

 

Can you say me how Can I Register a Crafting recipe in Forge 1.8.9 with a item from a other Mod?

For Example:

 

I want craft a minecraft:emerald to a lucky:lucky_block_oect

Posted
On 28. Dezember 2017 at 6:07 PM, diesieben07 said:

If you want to add a button to the main menu, then you can't just make your own GuiScreen. You need to use the GUI events (check out the classes in GuiScreenEvent).

I've got one more question,

how can I wait to run a line

for example:

player.addChatMessage(new ChatComponentText("wait 1 minute");

//wait 1 minute

player.addChatMessage(new ChatComponentText("now i'm ready");

 

can you send me pls a concrete code?

 

Thank you very much!

 

Posted
4 minutes ago, diesieben07 said:

You have to count ticks. You need to do this via one of the tick events, depending on your logical side (i.e. either ServerTickEvent or ClientTickEvent).

Is there a way to so that in the Same class or Must i do that in a EventHandler?

Posted

O

11 minutes ago, diesieben07 said:

You have to count ticks. You need to do this via one of the tick events, depending on your logical side (i.e. either ServerTickEvent or ClientTickEvent).

And a other question how Can I run a command, that Need OP by a non OP, for example 

 

MinecraftServer......executeCommand(sender, "/kill")

 

and I want to run that in a command that Can be used by not OP Players.

 

Also i Must Change the Sender, but how???

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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