Jump to content

Recommended Posts

Posted

This has been bugging me for a while and I have absolutely no clue how to do it, so a detailed description of how to do this would be awesome!

 

I have a backpack

 

  Reveal hidden contents

 

Each of those 4 3x3 grids are seperate IInventories and are added by upgrading with a pouch item.

To upgrade it, you click the grid to add slots to with a "storage" item which is non removable. The grids dont exist if it hasnt been upgraded, however, they are also tripped(A value set in the container to keep all grids) so they stay there while im debugging.

I have an invisible button over those areas which when clicked sends a packet, I don't know what to put in this packet to tell it that it needs to add slots though.

 

I also need to be able to add these slots after the container has been initialised and sync them with the client. I have tried calling a method in the container from the packet to add the slots but the slots don't exist on the client and end up getting IOOBoundsExceptions when hovering over where they "should" be. So I imagine this is a sync issue.

 

Thanks for any help in advance :)

 

This is my code:

GUI

 

  Reveal hidden contents

 

 

Container

 

  Reveal hidden contents

 

Packet

 

  Reveal hidden contents

 

 

 

 

I'm Sparkst3r, that kid who makes Sphax textures.

Well hi there. :D

Posted

Why have separate inventories for each upgrade applied? Just have the container initialize certain slots based on the upgrades found to be present in the backpack. You're making this process too complicated than it has to be.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Posted
  On 5/1/2014 at 3:23 AM, DiabolusNeil said:

Why have separate inventories for each upgrade applied? Just have the container initialize certain slots based on the upgrades found to be present in the backpack. You're making this process too complicated than it has to be.

It doesn't at all need to be separate,  it just ended up that way.

And that's what I'm doing currently(see the container constructor) what I need is for the slots to be added WHILE the gui is open to make it look like its being upgraded. But I probably can merge the inventories it would be far easier to deal with shift clicking that way too.

I'm Sparkst3r, that kid who makes Sphax textures.

Well hi there. :D

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.