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 have a few questions about Menus and Slots:

  • What is `slot.onQuickCraft` used for?
  • What is `slot.onTake` used for?
  • When do I have to use `slot.onTake` instead of `slot.setChanged`?

I've already looked at the documentation but I was wondering if someone could give me a further explanation on this three methods.

I'm assuming there is some kind of logic on what to do when a certain action is triggered (correct me if I'm wrong, like for example taking items from result slot and dropping exp) how is that implemented?

Edited by Infinituum

  • Infinituum changed the title to [1.19] Questions about ContainerMenus and Slot methods
  • `Slot#onQuickCraft` is used whenever the result slot is shift clicked such that the result gets put into the inventory immediately. This method is implemented by the modder themselves in AbstractContainerMenu#quickMoveStack.
  • `Slot#onTake` is used whenever the result slot is emptied. For those that are quick crafted, the method is implemented at the end of AbstractContainerMenu#quickMoveStack by the modder.
  • `Slot#setChanged` is called whenever the slot's value has changed, so it will be used whenever that happens.
  • See above and the forge docs for taking items from the result slot. Most of it is already implemented by default. Dropping experience is typically done in the `onTake` or `onQuickCraft` methods.
  • Author
1 hour ago, ChampionAsh5357 said:
  • `Slot#onQuickCraft` is used whenever the result slot is shift clicked such that the result gets put into the inventory immediately. This method is implemented by the modder themselves in AbstractContainerMenu#quickMoveStack.
  • `Slot#onTake` is used whenever the result slot is emptied. For those that are quick crafted, the method is implemented at the end of AbstractContainerMenu#quickMoveStack by the modder.
  • `Slot#setChanged` is called whenever the slot's value has changed, so it will be used whenever that happens.
  • See above and the forge docs for taking items from the result slot. Most of it is already implemented by default. Dropping experience is typically done in the `onTake` or `onQuickCraft` methods.

Ok, now I understand, thank you so much!

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.