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

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;
        }
    }
}
 

 

  • Author

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

  • Author
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!

 

  • Author
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?

  • Author

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

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.