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

I've created a new GUI called "GuiDecimationIngame" that overwrites the players inventory GUI (so I can add my own containers).

 

I've made the gui and this is what I have so far:

 

yOKeQt5.png

 

I'm wanting to print out the players inventory GUI (interactive) so that the player still has access to his/her items, hotbar and crafting table.

 

Any ideas on what code I can add to my "GuiDecimationIngame" Gui to add the players inventory?

 

 

package com.mcheroesandgenerals.mainmenu.gui;

 

import com.mcheroesandgenerals.mainmenu.MainMenu;

import com.mcheroesandgenerals.mainmenu.gui.GuiContainerInventory;

import com.mcheroesandgenerals.mainmenu.mainmenuutils.MainMenuNews;

import com.mcheroesandgenerals.mainmenu.mainmenuutils.MainMenuPing;

import com.mcheroesandgenerals.mainmenu.mainmenuutils.MainMenuUpdates;

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.*;

import net.minecraft.client.gui.GuiButton;

import net.minecraft.client.gui.inventory.GuiInventory;

import net.minecraft.client.multiplayer.GuiConnecting;

import net.minecraft.client.resources.I18n;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.Slot;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.EnumChatFormatting;

import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

 

import java.util.Collections;

 

public class GuiDecimationIngame extends GuiCustomMainMenu {

 

    public float fade = 1.0F;

    public GuiContainerDisplayText guiContainerDisplayText = new GuiContainerDisplayText(3, 0, 73, 247, 150, this);

 

    public ResourceLocation background = new ResourceLocation("mainmenu:gui/backgroundingame.png");

 

    private final String URL = "http://mcdecimation.buycraft.net/";

    private final String URL2 = "ts3server://ts.mcdecimation.net";

    private final String URL3 = "http://eu.mcdecimation.net:8123";

 

    public void actionPerformed(GuiButton button)

    {

        if (button.id == 3) {

            Minecraft.getMinecraft().displayGuiScreen(new GuiConfirmOpenLink(this, URL, 20, true));

        }

        if (button.id == 8) {

            Minecraft.getMinecraft().displayGuiScreen(new GuiConfirmOpenLink(this, URL2, 22, true));

        }

    }

 

    public void initGui() {

        super.initGui();

        initGUI();

    }

    public void initGUI() {

        int x = width / 2 - 173;

        addContainer(new GuiContainerPlayerInfo(1, x + 75, 5, 200, 25, this));

        int y = 1;

        int buttonWidth = 85;

        buttonList.add(new GuiCustomButtonSmall(3, x + 5 + buttonWidth, y + 29, buttonWidth, 10, EnumChatFormatting.BOLD + "Donate"));

        buttonList.add(new GuiCustomButtonSmall(8, x + 91 + buttonWidth, y + 29, buttonWidth, 10, EnumChatFormatting.BOLD + "Teamspeak"));

    }

 

 

    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)

    {

        this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 86, 16, 4210752);

    }

 

    public void updateScreen() {

        super.updateScreen();

    }

 

    private final int imageWidth = 247;

    private final int imageHeight = 45;

 

    @Override

    public void drawBackground(int mouseX, int mouseY, float partialTicks) {

        GuiUtils.drawImage(0.0D, 0.0D, this.background, width, height);

        GuiUtils.drawRectWithShadow(0, 0, width, 22, "0x2B2B2B", 1.0F);

    }

 

}

 

 

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.