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

Hello guys, recently I was trying to create a GUI that has 3 different containers. The GuiContainer class wound have 3 different tileentities, which are get from the surroundings, and their respective containers.

 

So, I would like to change the containers using buttons. The reason I don't want to create multiple tileentities is that some items have to be in another tileentity. I tried something like to change the pages/containers (without success, if I save the currentGuiID/page for the next openGUI. I also noticed that the itens are only client side [not sure if that is right, propably not]):

 

 

 

switch (guiID)

{

case 0:

this.inventorySlots = this.containerTile1;

this.disableButtonsTile2();

this.disableButtonsTile3();

break;

case 1:

if (this.hasValidItem && this.tile2 != null && this.containerTile2 != null)

{

this.inventorySlots = this.containerTile2;

        this.disableButtonsTile1();

        this.disableButtonsTile3();

}

break;

case 2:

if (this.hasValidItem && this.tile3 != null && this.containerTile3 != null)

{

this.inventorySlots = this.containerCultivator;

        this.disableButtonsTile1();

        this.disableButtonsTile2();

}

break;

default:

this.inventorySlots = this.containerTile1;

this.disableButtonsTile2();

this.disableButtonsTile3();

}

this.setCurrentGUI(guiID);

this.mc.thePlayer.openContainer = this.inventorySlots;

 

 

 

Basically, I would like to do something similar to the creativeTabs, where the player can dynamically change the pages and containers easily.

 

 

  • Author

Right, I got the idea. I just have a question: how would I change the position of the slots? Changing a field in the container class, maybe?

Hi

 

This project has an example of a container with two inventories; it's for 1.8 but the comments should help you out a lot because they haven't really changed from 1.7

 

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe30_inventory_basic

 

and a bit of extra info here

http://greyminecraftcoder.blogspot.com.au/2015/01/gui-containers.html

 

-TGG

 

---------

MBE30_INVENTORY_BASIC

Code by Brandon3055

 

This example shows how to make an inventory block similar to a chest, with less storage space (a Footlocker)

 

The example will show you

1) how to create a simple Block with a linked TileEntity that will store items permanently

2) how to set up a Container, linked GuiContainer, and IGuiHandler to add/remove items from the TileEntity.

-------------

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.