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

Posted

I would like to add an extra slot of armor

Maybe someone can suggest the classes that I need. And where is it to be initialized. And how to put it all together.

I understand that I can be asking a lot, but I would just need a direction where to dig.

Edited by Luckydel

Basically you need a Capability which is attached to the Player, you can use a ItemStackHandler to store the ItemStack.
Then you need to add a SlotItemHandler (your Slot) to the Player inventory (Player#inventoryMenu) therefore you need to use Reflection (an AT is here not possible).
Unfortunately i have not yet found a Event which would fired at the correct point to add the Slot. Note that you need to add the Slot on server and on client.

If you set up everything correctly the Slot should be now displayed in the Player Inventory, you should be able to put in Items.
Last but not least you need to render the Slot background in the Inventory, you need to use one of the Screen Events (test which one would be the way to go).

Notes:

  1. The Slot index of you extra Slot should be calculated based on the Slot count of the inventory, to make sure you don't get any conflicts if other Mods add also Slots to the Player Inventory.
  2. I'm not sure if you be able to quick move ItemStacks in your custom Slot, since this is hardcoded in InventoryMenu#quickMoveStack

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.