Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Author
1 hour ago, Luis_ST said:

I'm not sure what's the problem everything works how i think it should.

When I turn on the menu, the items that I have in the hotbar appear in 9 slots form my capability, and I want more space

Edited by Squander

15 minutes ago, Squander said:

When I turn on the menu, the items that I have in the hotbar appear in 9 slots form my capability

Please post a screenshot, so i can try to reproduce this.

  • Author

This is not a backpack, I open it with an event (only for the test) in the ClickBlock class

3 minutes ago, Luis_ST said:

Is the code in your Git repo up to date?
How did you open the Backpack?
Did you tried a new World?

ย 

Edited by Squander

1 hour ago, Squander said:

and I want more space

I'll guess you mean the size of the ExtraStorageInventory, in your case the size is set in AttachCapabilities where you create ExtraStorageInventory,
and in ClickBlock where you send the size to the client. If you change these values and handle the new Slot size in your ExtraStorageMenu you can expands the ExtraStorage.

Note if you change the value you need to create a new World.

1 hour ago, Squander said:

When I turn on the menu, the items that I have in the hotbar appear in 9 slots form my capability

Finally i found your issue, as D7 already told you can not use ITEM_HANDLER_CAPABILITY but this include IItemHandler.
Due you use IItemHandler for your Capability it always return the already attached IItemHandler (the player inventory).
The steps to solve this problem are easy:

  1. Create a new interface which extends IItemHandler
  2. Implement this interface in your ExtraStorageInventory
  3. Use this interface for your Capability and the LazyOptional
  • Author
17 minutes ago, Luis_ST said:

I'll guess you mean the size of the ExtraStorageInventory, in your case the size is set in AttachCapabilities where you create ExtraStorageInventory,
and in ClickBlock where you send the size to the client. If you change these values and handle the new Slot size in your ExtraStorageMenu you can expands the ExtraStorage.

Note if you change the value you need to create a new World.

Finally i found your issue, as D7 already told you can not use ITEM_HANDLER_CAPABILITY but this include IItemHandler.
Due you use IItemHandler for your Capability it always return the already attached IItemHandler (the player inventory).
The steps to solve this problem are easy:

  1. Create a new interface which extends IItemHandler
  2. Implement this interface in your ExtraStorageInventory
  3. Use this interface for your Capability and the LazyOptional

Does my IItemHandler extension interface need to be registered with RegisterCapabilityEvent?

Just now, Squander said:

Does my IItemHandler extension interface need to be registered with RegisterCapabilityEvent?

Yes

  • Author
1 hour ago, diesieben07 said:

Prefer composition over inheritance.

Make a class that has an IItemHandler field and use it as your capability instead of extending IitemHandler.

Should I assign a new instance to the IItemHandler field

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.