Jump to content

Recommended Posts

Posted

Anyone know? I'm stuck here with my mod and I can't do much right now until I get this solved.

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Do you just want to display it? Or interact with it (like take things in and out)?

 

I'm not sure but I think you can make a container that combines any number of inventories. The "glue" that holds a container together is the inventorySlots List. You can make a custom Container that takes in various inventories (like another player's) and then map those to slots in the container. Then they should be available for display, and they should sync between client and server (provided you implement an IGuiHandler as well).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Do you just want to display it? Or interact with it (like take things in and out)?

 

I'm not sure but I think you can make a container that combines any number of inventories. The "glue" that holds a container together is the inventorySlots List. You can make a custom Container that takes in various inventories (like another player's) and then map those to slots in the container. Then they should be available for display, and they should sync between client and server (provided you implement an IGuiHandler as well).

 

How would I make the game show a container with another players inv slots? And why would I need a GuiHandler?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

A gui is nothing more than a screen wich displays data you put in. in order to be able to ineract with a gui, you need an regular guiHandler and Gui class. Beside that you need an container wich is linked to your Gui. (The container class containes the data and methodes to update the Gui). So in order to display an other players inventory, you'll need to get the instance of the other player in your container class, and use ot to retrieve data. Thats basicly it. Other than that, its just an regular Gui setup

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Posted

Then how am I supposed to send the other player variable to the Guihandler which creates the container?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Let the server send the container contents.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Okay, you seem a bit confused. Let me try to break it down for you.

 

You want to do something custom, so you're going to have to do some work. Custom GUIs aren't hard, but there are a couple tricky points and it takes a fair bit of coding to get right.

 

If you have a GUI that shows an inventory (I mean it has slots that you can move things into and out from) then it is recommended you use a Container with IGuiHandler. A Container helps map the slots in the GUI to whatever inventory you want, and the IGuiHandler ensures everything gets synced between client and server.

 

The only thing different about your GUI is you want the inventory to be from a different player. Like we've said above, that isn't really that different -- you can simply pass that in like you would the local player's inventory.

 

But the big question is how you find the player. Are you clicking on the other player, or are you just opening this GUI at some other point? If you're clicking on the player, then you can just treat it like an Entity interaction, check that it is EntityPlayer, cast it to EntityPlayer then take the inventory. If you are not clicking on the player, please describe when you want the GUI to open so we can provide suggestions.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

I get all of that, but can someone show me what to do to open the Gui and what to put in my GuiHandler because that's where I'm confused

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Note:

- Server has inventories of loaded players, to load offline inventory you would need to manipulate .dat on your own.

- Client has only constructed EntityPlayers that are in visible range. Client doesn't know shit about players that are out of range, aside from player list (nicks) sent from server. Have in mind that your client won't always be able to get desired EntityPlayer's instance (well, you can go with nicks).

1.7.10 is no longer supported by forge, you are on your own.

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.