Jump to content

Recommended Posts

Posted

Hello,

I have been having problems trying to add slots to a Inventory/Container/Gui for a Tile Entity. Sort of like how the Tool Station from Tinker's Construct Works. However, i have had trouble, because i cannot figure out how i would add one or two slots to the inventory screen dynamically, with me being able to just register where i want them and having my code add them.

I get this would require a lot of code, especially with the gui, but i keep on having different exceptions thrown whenever i try to register that there could be more slots than are hard-coded into me TileEntity.

Posted

A possible solution would be to not hard-code the number of slots in your TileEntity, but assign and re-assign it as needed when you add or remove slots, but this seems pretty unwieldy to me. Another option would be to handle the dynamic slots separately, as in each one could be its own IInventory / InventoryBasic, which you could then add or remove as needed.

 

Btw, TinkersConstruct is open source, so you could check out how they do it.

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.