Jump to content

(GUI Containers) Need help adding players inventory to my new GUI


ScottehBoeh

Recommended Posts

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

    }

 

}

 

 

Link to comment
Share on other sites

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.