Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Get All Items From A Inventory/GUI


8iggy
 Share

Recommended Posts

Hello Everyone! I just started learning how to code forge mods and this is my first post. I have been coding spigot plugins for 2 years so I'm not totally clueless. I just want to know how to get all the items from a Inventory/GUI. I have no clue how. I tried something like this. but it got me nowhere

@SubscribeEvent
    public void onOpenInventory(GuiOpenEvent e) {
        
        e.getGui().itemsplsssss

    }

 

Link to comment
Share on other sites

you can't actually do that, because getGui returns a Screen,
which is client side and the client doesn't know the inventory unless the client is looking at the inventory
you will need the menu (container) which is server side

what do you tried to achieve?

Link to comment
Share on other sites

8 hours ago, Luis_ST said:

you can't actually do that, because getGui returns a Screen,
which is client side and the client doesn't know the inventory unless the client is looking at the inventory
you will need the menu (container) which is server side

what do you tried to achieve?

So how do I get the container? It doesn't need to be a event btw.

Link to comment
Share on other sites

19 hours ago, Luis_ST said:

show your code where do you need the items, because the info you gave doesn't help

I currently have no code. Could you just tell me how to get a server sided container/menu and make it into a variable?

Edited by 8iggy
Link to comment
Share on other sites

18 hours ago, diesieben07 said:

Look at the Container class. Look at the list of Slots.

Thanks I Figured It Out! I Have Another Thread On How To Get The Container. Maybe You Could Help More There? 

 

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.