How to open equipped Curios Backpack Item with Keybind

Started by Nox_MWM04 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to open equipped Curios Backpack Item with Keybind

Hello y'all :3
I am currently making a minecraft 1.21.1 neoforge mod with MCreator 2025.2 and Nerdy's New Curios API Plugin. But I've run into an issue that I am now thoroughly stuck on, and was unable to solve by myself as I could find no resources on the matter online. I hope someone here could give me a bit of guidance for this topic.

I have created a backpack-like item that has inventory capability with 9 slots for the player to store other items. When the backpack-like item is equipped in a curios slot, I want the player to be able to open its bound inventory GUI with a keybind. Locating the item within the curios slots isn't an issue, but accessing the specific item's inventory via the GUI is. I've tried a few things with custom code (both by myself and with AI), but so far I've not been able to get it to work.

I doubt that this can be done just with mcreator procedure blocks, but I've got no problems with using custom code. So if someone could sit down with me and explain to me how exactly to implement this and how it works, that'd be greatly appreciated :3

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can the backpack be opened…
Wed, 10/29/2025 - 20:37

can the backpack be opened by just holding it and right clicking?

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, that part works. But it…
Wed, 10/29/2025 - 20:40

Yes, that part works. But it's a bit cumbersome to remove it from the curios slot and open it that way each time, so I also wanted to have the "open with keybind when equipped" thing for convenience's sake.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
damz i thought this would…
Wed, 10/29/2025 - 21:09

damz i thought this would work,

if(entity.getCapability(Capabilities.ItemHandler.ENTITY, null) instanceof IItemHandlerModifiable _item) {
      _item.getStackInSlot(0).use(entity.level(), ((Player)entity), InteractionHand.MAIN_HAND);
}

 

but it looks like the code for guis in mcreator just get the item from the player's hand anyway when it comes to populating it...

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The last thing I tried was…
Wed, 10/29/2025 - 21:23

The last thing I tried was to access my GUIs IItemHandler internal attribute to sync up the shown GUI with the inventory of the equipped backpack-like item, but so far I've had no luck with that.