Jump to content

Recommended Posts

Posted (edited)

I am currently trying to make a simple object, with no special rules, that lets you right click it, and open a chest like inventory.

After several days of looking around, viewing published sources from a few different mods and bouncing around the Forum looking for help, I have made zero progress. I believe I have the basic knowledge expected, but this task is seriously making me wonder. Help is wanted desperately. I am working in 1.19.2.

 

Edited by Valenwar
missing vital info
Posted

It's not something I have ever done myself.

I've done it with BlockItems like Shulker boxes, but that's different because vanilla has special handling for BlockEntity data stored in BlockItems.

 

I would suggest finding a mod that does something similar to what you want? e.g.

https://github.com/P3pp3rF1y/SophisticatedBackpacks/blob/cab406e07d10563f6fa648c1882dfad0ddde8cfd/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java#L284
The most important methods will be:

Item.use() -> opens the gui menu
Item.initCapabilities() -> adds an ItemHandlerCapability to the item's ItemStacks, i.e. an inventory

There is obviously more to it than this, but these are the basic entry points you can start from.

Maybe you can find a simpler example than sophisticated backpacks? 🙂

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

For future reference to anyone else attempting this, the BundleItem might be a good place to start, it doesnt have a chest UI, but it does store items within.

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.